| /******************************************************************************* |
| |
| Intel 10 Gigabit PCI Express Linux driver |
| Copyright(c) 1999 - 2008 Intel Corporation. |
| |
| This program is free software; you can redistribute it and/or modify it |
| under the terms and conditions of the GNU General Public License, |
| version 2, as published by the Free Software Foundation. |
| |
| This program is distributed in the hope it will be useful, but WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| more details. |
| |
| You should have received a copy of the GNU General Public License along with |
| this program; if not, write to the Free Software Foundation, Inc., |
| 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| |
| The full GNU General Public License is included in this distribution in |
| the file called "COPYING". |
| |
| Contact Information: |
| Linux NICS <linux.nics@intel.com> |
| e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> |
| Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| |
| *******************************************************************************/ |
| |
| #include "ixgbe.h" |
| #include <linux/dcbnl.h> |
| |
| /* Callbacks for DCB netlink in the kernel */ |
| #define BIT_DCB_MODE 0x01 |
| #define BIT_PFC 0x02 |
| #define BIT_PG_RX 0x04 |
| #define BIT_PG_TX 0x08 |
| #define BIT_BCN 0x10 |
| |
| int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, |
| struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) |
| { |
| struct tc_configuration *src_tc_cfg = NULL; |
| struct tc_configuration *dst_tc_cfg = NULL; |
| int i; |
| |
| if (!src_dcb_cfg || !dst_dcb_cfg) |
| return -EINVAL; |
| |
| for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { |
| src_tc_cfg = &src_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
| dst_tc_cfg = &dst_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
| |
| dst_tc_cfg->path[DCB_TX_CONFIG].prio_type = |
| src_tc_cfg->path[DCB_TX_CONFIG].prio_type; |
| |
| dst_tc_cfg->path[DCB_TX_CONFIG].bwg_id = |
| src_tc_cfg->path[DCB_TX_CONFIG].bwg_id; |
| |
| dst_tc_cfg->path[DCB_TX_CONFIG].bwg_percent = |
| src_tc_cfg->path[DCB_TX_CONFIG].bwg_percent; |
| |
| dst_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap = |
| src_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap; |
| |
| dst_tc_cfg->path[DCB_RX_CONFIG].prio_type = |
| src_tc_cfg->path[DCB_RX_CONFIG].prio_type; |
| |
| dst_tc_cfg->path[DCB_RX_CONFIG].bwg_id = |
| src_tc_cfg->path[DCB_RX_CONFIG].bwg_id; |
| |
| dst_tc_cfg->path[DCB_RX_CONFIG].bwg_percent = |
| src_tc_cfg->path[DCB_RX_CONFIG].bwg_percent; |
| |
| dst_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap = |
| src_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap; |
| } |
| |
| for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { |
| dst_dcb_cfg->bw_percentage[DCB_TX_CONFIG] |
| [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage |
| [DCB_TX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; |
| dst_dcb_cfg->bw_percentage[DCB_RX_CONFIG] |
| [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage |
| [DCB_RX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; |
| } |
| |
| for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { |
| dst_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc = |
| src_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc; |
| } |
| |
| for (i = DCB_BCN_ATTR_RP_0; i < DCB_BCN_ATTR_RP_ALL; i++) { |
| dst_dcb_cfg->bcn.rp_admin_mode[i - DCB_BCN_ATTR_RP_0] = |
| src_dcb_cfg->bcn.rp_admin_mode[i - DCB_BCN_ATTR_RP_0]; |
| } |
| dst_dcb_cfg->bcn.bcna_option[0] = src_dcb_cfg->bcn.bcna_option[0]; |
| dst_dcb_cfg->bcn.bcna_option[1] = src_dcb_cfg->bcn.bcna_option[1]; |
| dst_dcb_cfg->bcn.rp_alpha = src_dcb_cfg->bcn.rp_alpha; |
| dst_dcb_cfg->bcn.rp_beta = src_dcb_cfg->bcn.rp_beta; |
| dst_dcb_cfg->bcn.rp_gd = src_dcb_cfg->bcn.rp_gd; |
| dst_dcb_cfg->bcn.rp_gi = src_dcb_cfg->bcn.rp_gi; |
| dst_dcb_cfg->bcn.rp_tmax = src_dcb_cfg->bcn.rp_tmax; |
| dst_dcb_cfg->bcn.rp_td = src_dcb_cfg->bcn.rp_td; |
| dst_dcb_cfg->bcn.rp_rmin = src_dcb_cfg->bcn.rp_rmin; |
| dst_dcb_cfg->bcn.rp_w = src_dcb_cfg->bcn.rp_w; |
| dst_dcb_cfg->bcn.rp_rd = src_dcb_cfg->bcn.rp_rd; |
| dst_dcb_cfg->bcn.rp_ru = src_dcb_cfg->bcn.rp_ru; |
| dst_dcb_cfg->bcn.rp_wrtt = src_dcb_cfg->bcn.rp_wrtt; |
| dst_dcb_cfg->bcn.rp_ri = src_dcb_cfg->bcn.rp_ri; |
| |
| return 0; |
| } |
| |
| static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| DPRINTK(DRV, INFO, "Get DCB Admin Mode.\n"); |
| |
| return !!(adapter->flags & IXGBE_FLAG_DCB_ENABLED); |
| } |
| |
| static u16 ixgbe_dcb_select_queue(struct net_device *dev, struct sk_buff *skb) |
| { |
| /* All traffic should default to class 0 */ |
| return 0; |
| } |
| |
| static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) |
| { |
| u8 err = 0; |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| DPRINTK(DRV, INFO, "Set DCB Admin Mode.\n"); |
| |
| if (state > 0) { |
| /* Turn on DCB */ |
| if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) |
| goto out; |
| |
| if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED)) { |
| DPRINTK(DRV, ERR, "Enable failed, needs MSI-X\n"); |
| err = 1; |
| goto out; |
| } |
| |
| if (netif_running(netdev)) |
| netdev->netdev_ops->ndo_stop(netdev); |
| ixgbe_reset_interrupt_capability(adapter); |
| ixgbe_napi_del_all(adapter); |
| INIT_LIST_HEAD(&netdev->napi_list); |
| kfree(adapter->tx_ring); |
| kfree(adapter->rx_ring); |
| adapter->tx_ring = NULL; |
| adapter->rx_ring = NULL; |
| netdev->select_queue = &ixgbe_dcb_select_queue; |
| |
| adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; |
| adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
| ixgbe_init_interrupt_scheme(adapter); |
| if (netif_running(netdev)) |
| netdev->netdev_ops->ndo_open(netdev); |
| } else { |
| /* Turn off DCB */ |
| if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
| if (netif_running(netdev)) |
| netdev->netdev_ops->ndo_stop(netdev); |
| ixgbe_reset_interrupt_capability(adapter); |
| ixgbe_napi_del_all(adapter); |
| INIT_LIST_HEAD(&netdev->napi_list); |
| kfree(adapter->tx_ring); |
| kfree(adapter->rx_ring); |
| adapter->tx_ring = NULL; |
| adapter->rx_ring = NULL; |
| netdev->select_queue = NULL; |
| |
| adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; |
| adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
| ixgbe_init_interrupt_scheme(adapter); |
| if (netif_running(netdev)) |
| netdev->netdev_ops->ndo_open(netdev); |
| } |
| } |
| out: |
| return err; |
| } |
| |
| static void ixgbe_dcbnl_get_perm_hw_addr(struct net_device *netdev, |
| u8 *perm_addr) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| int i; |
| |
| for (i = 0; i < netdev->addr_len; i++) |
| perm_addr[i] = adapter->hw.mac.perm_addr[i]; |
| } |
| |
| static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, |
| u8 prio, u8 bwg_id, u8 bw_pct, |
| u8 up_map) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| if (prio != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[0].prio_type = prio; |
| if (bwg_id != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_id = bwg_id; |
| if (bw_pct != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent = |
| bw_pct; |
| if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = |
| up_map; |
| |
| if ((adapter->temp_dcb_cfg.tc_config[tc].path[0].prio_type != |
| adapter->dcb_cfg.tc_config[tc].path[0].prio_type) || |
| (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_id != |
| adapter->dcb_cfg.tc_config[tc].path[0].bwg_id) || |
| (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent != |
| adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent) || |
| (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != |
| adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) |
| adapter->dcb_set_bitmap |= BIT_PG_TX; |
| } |
| |
| static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, |
| u8 bw_pct) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; |
| |
| if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != |
| adapter->dcb_cfg.bw_percentage[0][bwg_id]) |
| adapter->dcb_set_bitmap |= BIT_PG_RX; |
| } |
| |
| static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, |
| u8 prio, u8 bwg_id, u8 bw_pct, |
| u8 up_map) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| if (prio != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[1].prio_type = prio; |
| if (bwg_id != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_id = bwg_id; |
| if (bw_pct != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent = |
| bw_pct; |
| if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
| adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = |
| up_map; |
| |
| if ((adapter->temp_dcb_cfg.tc_config[tc].path[1].prio_type != |
| adapter->dcb_cfg.tc_config[tc].path[1].prio_type) || |
| (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_id != |
| adapter->dcb_cfg.tc_config[tc].path[1].bwg_id) || |
| (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent != |
| adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent) || |
| (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != |
| adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)) |
| adapter->dcb_set_bitmap |= BIT_PG_RX; |
| } |
| |
| static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, |
| u8 bw_pct) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; |
| |
| if (adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] != |
| adapter->dcb_cfg.bw_percentage[1][bwg_id]) |
| adapter->dcb_set_bitmap |= BIT_PG_RX; |
| } |
| |
| static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, |
| u8 *prio, u8 *bwg_id, u8 *bw_pct, |
| u8 *up_map) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| *prio = adapter->dcb_cfg.tc_config[tc].path[0].prio_type; |
| *bwg_id = adapter->dcb_cfg.tc_config[tc].path[0].bwg_id; |
| *bw_pct = adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent; |
| *up_map = adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap; |
| } |
| |
| static void ixgbe_dcbnl_get_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, |
| u8 *bw_pct) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| *bw_pct = adapter->dcb_cfg.bw_percentage[0][bwg_id]; |
| } |
| |
| static void ixgbe_dcbnl_get_pg_tc_cfg_rx(struct net_device *netdev, int tc, |
| u8 *prio, u8 *bwg_id, u8 *bw_pct, |
| u8 *up_map) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| *prio = adapter->dcb_cfg.tc_config[tc].path[1].prio_type; |
| *bwg_id = adapter->dcb_cfg.tc_config[tc].path[1].bwg_id; |
| *bw_pct = adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent; |
| *up_map = adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap; |
| } |
| |
| static void ixgbe_dcbnl_get_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, |
| u8 *bw_pct) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| *bw_pct = adapter->dcb_cfg.bw_percentage[1][bwg_id]; |
| } |
| |
| static void ixgbe_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, |
| u8 setting) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; |
| if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != |
| adapter->dcb_cfg.tc_config[priority].dcb_pfc) |
| adapter->dcb_set_bitmap |= BIT_PFC; |
| } |
| |
| static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, |
| u8 *setting) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| *setting = adapter->dcb_cfg.tc_config[priority].dcb_pfc; |
| } |
| |
| static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| int ret; |
| |
| adapter->dcb_set_bitmap &= ~BIT_BCN; /* no set for BCN */ |
| if (!adapter->dcb_set_bitmap) |
| return 1; |
| |
| while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) |
| msleep(1); |
| |
| if (netif_running(netdev)) |
| ixgbe_down(adapter); |
| |
| ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, |
| adapter->ring_feature[RING_F_DCB].indices); |
| if (ret) { |
| clear_bit(__IXGBE_RESETTING, &adapter->state); |
| return ret; |
| } |
| |
| if (netif_running(netdev)) |
| ixgbe_up(adapter); |
| |
| adapter->dcb_set_bitmap = 0x00; |
| clear_bit(__IXGBE_RESETTING, &adapter->state); |
| return ret; |
| } |
| |
| static u8 ixgbe_dcbnl_getcap(struct net_device *netdev, int capid, u8 *cap) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| u8 rval = 0; |
| |
| if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
| switch (capid) { |
| case DCB_CAP_ATTR_PG: |
| *cap = true; |
| break; |
| case DCB_CAP_ATTR_PFC: |
| *cap = true; |
| break; |
| case DCB_CAP_ATTR_UP2TC: |
| *cap = false; |
| break; |
| case DCB_CAP_ATTR_PG_TCS: |
| *cap = 0x80; |
| break; |
| case DCB_CAP_ATTR_PFC_TCS: |
| *cap = 0x80; |
| break; |
| case DCB_CAP_ATTR_GSP: |
| *cap = true; |
| break; |
| case DCB_CAP_ATTR_BCN: |
| *cap = false; |
| break; |
| default: |
| rval = -EINVAL; |
| break; |
| } |
| } else { |
| rval = -EINVAL; |
| } |
| |
| return rval; |
| } |
| |
| static u8 ixgbe_dcbnl_getnumtcs(struct net_device *netdev, int tcid, u8 *num) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| u8 rval = 0; |
| |
| if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
| switch (tcid) { |
| case DCB_NUMTCS_ATTR_PG: |
| *num = MAX_TRAFFIC_CLASS; |
| break; |
| case DCB_NUMTCS_ATTR_PFC: |
| *num = MAX_TRAFFIC_CLASS; |
| break; |
| default: |
| rval = -EINVAL; |
| break; |
| } |
| } else { |
| rval = -EINVAL; |
| } |
| |
| return rval; |
| } |
| |
| static u8 ixgbe_dcbnl_setnumtcs(struct net_device *netdev, int tcid, u8 num) |
| { |
| return -EINVAL; |
| } |
| |
| static u8 ixgbe_dcbnl_getpfcstate(struct net_device *netdev) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| return !!(adapter->flags & IXGBE_FLAG_DCB_ENABLED); |
| } |
| |
| static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state) |
| { |
| return; |
| } |
| |
| static void ixgbe_dcbnl_getbcnrp(struct net_device *netdev, int priority, |
| u8 *setting) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| *setting = adapter->dcb_cfg.bcn.rp_admin_mode[priority]; |
| } |
| |
| |
| static void ixgbe_dcbnl_getbcncfg(struct net_device *netdev, int enum_index, |
| u32 *setting) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| switch (enum_index) { |
| case DCB_BCN_ATTR_BCNA_0: |
| *setting = adapter->dcb_cfg.bcn.bcna_option[0]; |
| break; |
| case DCB_BCN_ATTR_BCNA_1: |
| *setting = adapter->dcb_cfg.bcn.bcna_option[1]; |
| break; |
| case DCB_BCN_ATTR_ALPHA: |
| *setting = adapter->dcb_cfg.bcn.rp_alpha; |
| break; |
| case DCB_BCN_ATTR_BETA: |
| *setting = adapter->dcb_cfg.bcn.rp_beta; |
| break; |
| case DCB_BCN_ATTR_GD: |
| *setting = adapter->dcb_cfg.bcn.rp_gd; |
| break; |
| case DCB_BCN_ATTR_GI: |
| *setting = adapter->dcb_cfg.bcn.rp_gi; |
| break; |
| case DCB_BCN_ATTR_TMAX: |
| *setting = adapter->dcb_cfg.bcn.rp_tmax; |
| break; |
| case DCB_BCN_ATTR_TD: |
| *setting = adapter->dcb_cfg.bcn.rp_td; |
| break; |
| case DCB_BCN_ATTR_RMIN: |
| *setting = adapter->dcb_cfg.bcn.rp_rmin; |
| break; |
| case DCB_BCN_ATTR_W: |
| *setting = adapter->dcb_cfg.bcn.rp_w; |
| break; |
| case DCB_BCN_ATTR_RD: |
| *setting = adapter->dcb_cfg.bcn.rp_rd; |
| break; |
| case DCB_BCN_ATTR_RU: |
| *setting = adapter->dcb_cfg.bcn.rp_ru; |
| break; |
| case DCB_BCN_ATTR_WRTT: |
| *setting = adapter->dcb_cfg.bcn.rp_wrtt; |
| break; |
| case DCB_BCN_ATTR_RI: |
| *setting = adapter->dcb_cfg.bcn.rp_ri; |
| break; |
| default: |
| *setting = -1; |
| } |
| } |
| |
| static void ixgbe_dcbnl_setbcnrp(struct net_device *netdev, int priority, |
| u8 setting) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| adapter->temp_dcb_cfg.bcn.rp_admin_mode[priority] = setting; |
| |
| if (adapter->temp_dcb_cfg.bcn.rp_admin_mode[priority] != |
| adapter->dcb_cfg.bcn.rp_admin_mode[priority]) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| } |
| |
| static void ixgbe_dcbnl_setbcncfg(struct net_device *netdev, int enum_index, |
| u32 setting) |
| { |
| struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| |
| switch (enum_index) { |
| case DCB_BCN_ATTR_BCNA_0: |
| adapter->temp_dcb_cfg.bcn.bcna_option[0] = setting; |
| if (adapter->temp_dcb_cfg.bcn.bcna_option[0] != |
| adapter->dcb_cfg.bcn.bcna_option[0]) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_BCNA_1: |
| adapter->temp_dcb_cfg.bcn.bcna_option[1] = setting; |
| if (adapter->temp_dcb_cfg.bcn.bcna_option[1] != |
| adapter->dcb_cfg.bcn.bcna_option[1]) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_ALPHA: |
| adapter->temp_dcb_cfg.bcn.rp_alpha = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_alpha != |
| adapter->dcb_cfg.bcn.rp_alpha) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_BETA: |
| adapter->temp_dcb_cfg.bcn.rp_beta = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_beta != |
| adapter->dcb_cfg.bcn.rp_beta) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_GD: |
| adapter->temp_dcb_cfg.bcn.rp_gd = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_gd != |
| adapter->dcb_cfg.bcn.rp_gd) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_GI: |
| adapter->temp_dcb_cfg.bcn.rp_gi = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_gi != |
| adapter->dcb_cfg.bcn.rp_gi) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_TMAX: |
| adapter->temp_dcb_cfg.bcn.rp_tmax = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_tmax != |
| adapter->dcb_cfg.bcn.rp_tmax) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_TD: |
| adapter->temp_dcb_cfg.bcn.rp_td = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_td != |
| adapter->dcb_cfg.bcn.rp_td) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_RMIN: |
| adapter->temp_dcb_cfg.bcn.rp_rmin = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_rmin != |
| adapter->dcb_cfg.bcn.rp_rmin) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_W: |
| adapter->temp_dcb_cfg.bcn.rp_w = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_w != |
| adapter->dcb_cfg.bcn.rp_w) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_RD: |
| adapter->temp_dcb_cfg.bcn.rp_rd = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_rd != |
| adapter->dcb_cfg.bcn.rp_rd) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_RU: |
| adapter->temp_dcb_cfg.bcn.rp_ru = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_ru != |
| adapter->dcb_cfg.bcn.rp_ru) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_WRTT: |
| adapter->temp_dcb_cfg.bcn.rp_wrtt = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_wrtt != |
| adapter->dcb_cfg.bcn.rp_wrtt) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| case DCB_BCN_ATTR_RI: |
| adapter->temp_dcb_cfg.bcn.rp_ri = setting; |
| if (adapter->temp_dcb_cfg.bcn.rp_ri != |
| adapter->dcb_cfg.bcn.rp_ri) |
| adapter->dcb_set_bitmap |= BIT_BCN; |
| break; |
| default: |
| break; |
| } |
| } |
| |
| struct dcbnl_rtnl_ops dcbnl_ops = { |
| .getstate = ixgbe_dcbnl_get_state, |
| .setstate = ixgbe_dcbnl_set_state, |
| .getpermhwaddr = ixgbe_dcbnl_get_perm_hw_addr, |
| .setpgtccfgtx = ixgbe_dcbnl_set_pg_tc_cfg_tx, |
| .setpgbwgcfgtx = ixgbe_dcbnl_set_pg_bwg_cfg_tx, |
| .setpgtccfgrx = ixgbe_dcbnl_set_pg_tc_cfg_rx, |
| .setpgbwgcfgrx = ixgbe_dcbnl_set_pg_bwg_cfg_rx, |
| .getpgtccfgtx = ixgbe_dcbnl_get_pg_tc_cfg_tx, |
| .getpgbwgcfgtx = ixgbe_dcbnl_get_pg_bwg_cfg_tx, |
| .getpgtccfgrx = ixgbe_dcbnl_get_pg_tc_cfg_rx, |
| .getpgbwgcfgrx = ixgbe_dcbnl_get_pg_bwg_cfg_rx, |
| .setpfccfg = ixgbe_dcbnl_set_pfc_cfg, |
| .getpfccfg = ixgbe_dcbnl_get_pfc_cfg, |
| .setall = ixgbe_dcbnl_set_all, |
| .getcap = ixgbe_dcbnl_getcap, |
| .getnumtcs = ixgbe_dcbnl_getnumtcs, |
| .setnumtcs = ixgbe_dcbnl_setnumtcs, |
| .getpfcstate = ixgbe_dcbnl_getpfcstate, |
| .setpfcstate = ixgbe_dcbnl_setpfcstate, |
| .getbcncfg = ixgbe_dcbnl_getbcncfg, |
| .getbcnrp = ixgbe_dcbnl_getbcnrp, |
| .setbcncfg = ixgbe_dcbnl_setbcncfg, |
| .setbcnrp = ixgbe_dcbnl_setbcnrp |
| }; |
| |