diff options
author | Yi Zou <yi.zou@intel.com> | 2009-08-31 08:34:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-01 04:24:40 -0400 |
commit | 6ee1652051f14d1c110f48a5b3ee037d63d0c2fa (patch) | |
tree | 2abd6fcb4eddfb093f5d46a0faa9e601e38f6cb7 /drivers/net/ixgbe/ixgbe_fcoe.c | |
parent | 579496865cf4ea429146382d62047ffdbaab0dee (diff) |
ixgbe: Add support for dcbnl_rtnl_ops.setapp/getapp
Add support for dcbnl_rtnl_ops.setapp/getapp to set or get the current user
priority bitmap for the given application protocol. Currently, 82599 only
supports setapp/getapp for Fiber Channel over Ethernet (FCoE) protocol.
Signed-off-by: Yi Zou <yi.zou@intel.com>
Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_fcoe.c')
-rw-r--r-- | drivers/net/ixgbe/ixgbe_fcoe.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c index 26fe46fb13fb..0607cffbb213 100644 --- a/drivers/net/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ixgbe/ixgbe_fcoe.c | |||
@@ -27,6 +27,9 @@ | |||
27 | 27 | ||
28 | 28 | ||
29 | #include "ixgbe.h" | 29 | #include "ixgbe.h" |
30 | #ifdef CONFIG_IXGBE_DCB | ||
31 | #include "ixgbe_dcb_82599.h" | ||
32 | #endif /* CONFIG_IXGBE_DCB */ | ||
30 | #include <linux/if_ether.h> | 33 | #include <linux/if_ether.h> |
31 | #include <scsi/scsi_cmnd.h> | 34 | #include <scsi/scsi_cmnd.h> |
32 | #include <scsi/scsi_device.h> | 35 | #include <scsi/scsi_device.h> |
@@ -648,3 +651,64 @@ int ixgbe_fcoe_disable(struct net_device *netdev) | |||
648 | out_disable: | 651 | out_disable: |
649 | return rc; | 652 | return rc; |
650 | } | 653 | } |
654 | |||
655 | #ifdef CONFIG_IXGBE_DCB | ||
656 | /** | ||
657 | * ixgbe_fcoe_getapp - retrieves current user priority bitmap for FCoE | ||
658 | * @adapter : ixgbe adapter | ||
659 | * | ||
660 | * Finds out the corresponding user priority bitmap from the current | ||
661 | * traffic class that FCoE belongs to. Returns 0 as the invalid user | ||
662 | * priority bitmap to indicate an error. | ||
663 | * | ||
664 | * Returns : 802.1p user priority bitmap for FCoE | ||
665 | */ | ||
666 | u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter) | ||
667 | { | ||
668 | int i; | ||
669 | u8 tc; | ||
670 | u32 up2tc; | ||
671 | |||
672 | up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC); | ||
673 | for (i = 0; i < MAX_USER_PRIORITY; i++) { | ||
674 | tc = (u8)(up2tc >> (i * IXGBE_RTTUP2TC_UP_SHIFT)); | ||
675 | tc &= (MAX_TRAFFIC_CLASS - 1); | ||
676 | if (adapter->fcoe.tc == tc) | ||
677 | return 1 << i; | ||
678 | } | ||
679 | |||
680 | return 0; | ||
681 | } | ||
682 | |||
683 | /** | ||
684 | * ixgbe_fcoe_setapp - sets the user priority bitmap for FCoE | ||
685 | * @adapter : ixgbe adapter | ||
686 | * @up : 802.1p user priority bitmap | ||
687 | * | ||
688 | * Finds out the traffic class from the input user priority | ||
689 | * bitmap for FCoE. | ||
690 | * | ||
691 | * Returns : 0 on success otherwise returns 1 on error | ||
692 | */ | ||
693 | u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up) | ||
694 | { | ||
695 | int i; | ||
696 | u32 up2tc; | ||
697 | |||
698 | /* valid user priority bitmap must not be 0 */ | ||
699 | if (up) { | ||
700 | /* from user priority to the corresponding traffic class */ | ||
701 | up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC); | ||
702 | for (i = 0; i < MAX_USER_PRIORITY; i++) { | ||
703 | if (up & (1 << i)) { | ||
704 | up2tc >>= (i * IXGBE_RTTUP2TC_UP_SHIFT); | ||
705 | up2tc &= (MAX_TRAFFIC_CLASS - 1); | ||
706 | adapter->fcoe.tc = (u8)up2tc; | ||
707 | return 0; | ||
708 | } | ||
709 | } | ||
710 | } | ||
711 | |||
712 | return 1; | ||
713 | } | ||
714 | #endif /* CONFIG_IXGBE_DCB */ | ||