aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_dcb_nl.c
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2008-11-21 00:10:23 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-21 00:10:23 -0500
commit859ee3c43812051e21816c6d6d4cc04fb7ce9b2e (patch)
treeef3c3717038b5d4600065550f422fd8abf72de35 /drivers/net/ixgbe/ixgbe_dcb_nl.c
parent0eb3aa9bab20217fb42244ccdcb5bf8a002f504c (diff)
DCB: Add support for DCB BCN
Adds an interface to configure the Backward Congestion Notification (BCN) feature. In a BCN capabale network, congestion notifications from congested points out in the network can cause the end station limit the rate of a given traffic flow. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_dcb_nl.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_nl.c176
1 files changed, 175 insertions, 1 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index dd940a8f9357..615c2803202a 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -34,6 +34,7 @@
34#define BIT_PFC 0x02 34#define BIT_PFC 0x02
35#define BIT_PG_RX 0x04 35#define BIT_PG_RX 0x04
36#define BIT_PG_TX 0x08 36#define BIT_PG_TX 0x08
37#define BIT_BCN 0x10
37 38
38int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, 39int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg,
39 struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) 40 struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max)
@@ -88,6 +89,23 @@ int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg,
88 src_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc; 89 src_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc;
89 } 90 }
90 91
92 for (i = DCB_BCN_ATTR_RP_0; i < DCB_BCN_ATTR_RP_ALL; i++) {
93 dst_dcb_cfg->bcn.rp_admin_mode[i - DCB_BCN_ATTR_RP_0] =
94 src_dcb_cfg->bcn.rp_admin_mode[i - DCB_BCN_ATTR_RP_0];
95 }
96 dst_dcb_cfg->bcn.rp_alpha = src_dcb_cfg->bcn.rp_alpha;
97 dst_dcb_cfg->bcn.rp_beta = src_dcb_cfg->bcn.rp_beta;
98 dst_dcb_cfg->bcn.rp_gd = src_dcb_cfg->bcn.rp_gd;
99 dst_dcb_cfg->bcn.rp_gi = src_dcb_cfg->bcn.rp_gi;
100 dst_dcb_cfg->bcn.rp_tmax = src_dcb_cfg->bcn.rp_tmax;
101 dst_dcb_cfg->bcn.rp_td = src_dcb_cfg->bcn.rp_td;
102 dst_dcb_cfg->bcn.rp_rmin = src_dcb_cfg->bcn.rp_rmin;
103 dst_dcb_cfg->bcn.rp_w = src_dcb_cfg->bcn.rp_w;
104 dst_dcb_cfg->bcn.rp_rd = src_dcb_cfg->bcn.rp_rd;
105 dst_dcb_cfg->bcn.rp_ru = src_dcb_cfg->bcn.rp_ru;
106 dst_dcb_cfg->bcn.rp_wrtt = src_dcb_cfg->bcn.rp_wrtt;
107 dst_dcb_cfg->bcn.rp_ri = src_dcb_cfg->bcn.rp_ri;
108
91 return 0; 109 return 0;
92} 110}
93 111
@@ -313,6 +331,7 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
313 struct ixgbe_adapter *adapter = netdev_priv(netdev); 331 struct ixgbe_adapter *adapter = netdev_priv(netdev);
314 int ret; 332 int ret;
315 333
334 adapter->dcb_set_bitmap &= ~BIT_BCN; /* no set for BCN */
316 if (!adapter->dcb_set_bitmap) 335 if (!adapter->dcb_set_bitmap)
317 return 1; 336 return 1;
318 337
@@ -417,6 +436,157 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state)
417 return; 436 return;
418} 437}
419 438
439static void ixgbe_dcbnl_getbcnrp(struct net_device *netdev, int priority,
440 u8 *setting)
441{
442 struct ixgbe_adapter *adapter = netdev_priv(netdev);
443
444 *setting = adapter->dcb_cfg.bcn.rp_admin_mode[priority];
445}
446
447
448static void ixgbe_dcbnl_getbcncfg(struct net_device *netdev, int enum_index,
449 u32 *setting)
450{
451 struct ixgbe_adapter *adapter = netdev_priv(netdev);
452
453 switch (enum_index) {
454 case DCB_BCN_ATTR_ALPHA:
455 *setting = adapter->dcb_cfg.bcn.rp_alpha;
456 break;
457 case DCB_BCN_ATTR_BETA:
458 *setting = adapter->dcb_cfg.bcn.rp_beta;
459 break;
460 case DCB_BCN_ATTR_GD:
461 *setting = adapter->dcb_cfg.bcn.rp_gd;
462 break;
463 case DCB_BCN_ATTR_GI:
464 *setting = adapter->dcb_cfg.bcn.rp_gi;
465 break;
466 case DCB_BCN_ATTR_TMAX:
467 *setting = adapter->dcb_cfg.bcn.rp_tmax;
468 break;
469 case DCB_BCN_ATTR_TD:
470 *setting = adapter->dcb_cfg.bcn.rp_td;
471 break;
472 case DCB_BCN_ATTR_RMIN:
473 *setting = adapter->dcb_cfg.bcn.rp_rmin;
474 break;
475 case DCB_BCN_ATTR_W:
476 *setting = adapter->dcb_cfg.bcn.rp_w;
477 break;
478 case DCB_BCN_ATTR_RD:
479 *setting = adapter->dcb_cfg.bcn.rp_rd;
480 break;
481 case DCB_BCN_ATTR_RU:
482 *setting = adapter->dcb_cfg.bcn.rp_ru;
483 break;
484 case DCB_BCN_ATTR_WRTT:
485 *setting = adapter->dcb_cfg.bcn.rp_wrtt;
486 break;
487 case DCB_BCN_ATTR_RI:
488 *setting = adapter->dcb_cfg.bcn.rp_ri;
489 break;
490 default:
491 *setting = -1;
492 }
493}
494
495static void ixgbe_dcbnl_setbcnrp(struct net_device *netdev, int priority,
496 u8 setting)
497{
498 struct ixgbe_adapter *adapter = netdev_priv(netdev);
499
500 adapter->temp_dcb_cfg.bcn.rp_admin_mode[priority] = setting;
501
502 if (adapter->temp_dcb_cfg.bcn.rp_admin_mode[priority] !=
503 adapter->dcb_cfg.bcn.rp_admin_mode[priority])
504 adapter->dcb_set_bitmap |= BIT_BCN;
505}
506
507static void ixgbe_dcbnl_setbcncfg(struct net_device *netdev, int enum_index,
508 u32 setting)
509{
510 struct ixgbe_adapter *adapter = netdev_priv(netdev);
511
512 switch (enum_index) {
513 case DCB_BCN_ATTR_ALPHA:
514 adapter->temp_dcb_cfg.bcn.rp_alpha = setting;
515 if (adapter->temp_dcb_cfg.bcn.rp_alpha !=
516 adapter->dcb_cfg.bcn.rp_alpha)
517 adapter->dcb_set_bitmap |= BIT_BCN;
518 break;
519 case DCB_BCN_ATTR_BETA:
520 adapter->temp_dcb_cfg.bcn.rp_beta = setting;
521 if (adapter->temp_dcb_cfg.bcn.rp_beta !=
522 adapter->dcb_cfg.bcn.rp_beta)
523 adapter->dcb_set_bitmap |= BIT_BCN;
524 break;
525 case DCB_BCN_ATTR_GD:
526 adapter->temp_dcb_cfg.bcn.rp_gd = setting;
527 if (adapter->temp_dcb_cfg.bcn.rp_gd !=
528 adapter->dcb_cfg.bcn.rp_gd)
529 adapter->dcb_set_bitmap |= BIT_BCN;
530 break;
531 case DCB_BCN_ATTR_GI:
532 adapter->temp_dcb_cfg.bcn.rp_gi = setting;
533 if (adapter->temp_dcb_cfg.bcn.rp_gi !=
534 adapter->dcb_cfg.bcn.rp_gi)
535 adapter->dcb_set_bitmap |= BIT_BCN;
536 break;
537 case DCB_BCN_ATTR_TMAX:
538 adapter->temp_dcb_cfg.bcn.rp_tmax = setting;
539 if (adapter->temp_dcb_cfg.bcn.rp_tmax !=
540 adapter->dcb_cfg.bcn.rp_tmax)
541 adapter->dcb_set_bitmap |= BIT_BCN;
542 break;
543 case DCB_BCN_ATTR_TD:
544 adapter->temp_dcb_cfg.bcn.rp_td = setting;
545 if (adapter->temp_dcb_cfg.bcn.rp_td !=
546 adapter->dcb_cfg.bcn.rp_td)
547 adapter->dcb_set_bitmap |= BIT_BCN;
548 break;
549 case DCB_BCN_ATTR_RMIN:
550 adapter->temp_dcb_cfg.bcn.rp_rmin = setting;
551 if (adapter->temp_dcb_cfg.bcn.rp_rmin !=
552 adapter->dcb_cfg.bcn.rp_rmin)
553 adapter->dcb_set_bitmap |= BIT_BCN;
554 break;
555 case DCB_BCN_ATTR_W:
556 adapter->temp_dcb_cfg.bcn.rp_w = setting;
557 if (adapter->temp_dcb_cfg.bcn.rp_w !=
558 adapter->dcb_cfg.bcn.rp_w)
559 adapter->dcb_set_bitmap |= BIT_BCN;
560 break;
561 case DCB_BCN_ATTR_RD:
562 adapter->temp_dcb_cfg.bcn.rp_rd = setting;
563 if (adapter->temp_dcb_cfg.bcn.rp_rd !=
564 adapter->dcb_cfg.bcn.rp_rd)
565 adapter->dcb_set_bitmap |= BIT_BCN;
566 break;
567 case DCB_BCN_ATTR_RU:
568 adapter->temp_dcb_cfg.bcn.rp_ru = setting;
569 if (adapter->temp_dcb_cfg.bcn.rp_ru !=
570 adapter->dcb_cfg.bcn.rp_ru)
571 adapter->dcb_set_bitmap |= BIT_BCN;
572 break;
573 case DCB_BCN_ATTR_WRTT:
574 adapter->temp_dcb_cfg.bcn.rp_wrtt = setting;
575 if (adapter->temp_dcb_cfg.bcn.rp_wrtt !=
576 adapter->dcb_cfg.bcn.rp_wrtt)
577 adapter->dcb_set_bitmap |= BIT_BCN;
578 break;
579 case DCB_BCN_ATTR_RI:
580 adapter->temp_dcb_cfg.bcn.rp_ri = setting;
581 if (adapter->temp_dcb_cfg.bcn.rp_ri !=
582 adapter->dcb_cfg.bcn.rp_ri)
583 adapter->dcb_set_bitmap |= BIT_BCN;
584 break;
585 default:
586 break;
587 }
588}
589
420struct dcbnl_rtnl_ops dcbnl_ops = { 590struct dcbnl_rtnl_ops dcbnl_ops = {
421 .getstate = ixgbe_dcbnl_get_state, 591 .getstate = ixgbe_dcbnl_get_state,
422 .setstate = ixgbe_dcbnl_set_state, 592 .setstate = ixgbe_dcbnl_set_state,
@@ -436,6 +606,10 @@ struct dcbnl_rtnl_ops dcbnl_ops = {
436 .getnumtcs = ixgbe_dcbnl_getnumtcs, 606 .getnumtcs = ixgbe_dcbnl_getnumtcs,
437 .setnumtcs = ixgbe_dcbnl_setnumtcs, 607 .setnumtcs = ixgbe_dcbnl_setnumtcs,
438 .getpfcstate = ixgbe_dcbnl_getpfcstate, 608 .getpfcstate = ixgbe_dcbnl_getpfcstate,
439 .setpfcstate = ixgbe_dcbnl_setpfcstate 609 .setpfcstate = ixgbe_dcbnl_setpfcstate,
610 .getbcncfg = ixgbe_dcbnl_getbcncfg,
611 .getbcnrp = ixgbe_dcbnl_getbcnrp,
612 .setbcncfg = ixgbe_dcbnl_setbcncfg,
613 .setbcnrp = ixgbe_dcbnl_setbcnrp
440}; 614};
441 615