Home | History | Annotate | Line # | Download | only in ixgbe
ixgbe_dcb_82598.c revision 1.10
      1  1.10  msaitoh /* $NetBSD: ixgbe_dcb_82598.c,v 1.10 2021/12/10 11:16:54 msaitoh Exp $ */
      2   1.1  msaitoh /******************************************************************************
      3   1.5  msaitoh   SPDX-License-Identifier: BSD-3-Clause
      4   1.1  msaitoh 
      5   1.4  msaitoh   Copyright (c) 2001-2017, Intel Corporation
      6   1.1  msaitoh   All rights reserved.
      7   1.4  msaitoh 
      8   1.4  msaitoh   Redistribution and use in source and binary forms, with or without
      9   1.1  msaitoh   modification, are permitted provided that the following conditions are met:
     10   1.4  msaitoh 
     11   1.4  msaitoh    1. Redistributions of source code must retain the above copyright notice,
     12   1.1  msaitoh       this list of conditions and the following disclaimer.
     13   1.4  msaitoh 
     14   1.4  msaitoh    2. Redistributions in binary form must reproduce the above copyright
     15   1.4  msaitoh       notice, this list of conditions and the following disclaimer in the
     16   1.1  msaitoh       documentation and/or other materials provided with the distribution.
     17   1.4  msaitoh 
     18   1.4  msaitoh    3. Neither the name of the Intel Corporation nor the names of its
     19   1.4  msaitoh       contributors may be used to endorse or promote products derived from
     20   1.1  msaitoh       this software without specific prior written permission.
     21   1.4  msaitoh 
     22   1.1  msaitoh   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     23   1.4  msaitoh   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24   1.4  msaitoh   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25   1.4  msaitoh   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     26   1.4  msaitoh   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27   1.4  msaitoh   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28   1.4  msaitoh   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29   1.4  msaitoh   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30   1.4  msaitoh   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31   1.1  msaitoh   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     32   1.1  msaitoh   POSSIBILITY OF SUCH DAMAGE.
     33   1.1  msaitoh 
     34   1.1  msaitoh ******************************************************************************/
     35   1.7  msaitoh /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.c 331224 2018-03-19 20:55:05Z erj $*/
     36   1.1  msaitoh 
     37   1.9  msaitoh #include <sys/cdefs.h>
     38  1.10  msaitoh __KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb_82598.c,v 1.10 2021/12/10 11:16:54 msaitoh Exp $");
     39   1.1  msaitoh 
     40   1.1  msaitoh #include "ixgbe_type.h"
     41   1.1  msaitoh #include "ixgbe_dcb.h"
     42   1.1  msaitoh #include "ixgbe_dcb_82598.h"
     43   1.1  msaitoh 
     44   1.1  msaitoh /**
     45   1.1  msaitoh  * ixgbe_dcb_get_tc_stats_82598 - Return status data for each traffic class
     46   1.1  msaitoh  * @hw: pointer to hardware structure
     47   1.1  msaitoh  * @stats: pointer to statistics structure
     48   1.1  msaitoh  * @tc_count:  Number of elements in bwg_array.
     49   1.1  msaitoh  *
     50   1.1  msaitoh  * This function returns the status data for each of the Traffic Classes in use.
     51   1.1  msaitoh  */
     52   1.1  msaitoh s32 ixgbe_dcb_get_tc_stats_82598(struct ixgbe_hw *hw,
     53   1.1  msaitoh 				 struct ixgbe_hw_stats *stats,
     54   1.1  msaitoh 				 u8 tc_count)
     55   1.1  msaitoh {
     56   1.1  msaitoh 	int tc;
     57   1.1  msaitoh 
     58   1.1  msaitoh 	DEBUGFUNC("dcb_get_tc_stats");
     59   1.1  msaitoh 
     60   1.1  msaitoh 	if (tc_count > IXGBE_DCB_MAX_TRAFFIC_CLASS)
     61   1.1  msaitoh 		return IXGBE_ERR_PARAM;
     62   1.1  msaitoh 
     63   1.1  msaitoh 	/* Statistics pertaining to each traffic class */
     64   1.1  msaitoh 	for (tc = 0; tc < tc_count; tc++) {
     65   1.1  msaitoh 		/* Transmitted Packets */
     66   1.1  msaitoh 		stats->qptc[tc] += IXGBE_READ_REG(hw, IXGBE_QPTC(tc));
     67   1.1  msaitoh 		/* Transmitted Bytes */
     68   1.1  msaitoh 		stats->qbtc[tc] += IXGBE_READ_REG(hw, IXGBE_QBTC(tc));
     69   1.1  msaitoh 		/* Received Packets */
     70   1.1  msaitoh 		stats->qprc[tc] += IXGBE_READ_REG(hw, IXGBE_QPRC(tc));
     71   1.1  msaitoh 		/* Received Bytes */
     72   1.1  msaitoh 		stats->qbrc[tc] += IXGBE_READ_REG(hw, IXGBE_QBRC(tc));
     73   1.1  msaitoh 
     74   1.1  msaitoh #if 0
     75   1.1  msaitoh 		/* Can we get rid of these??  Consequently, getting rid
     76   1.1  msaitoh 		 * of the tc_stats structure.
     77   1.1  msaitoh 		 */
     78   1.1  msaitoh 		tc_stats_array[up]->in_overflow_discards = 0;
     79   1.1  msaitoh 		tc_stats_array[up]->out_overflow_discards = 0;
     80   1.1  msaitoh #endif
     81   1.1  msaitoh 	}
     82   1.1  msaitoh 
     83   1.1  msaitoh 	return IXGBE_SUCCESS;
     84   1.1  msaitoh }
     85   1.1  msaitoh 
     86   1.1  msaitoh /**
     87   1.1  msaitoh  * ixgbe_dcb_get_pfc_stats_82598 - Returns CBFC status data
     88   1.1  msaitoh  * @hw: pointer to hardware structure
     89   1.1  msaitoh  * @stats: pointer to statistics structure
     90   1.1  msaitoh  * @tc_count:  Number of elements in bwg_array.
     91   1.1  msaitoh  *
     92   1.1  msaitoh  * This function returns the CBFC status data for each of the Traffic Classes.
     93   1.1  msaitoh  */
     94   1.1  msaitoh s32 ixgbe_dcb_get_pfc_stats_82598(struct ixgbe_hw *hw,
     95   1.1  msaitoh 				  struct ixgbe_hw_stats *stats,
     96   1.1  msaitoh 				  u8 tc_count)
     97   1.1  msaitoh {
     98   1.1  msaitoh 	int tc;
     99   1.1  msaitoh 
    100   1.1  msaitoh 	DEBUGFUNC("dcb_get_pfc_stats");
    101   1.1  msaitoh 
    102   1.1  msaitoh 	if (tc_count > IXGBE_DCB_MAX_TRAFFIC_CLASS)
    103   1.1  msaitoh 		return IXGBE_ERR_PARAM;
    104   1.1  msaitoh 
    105   1.1  msaitoh 	for (tc = 0; tc < tc_count; tc++) {
    106   1.1  msaitoh 		/* Priority XOFF Transmitted */
    107   1.1  msaitoh 		stats->pxofftxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFTXC(tc));
    108   1.1  msaitoh 		/* Priority XOFF Received */
    109   1.1  msaitoh 		stats->pxoffrxc[tc] += IXGBE_READ_REG(hw, IXGBE_PXOFFRXC(tc));
    110   1.1  msaitoh 	}
    111   1.1  msaitoh 
    112   1.1  msaitoh 	return IXGBE_SUCCESS;
    113   1.1  msaitoh }
    114   1.1  msaitoh 
    115   1.1  msaitoh /**
    116   1.1  msaitoh  * ixgbe_dcb_config_rx_arbiter_82598 - Config Rx data arbiter
    117   1.1  msaitoh  * @hw: pointer to hardware structure
    118   1.7  msaitoh  * @refill: refill credits index by traffic class
    119   1.7  msaitoh  * @max: max credits index by traffic class
    120   1.7  msaitoh  * @tsa: transmission selection algorithm indexed by traffic class
    121   1.1  msaitoh  *
    122   1.1  msaitoh  * Configure Rx Data Arbiter and credits for each traffic class.
    123   1.1  msaitoh  */
    124   1.1  msaitoh s32 ixgbe_dcb_config_rx_arbiter_82598(struct ixgbe_hw *hw, u16 *refill,
    125   1.1  msaitoh 				      u16 *max, u8 *tsa)
    126   1.1  msaitoh {
    127   1.1  msaitoh 	u32 reg = 0;
    128   1.1  msaitoh 	u32 credit_refill = 0;
    129   1.1  msaitoh 	u32 credit_max = 0;
    130   1.1  msaitoh 	u8 i = 0;
    131   1.1  msaitoh 
    132   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_RUPPBMR) | IXGBE_RUPPBMR_MQA;
    133   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_RUPPBMR, reg);
    134   1.1  msaitoh 
    135   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
    136   1.1  msaitoh 	/* Enable Arbiter */
    137   1.1  msaitoh 	reg &= ~IXGBE_RMCS_ARBDIS;
    138   1.1  msaitoh 	/* Enable Receive Recycle within the BWG */
    139   1.1  msaitoh 	reg |= IXGBE_RMCS_RRM;
    140   1.1  msaitoh 	/* Enable Deficit Fixed Priority arbitration*/
    141   1.1  msaitoh 	reg |= IXGBE_RMCS_DFP;
    142   1.1  msaitoh 
    143   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_RMCS, reg);
    144   1.1  msaitoh 
    145   1.1  msaitoh 	/* Configure traffic class credits and priority */
    146   1.1  msaitoh 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
    147   1.1  msaitoh 		credit_refill = refill[i];
    148   1.1  msaitoh 		credit_max = max[i];
    149   1.1  msaitoh 
    150   1.1  msaitoh 		reg = credit_refill | (credit_max << IXGBE_RT2CR_MCL_SHIFT);
    151   1.1  msaitoh 
    152   1.1  msaitoh 		if (tsa[i] == ixgbe_dcb_tsa_strict)
    153   1.1  msaitoh 			reg |= IXGBE_RT2CR_LSP;
    154   1.1  msaitoh 
    155   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_RT2CR(i), reg);
    156   1.1  msaitoh 	}
    157   1.1  msaitoh 
    158   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_RDRXCTL);
    159   1.1  msaitoh 	reg |= IXGBE_RDRXCTL_RDMTS_1_2;
    160   1.1  msaitoh 	reg |= IXGBE_RDRXCTL_MPBEN;
    161   1.1  msaitoh 	reg |= IXGBE_RDRXCTL_MCEN;
    162   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_RDRXCTL, reg);
    163   1.1  msaitoh 
    164   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
    165   1.1  msaitoh 	/* Make sure there is enough descriptors before arbitration */
    166   1.1  msaitoh 	reg &= ~IXGBE_RXCTRL_DMBYPS;
    167   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_RXCTRL, reg);
    168   1.1  msaitoh 
    169   1.1  msaitoh 	return IXGBE_SUCCESS;
    170   1.1  msaitoh }
    171   1.1  msaitoh 
    172   1.1  msaitoh /**
    173   1.1  msaitoh  * ixgbe_dcb_config_tx_desc_arbiter_82598 - Config Tx Desc. arbiter
    174   1.1  msaitoh  * @hw: pointer to hardware structure
    175   1.7  msaitoh  * @refill: refill credits index by traffic class
    176   1.7  msaitoh  * @max: max credits index by traffic class
    177   1.7  msaitoh  * @bwg_id: bandwidth grouping indexed by traffic class
    178   1.7  msaitoh  * @tsa: transmission selection algorithm indexed by traffic class
    179   1.1  msaitoh  *
    180   1.1  msaitoh  * Configure Tx Descriptor Arbiter and credits for each traffic class.
    181   1.1  msaitoh  */
    182   1.1  msaitoh s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *hw,
    183   1.1  msaitoh 					   u16 *refill, u16 *max, u8 *bwg_id,
    184   1.1  msaitoh 					   u8 *tsa)
    185   1.1  msaitoh {
    186   1.1  msaitoh 	u32 reg, max_credits;
    187   1.1  msaitoh 	u8 i;
    188   1.1  msaitoh 
    189   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_DPMCS);
    190   1.1  msaitoh 
    191   1.1  msaitoh 	/* Enable arbiter */
    192   1.1  msaitoh 	reg &= ~IXGBE_DPMCS_ARBDIS;
    193   1.1  msaitoh 	reg |= IXGBE_DPMCS_TSOEF;
    194   1.1  msaitoh 
    195   1.1  msaitoh 	/* Configure Max TSO packet size 34KB including payload and headers */
    196   1.1  msaitoh 	reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT);
    197   1.1  msaitoh 
    198   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_DPMCS, reg);
    199   1.1  msaitoh 
    200   1.1  msaitoh 	/* Configure traffic class credits and priority */
    201   1.1  msaitoh 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
    202   1.1  msaitoh 		max_credits = max[i];
    203   1.1  msaitoh 		reg = max_credits << IXGBE_TDTQ2TCCR_MCL_SHIFT;
    204  1.10  msaitoh 		reg |= (u32)(refill[i]);
    205   1.1  msaitoh 		reg |= (u32)(bwg_id[i]) << IXGBE_TDTQ2TCCR_BWG_SHIFT;
    206   1.1  msaitoh 
    207   1.1  msaitoh 		if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee)
    208   1.1  msaitoh 			reg |= IXGBE_TDTQ2TCCR_GSP;
    209   1.1  msaitoh 
    210   1.1  msaitoh 		if (tsa[i] == ixgbe_dcb_tsa_strict)
    211   1.1  msaitoh 			reg |= IXGBE_TDTQ2TCCR_LSP;
    212   1.1  msaitoh 
    213   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_TDTQ2TCCR(i), reg);
    214   1.1  msaitoh 	}
    215   1.1  msaitoh 
    216   1.1  msaitoh 	return IXGBE_SUCCESS;
    217   1.1  msaitoh }
    218   1.1  msaitoh 
    219   1.1  msaitoh /**
    220   1.1  msaitoh  * ixgbe_dcb_config_tx_data_arbiter_82598 - Config Tx data arbiter
    221   1.1  msaitoh  * @hw: pointer to hardware structure
    222   1.7  msaitoh  * @refill: refill credits index by traffic class
    223   1.7  msaitoh  * @max: max credits index by traffic class
    224   1.7  msaitoh  * @bwg_id: bandwidth grouping indexed by traffic class
    225   1.7  msaitoh  * @tsa: transmission selection algorithm indexed by traffic class
    226   1.1  msaitoh  *
    227   1.1  msaitoh  * Configure Tx Data Arbiter and credits for each traffic class.
    228   1.1  msaitoh  */
    229   1.1  msaitoh s32 ixgbe_dcb_config_tx_data_arbiter_82598(struct ixgbe_hw *hw,
    230   1.1  msaitoh 					   u16 *refill, u16 *max, u8 *bwg_id,
    231   1.1  msaitoh 					   u8 *tsa)
    232   1.1  msaitoh {
    233   1.1  msaitoh 	u32 reg;
    234   1.1  msaitoh 	u8 i;
    235   1.1  msaitoh 
    236   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_PDPMCS);
    237   1.1  msaitoh 	/* Enable Data Plane Arbiter */
    238   1.1  msaitoh 	reg &= ~IXGBE_PDPMCS_ARBDIS;
    239   1.1  msaitoh 	/* Enable DFP and Transmit Recycle Mode */
    240   1.1  msaitoh 	reg |= (IXGBE_PDPMCS_TPPAC | IXGBE_PDPMCS_TRM);
    241   1.1  msaitoh 
    242   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_PDPMCS, reg);
    243   1.1  msaitoh 
    244   1.1  msaitoh 	/* Configure traffic class credits and priority */
    245   1.1  msaitoh 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
    246   1.1  msaitoh 		reg = refill[i];
    247   1.1  msaitoh 		reg |= (u32)(max[i]) << IXGBE_TDPT2TCCR_MCL_SHIFT;
    248   1.1  msaitoh 		reg |= (u32)(bwg_id[i]) << IXGBE_TDPT2TCCR_BWG_SHIFT;
    249   1.1  msaitoh 
    250   1.1  msaitoh 		if (tsa[i] == ixgbe_dcb_tsa_group_strict_cee)
    251   1.1  msaitoh 			reg |= IXGBE_TDPT2TCCR_GSP;
    252   1.1  msaitoh 
    253   1.1  msaitoh 		if (tsa[i] == ixgbe_dcb_tsa_strict)
    254   1.1  msaitoh 			reg |= IXGBE_TDPT2TCCR_LSP;
    255   1.1  msaitoh 
    256   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_TDPT2TCCR(i), reg);
    257   1.1  msaitoh 	}
    258   1.1  msaitoh 
    259   1.1  msaitoh 	/* Enable Tx packet buffer division */
    260   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_DTXCTL);
    261   1.1  msaitoh 	reg |= IXGBE_DTXCTL_ENDBUBD;
    262   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_DTXCTL, reg);
    263   1.1  msaitoh 
    264   1.1  msaitoh 	return IXGBE_SUCCESS;
    265   1.1  msaitoh }
    266   1.1  msaitoh 
    267   1.1  msaitoh /**
    268   1.1  msaitoh  * ixgbe_dcb_config_pfc_82598 - Config priority flow control
    269   1.1  msaitoh  * @hw: pointer to hardware structure
    270   1.7  msaitoh  * @pfc_en: enabled pfc bitmask
    271   1.1  msaitoh  *
    272   1.1  msaitoh  * Configure Priority Flow Control for each traffic class.
    273   1.1  msaitoh  */
    274   1.1  msaitoh s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw, u8 pfc_en)
    275   1.1  msaitoh {
    276   1.1  msaitoh 	u32 fcrtl, reg;
    277   1.1  msaitoh 	u8 i;
    278   1.1  msaitoh 
    279   1.1  msaitoh 	/* Enable Transmit Priority Flow Control */
    280   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
    281   1.1  msaitoh 	reg &= ~IXGBE_RMCS_TFCE_802_3X;
    282   1.1  msaitoh 	reg |= IXGBE_RMCS_TFCE_PRIORITY;
    283   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_RMCS, reg);
    284   1.1  msaitoh 
    285   1.1  msaitoh 	/* Enable Receive Priority Flow Control */
    286   1.1  msaitoh 	reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
    287   1.1  msaitoh 	reg &= ~(IXGBE_FCTRL_RPFCE | IXGBE_FCTRL_RFCE);
    288   1.1  msaitoh 
    289   1.1  msaitoh 	if (pfc_en)
    290   1.1  msaitoh 		reg |= IXGBE_FCTRL_RPFCE;
    291   1.1  msaitoh 
    292   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_FCTRL, reg);
    293   1.1  msaitoh 
    294   1.1  msaitoh 	/* Configure PFC Tx thresholds per TC */
    295   1.1  msaitoh 	for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
    296   1.1  msaitoh 		if (!(pfc_en & (1 << i))) {
    297   1.1  msaitoh 			IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), 0);
    298   1.1  msaitoh 			IXGBE_WRITE_REG(hw, IXGBE_FCRTH(i), 0);
    299   1.1  msaitoh 			continue;
    300   1.1  msaitoh 		}
    301   1.1  msaitoh 
    302   1.1  msaitoh 		fcrtl = (hw->fc.low_water[i] << 10) | IXGBE_FCRTL_XONE;
    303   1.1  msaitoh 		reg = (hw->fc.high_water[i] << 10) | IXGBE_FCRTH_FCEN;
    304   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_FCRTL(i), fcrtl);
    305   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_FCRTH(i), reg);
    306   1.1  msaitoh 	}
    307   1.1  msaitoh 
    308   1.1  msaitoh 	/* Configure pause time */
    309   1.1  msaitoh 	reg = hw->fc.pause_time | (hw->fc.pause_time << 16);
    310   1.1  msaitoh 	for (i = 0; i < (IXGBE_DCB_MAX_TRAFFIC_CLASS / 2); i++)
    311   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);
    312   1.1  msaitoh 
    313   1.1  msaitoh 	/* Configure flow control refresh threshold value */
    314   1.1  msaitoh 	IXGBE_WRITE_REG(hw, IXGBE_FCRTV, hw->fc.pause_time / 2);
    315   1.1  msaitoh 
    316   1.1  msaitoh 	return IXGBE_SUCCESS;
    317   1.1  msaitoh }
    318   1.1  msaitoh 
    319   1.1  msaitoh /**
    320   1.1  msaitoh  * ixgbe_dcb_config_tc_stats_82598 - Configure traffic class statistics
    321   1.1  msaitoh  * @hw: pointer to hardware structure
    322   1.1  msaitoh  *
    323   1.1  msaitoh  * Configure queue statistics registers, all queues belonging to same traffic
    324   1.1  msaitoh  * class uses a single set of queue statistics counters.
    325   1.1  msaitoh  */
    326   1.1  msaitoh s32 ixgbe_dcb_config_tc_stats_82598(struct ixgbe_hw *hw)
    327   1.1  msaitoh {
    328   1.1  msaitoh 	u32 reg = 0;
    329   1.1  msaitoh 	u8 i = 0;
    330   1.1  msaitoh 	u8 j = 0;
    331   1.1  msaitoh 
    332   1.1  msaitoh 	/* Receive Queues stats setting -  8 queues per statistics reg */
    333   1.1  msaitoh 	for (i = 0, j = 0; i < 15 && j < 8; i = i + 2, j++) {
    334   1.1  msaitoh 		reg = IXGBE_READ_REG(hw, IXGBE_RQSMR(i));
    335   1.1  msaitoh 		reg |= ((0x1010101) * j);
    336   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_RQSMR(i), reg);
    337   1.1  msaitoh 		reg = IXGBE_READ_REG(hw, IXGBE_RQSMR(i + 1));
    338   1.1  msaitoh 		reg |= ((0x1010101) * j);
    339   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_RQSMR(i + 1), reg);
    340   1.1  msaitoh 	}
    341   1.1  msaitoh 	/* Transmit Queues stats setting -  4 queues per statistics reg*/
    342   1.1  msaitoh 	for (i = 0; i < 8; i++) {
    343   1.1  msaitoh 		reg = IXGBE_READ_REG(hw, IXGBE_TQSMR(i));
    344   1.1  msaitoh 		reg |= ((0x1010101) * i);
    345   1.1  msaitoh 		IXGBE_WRITE_REG(hw, IXGBE_TQSMR(i), reg);
    346   1.1  msaitoh 	}
    347   1.1  msaitoh 
    348   1.1  msaitoh 	return IXGBE_SUCCESS;
    349   1.1  msaitoh }
    350   1.1  msaitoh 
    351   1.1  msaitoh /**
    352   1.1  msaitoh  * ixgbe_dcb_hw_config_82598 - Config and enable DCB
    353   1.1  msaitoh  * @hw: pointer to hardware structure
    354   1.7  msaitoh  * @link_speed: unused
    355   1.7  msaitoh  * @refill: refill credits index by traffic class
    356   1.7  msaitoh  * @max: max credits index by traffic class
    357   1.7  msaitoh  * @bwg_id: bandwidth grouping indexed by traffic class
    358   1.7  msaitoh  * @tsa: transmission selection algorithm indexed by traffic class
    359   1.1  msaitoh  *
    360   1.1  msaitoh  * Configure dcb settings and enable dcb mode.
    361   1.1  msaitoh  */
    362   1.1  msaitoh s32 ixgbe_dcb_hw_config_82598(struct ixgbe_hw *hw, int link_speed,
    363   1.1  msaitoh 			      u16 *refill, u16 *max, u8 *bwg_id,
    364   1.1  msaitoh 			      u8 *tsa)
    365   1.1  msaitoh {
    366   1.2  msaitoh 	UNREFERENCED_1PARAMETER(link_speed);
    367   1.2  msaitoh 
    368   1.1  msaitoh 	ixgbe_dcb_config_rx_arbiter_82598(hw, refill, max, tsa);
    369   1.1  msaitoh 	ixgbe_dcb_config_tx_desc_arbiter_82598(hw, refill, max, bwg_id,
    370   1.1  msaitoh 					       tsa);
    371   1.1  msaitoh 	ixgbe_dcb_config_tx_data_arbiter_82598(hw, refill, max, bwg_id,
    372   1.1  msaitoh 					       tsa);
    373   1.1  msaitoh 	ixgbe_dcb_config_tc_stats_82598(hw);
    374   1.1  msaitoh 
    375   1.1  msaitoh 
    376   1.1  msaitoh 	return IXGBE_SUCCESS;
    377   1.1  msaitoh }
    378