35 #define BIT_DCB_MODE 0x01
37 #define BIT_PG_RX 0x04
38 #define BIT_PG_TX 0x08
39 #define BIT_APP_UPCHG 0x10
40 #define BIT_LINKSPEED 0x80
43 #define DCB_HW_CHG_RST 0
44 #define DCB_NO_HW_CHG 1
64 if (up && !(up & (1 << adapter->fcoe.up)))
72 if (dst->
path[tx].prio_type != src->
path[tx].prio_type) {
77 if (dst->
path[tx].bwg_id != src->
path[tx].bwg_id) {
82 if (dst->
path[tx].bwg_percent != src->
path[tx].bwg_percent) {
87 if (dst->
path[tx].up_to_tc_bitmap !=
88 src->
path[tx].up_to_tc_bitmap) {
89 dst->
path[
tx].up_to_tc_bitmap =
90 src->
path[
tx].up_to_tc_bitmap;
94 if (dst->
path[rx].prio_type != src->
path[rx].prio_type) {
99 if (dst->
path[rx].bwg_id != src->
path[rx].bwg_id) {
104 if (dst->
path[rx].bwg_percent != src->
path[rx].bwg_percent) {
109 if (dst->
path[rx].up_to_tc_bitmap !=
110 src->
path[rx].up_to_tc_bitmap) {
111 dst->
path[
rx].up_to_tc_bitmap =
112 src->
path[
rx].up_to_tc_bitmap;
145 static u8 ixgbe_dcbnl_get_state(
struct net_device *netdev)
165 err = ixgbe_setup_tc(netdev,
166 state ? adapter->
dcb_cfg.num_tcs.pg_tcs : 0);
171 static void ixgbe_dcbnl_get_perm_hw_addr(
struct net_device *netdev,
179 for (i = 0; i < netdev->
addr_len; i++)
180 perm_addr[i] = adapter->
hw.mac.perm_addr[i];
182 switch (adapter->
hw.mac.type) {
185 for (j = 0; j < netdev->
addr_len; j++, i++)
186 perm_addr[i] = adapter->
hw.mac.san_addr[j];
193 static void ixgbe_dcbnl_set_pg_tc_cfg_tx(
struct net_device *netdev,
int tc,
211 static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(
struct net_device *netdev,
int bwg_id,
216 adapter->
temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct;
219 static void ixgbe_dcbnl_set_pg_tc_cfg_rx(
struct net_device *netdev,
int tc,
220 u8 prio,
u8 bwg_id,
u8 bw_pct,
237 static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(
struct net_device *netdev,
int bwg_id,
242 adapter->
temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct;
245 static void ixgbe_dcbnl_get_pg_tc_cfg_tx(
struct net_device *netdev,
int tc,
246 u8 *prio,
u8 *bwg_id,
u8 *bw_pct,
251 *prio = adapter->
dcb_cfg.tc_config[
tc].path[0].prio_type;
252 *bwg_id = adapter->
dcb_cfg.tc_config[
tc].path[0].bwg_id;
253 *bw_pct = adapter->
dcb_cfg.tc_config[
tc].path[0].bwg_percent;
254 *up_map = adapter->
dcb_cfg.tc_config[
tc].path[0].up_to_tc_bitmap;
257 static void ixgbe_dcbnl_get_pg_bwg_cfg_tx(
struct net_device *netdev,
int bwg_id,
262 *bw_pct = adapter->
dcb_cfg.bw_percentage[0][bwg_id];
265 static void ixgbe_dcbnl_get_pg_tc_cfg_rx(
struct net_device *netdev,
int tc,
266 u8 *prio,
u8 *bwg_id,
u8 *bw_pct,
271 *prio = adapter->
dcb_cfg.tc_config[
tc].path[1].prio_type;
272 *bwg_id = adapter->
dcb_cfg.tc_config[
tc].path[1].bwg_id;
273 *bw_pct = adapter->
dcb_cfg.tc_config[
tc].path[1].bwg_percent;
274 *up_map = adapter->
dcb_cfg.tc_config[
tc].path[1].up_to_tc_bitmap;
277 static void ixgbe_dcbnl_get_pg_bwg_cfg_rx(
struct net_device *netdev,
int bwg_id,
282 *bw_pct = adapter->
dcb_cfg.bw_percentage[1][bwg_id];
291 if (adapter->
temp_dcb_cfg.tc_config[priority].dcb_pfc !=
292 adapter->
dcb_cfg.tc_config[priority].dcb_pfc)
296 static void ixgbe_dcbnl_get_pfc_cfg(
struct net_device *netdev,
int priority,
312 if (netif_running(dev))
318 if (netif_running(dev))
325 static u8 ixgbe_dcbnl_set_all(
struct net_device *netdev)
351 max_frame =
max(max_frame, IXGBE_FCOE_JUMBO_FRAME_SIZE);
369 netdev_set_prio_tc_map(netdev, i, prio_tc[i]);
383 hw->
mac.ops.fc_enable(hw);
386 ixgbe_set_rx_drop_en(adapter);
403 adapter->fcoe.up =
ffs(up) - 1;
404 ixgbe_dcbnl_devreset(netdev);
450 static int ixgbe_dcbnl_getnumtcs(
struct net_device *netdev,
int tcid,
u8 *num)
458 *num = adapter->
dcb_cfg.num_tcs.pg_tcs;
461 *num = adapter->
dcb_cfg.num_tcs.pfc_tcs;
474 static int ixgbe_dcbnl_setnumtcs(
struct net_device *netdev,
int tcid,
u8 num)
479 static u8 ixgbe_dcbnl_getpfcstate(
struct net_device *netdev)
483 return adapter->
dcb_cfg.pfc_mode_enable;
486 static void ixgbe_dcbnl_setpfcstate(
struct net_device *netdev,
u8 state)
517 static int ixgbe_dcbnl_ieee_getets(
struct net_device *dev,
537 static int ixgbe_dcbnl_ieee_setets(
struct net_device *dev,
565 if (max_tc > adapter->
dcb_cfg.num_tcs.pg_tcs)
568 if (max_tc != netdev_get_num_tc(dev))
569 err = ixgbe_setup_tc(dev, max_tc);
579 static int ixgbe_dcbnl_ieee_getpfc(
struct net_device *dev,
604 static int ixgbe_dcbnl_ieee_setpfc(
struct net_device *dev,
629 err = hw->
mac.ops.fc_enable(hw);
631 ixgbe_set_rx_drop_en(adapter);
636 static int ixgbe_dcbnl_ieee_setapp(
struct net_device *dev,
652 if (app_mask & (1 << adapter->fcoe.up))
656 ixgbe_dcbnl_devreset(dev);
662 static int ixgbe_dcbnl_ieee_delapp(
struct net_device *dev,
678 if (app_mask & (1 << adapter->fcoe.up))
681 adapter->fcoe.up = app_mask ?
683 ixgbe_dcbnl_devreset(dev);
717 if (mode & DCB_CAP_DCBX_VER_IEEE) {
718 ixgbe_dcbnl_ieee_setets(dev, &ets);
719 ixgbe_dcbnl_ieee_setpfc(dev, &pfc);
720 }
else if (mode & DCB_CAP_DCBX_VER_CEE) {
724 ixgbe_dcbnl_set_all(dev);
729 ixgbe_dcbnl_ieee_setets(dev, &ets);
730 ixgbe_dcbnl_ieee_setpfc(dev, &pfc);
731 err = ixgbe_setup_tc(dev, 0);
738 .ieee_getets = ixgbe_dcbnl_ieee_getets,
739 .ieee_setets = ixgbe_dcbnl_ieee_setets,
740 .ieee_getpfc = ixgbe_dcbnl_ieee_getpfc,
741 .ieee_setpfc = ixgbe_dcbnl_ieee_setpfc,
742 .ieee_setapp = ixgbe_dcbnl_ieee_setapp,
743 .ieee_delapp = ixgbe_dcbnl_ieee_delapp,
744 .getstate = ixgbe_dcbnl_get_state,
745 .setstate = ixgbe_dcbnl_set_state,
746 .getpermhwaddr = ixgbe_dcbnl_get_perm_hw_addr,
747 .setpgtccfgtx = ixgbe_dcbnl_set_pg_tc_cfg_tx,
748 .setpgbwgcfgtx = ixgbe_dcbnl_set_pg_bwg_cfg_tx,
749 .setpgtccfgrx = ixgbe_dcbnl_set_pg_tc_cfg_rx,
750 .setpgbwgcfgrx = ixgbe_dcbnl_set_pg_bwg_cfg_rx,
751 .getpgtccfgtx = ixgbe_dcbnl_get_pg_tc_cfg_tx,
752 .getpgbwgcfgtx = ixgbe_dcbnl_get_pg_bwg_cfg_tx,
753 .getpgtccfgrx = ixgbe_dcbnl_get_pg_tc_cfg_rx,
754 .getpgbwgcfgrx = ixgbe_dcbnl_get_pg_bwg_cfg_rx,
755 .setpfccfg = ixgbe_dcbnl_set_pfc_cfg,
756 .getpfccfg = ixgbe_dcbnl_get_pfc_cfg,
757 .setall = ixgbe_dcbnl_set_all,
758 .getcap = ixgbe_dcbnl_getcap,
759 .getnumtcs = ixgbe_dcbnl_getnumtcs,
760 .setnumtcs = ixgbe_dcbnl_setnumtcs,
761 .getpfcstate = ixgbe_dcbnl_getpfcstate,
762 .setpfcstate = ixgbe_dcbnl_setpfcstate,
763 .getapp = ixgbe_dcbnl_getapp,
764 .getdcbx = ixgbe_dcbnl_getdcbx,
765 .setdcbx = ixgbe_dcbnl_setdcbx,