aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohn Fastabend <john.r.fastabend@intel.com>2011-03-11 22:50:53 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2011-04-13 22:19:47 -0400
commitc8ca76ebc6e50752c5311b92bb9aef7edb324577 (patch)
treed79f9ceadbd6e7f2079ceef72123750ba8ab8b23 /drivers/net
parent78cd29d5a92ae5067377ad42089f2c8781312f4a (diff)
ixgbe: DCB, further cleanups to app configuration
With the app data on the kernel dcb_app list we no longer need to specifically handle them in ixgbe for the CEE case. So now we can remove app handling logic and check when the hw is configured if the app data matches the hardware configuration in set_hw_all(). If it does not match then we can reconfigure. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Tested-by: Ross Brattain <ross.b.brattain@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ixgbe/ixgbe_dcb_nl.c107
1 files changed, 24 insertions, 83 deletions
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c
index 327c8614198c..7b59f64a13d4 100644
--- a/drivers/net/ixgbe/ixgbe_dcb_nl.c
+++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c
@@ -347,18 +347,28 @@ static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority,
347static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) 347static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
348{ 348{
349 struct ixgbe_adapter *adapter = netdev_priv(netdev); 349 struct ixgbe_adapter *adapter = netdev_priv(netdev);
350 struct dcb_app app = {
351 .selector = DCB_APP_IDTYPE_ETHTYPE,
352 .protocol = ETH_P_FCOE,
353 };
354 u8 up = dcb_getapp(netdev, &app);
350 int ret; 355 int ret;
351 356
352 if (!adapter->dcb_set_bitmap ||
353 !(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
354 return DCB_NO_HW_CHG;
355
356 ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, 357 ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
357 MAX_TRAFFIC_CLASS); 358 MAX_TRAFFIC_CLASS);
358
359 if (ret) 359 if (ret)
360 return DCB_NO_HW_CHG; 360 return DCB_NO_HW_CHG;
361 361
362 /* In IEEE mode app data must be parsed into DCBX format for
363 * hardware routines.
364 */
365 if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)
366 up = (1 << up);
367
368#ifdef IXGBE_FCOE
369 if (up && (up != (1 << adapter->fcoe.up)))
370 adapter->dcb_set_bitmap |= BIT_APP_UPCHG;
371
362 /* 372 /*
363 * Only take down the adapter if an app change occurred. FCoE 373 * Only take down the adapter if an app change occurred. FCoE
364 * may shuffle tx rings in this case and this can not be done 374 * may shuffle tx rings in this case and this can not be done
@@ -368,10 +378,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
368 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state)) 378 while (test_and_set_bit(__IXGBE_RESETTING, &adapter->state))
369 msleep(1); 379 msleep(1);
370 380
381 ixgbe_fcoe_setapp(adapter, up);
382
371 if (netif_running(netdev)) 383 if (netif_running(netdev))
372 netdev->netdev_ops->ndo_stop(netdev); 384 netdev->netdev_ops->ndo_stop(netdev);
373 ixgbe_clear_interrupt_scheme(adapter); 385 ixgbe_clear_interrupt_scheme(adapter);
374 } 386 }
387#endif
375 388
376 if (adapter->dcb_cfg.pfc_mode_enable) { 389 if (adapter->dcb_cfg.pfc_mode_enable) {
377 switch (adapter->hw.mac.type) { 390 switch (adapter->hw.mac.type) {
@@ -399,12 +412,14 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
399 } 412 }
400 } 413 }
401 414
415#ifdef IXGBE_FCOE
402 if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) { 416 if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
403 ixgbe_init_interrupt_scheme(adapter); 417 ixgbe_init_interrupt_scheme(adapter);
404 if (netif_running(netdev)) 418 if (netif_running(netdev))
405 netdev->netdev_ops->ndo_open(netdev); 419 netdev->netdev_ops->ndo_open(netdev);
406 ret = DCB_HW_CHG_RST; 420 ret = DCB_HW_CHG_RST;
407 } 421 }
422#endif
408 423
409 if (adapter->dcb_set_bitmap & BIT_PFC) { 424 if (adapter->dcb_set_bitmap & BIT_PFC) {
410 u8 pfc_en; 425 u8 pfc_en;
@@ -558,68 +573,6 @@ static u8 ixgbe_dcbnl_getapp(struct net_device *netdev, u8 idtype, u16 id)
558 return dcb_getapp(netdev, &app); 573 return dcb_getapp(netdev, &app);
559} 574}
560 575
561/**
562 * ixgbe_dcbnl_setapp - set the DCBX application user priority
563 * @netdev : the corresponding netdev
564 * @idtype : identifies the id as ether type or TCP/UDP port number
565 * @id: id is either ether type or TCP/UDP port number
566 * @up: the 802.1p user priority bitmap
567 *
568 * Returns : 0 on success or 1 on error
569 */
570static u8 ixgbe_dcbnl_setapp(struct net_device *netdev,
571 u8 idtype, u16 id, u8 up)
572{
573 struct ixgbe_adapter *adapter = netdev_priv(netdev);
574 u8 rval = 1;
575 struct dcb_app app = {
576 .selector = idtype,
577 .protocol = id,
578 .priority = up
579 };
580
581 if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
582 return rval;
583
584 rval = dcb_setapp(netdev, &app);
585
586 switch (idtype) {
587 case DCB_APP_IDTYPE_ETHTYPE:
588#ifdef IXGBE_FCOE
589 if (id == ETH_P_FCOE) {
590 u8 old_tc;
591
592 /* Get current programmed tc */
593 old_tc = adapter->fcoe.tc;
594 rval = ixgbe_fcoe_setapp(adapter, up);
595
596 if (rval ||
597 !(adapter->flags & IXGBE_FLAG_DCB_ENABLED) ||
598 !(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
599 break;
600
601 /* The FCoE application priority may be changed multiple
602 * times in quick succession with switches that build up
603 * TLVs. To avoid creating uneeded device resets this
604 * checks the actual HW configuration and clears
605 * BIT_APP_UPCHG if a HW configuration change is not
606 * need
607 */
608 if (old_tc == adapter->fcoe.tc)
609 adapter->dcb_set_bitmap &= ~BIT_APP_UPCHG;
610 else
611 adapter->dcb_set_bitmap |= BIT_APP_UPCHG;
612 }
613#endif
614 break;
615 case DCB_APP_IDTYPE_PORTNUM:
616 break;
617 default:
618 break;
619 }
620 return rval;
621}
622
623static int ixgbe_dcbnl_ieee_getets(struct net_device *dev, 576static int ixgbe_dcbnl_ieee_getets(struct net_device *dev,
624 struct ieee_ets *ets) 577 struct ieee_ets *ets)
625{ 578{
@@ -745,25 +698,14 @@ static int ixgbe_dcbnl_ieee_setapp(struct net_device *dev,
745 698
746 if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE)) 699 if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))
747 return -EINVAL; 700 return -EINVAL;
748#ifdef IXGBE_FCOE
749 if (app->selector == 1 && app->protocol == ETH_P_FCOE) {
750 if (adapter->fcoe.tc == app->priority)
751 goto setapp;
752 701
753 /* In IEEE mode map up to tc 1:1 */ 702 dcb_setapp(dev, app);
754 adapter->fcoe.tc = app->priority;
755 adapter->fcoe.up = app->priority;
756 703
757 /* Force hardware reset required to push FCoE 704#ifdef IXGBE_FCOE
758 * setup on {tx|rx}_rings 705 if (app->selector == 1 && app->protocol == ETH_P_FCOE &&
759 */ 706 adapter->fcoe.tc == app->priority)
760 adapter->dcb_set_bitmap |= BIT_APP_UPCHG;
761 ixgbe_dcbnl_set_all(dev); 707 ixgbe_dcbnl_set_all(dev);
762 }
763
764setapp:
765#endif 708#endif
766 dcb_setapp(dev, app);
767 return 0; 709 return 0;
768} 710}
769 711
@@ -838,7 +780,6 @@ const struct dcbnl_rtnl_ops dcbnl_ops = {
838 .getpfcstate = ixgbe_dcbnl_getpfcstate, 780 .getpfcstate = ixgbe_dcbnl_getpfcstate,
839 .setpfcstate = ixgbe_dcbnl_setpfcstate, 781 .setpfcstate = ixgbe_dcbnl_setpfcstate,
840 .getapp = ixgbe_dcbnl_getapp, 782 .getapp = ixgbe_dcbnl_getapp,
841 .setapp = ixgbe_dcbnl_setapp,
842 .getdcbx = ixgbe_dcbnl_getdcbx, 783 .getdcbx = ixgbe_dcbnl_getdcbx,
843 .setdcbx = ixgbe_dcbnl_setdcbx, 784 .setdcbx = ixgbe_dcbnl_setdcbx,
844}; 785};