aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe
diff options
context:
space:
mode:
authorYi Zou <yi.zou@intel.com>2009-12-03 06:32:22 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-03 18:43:20 -0500
commit61a0f421ceccd52d0d893daf743b04c225ba5ef0 (patch)
tree5837bb8dd5e668c5aeac70a26331b9445d1dc34f /drivers/net/ixgbe
parent69ee472f2706371ca639de49b06df91615c07d8d (diff)
ixgbe: use known user priority for FCoE when DCB is enabled
Store the user priority for FCoE and use it directly for outgoing FCoE traffic when DCB is enabled. 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')
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.c30
-rw-r--r--drivers/net/ixgbe/ixgbe_fcoe.h3
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c8
3 files changed, 28 insertions, 13 deletions
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.c b/drivers/net/ixgbe/ixgbe_fcoe.c
index edecdc853c1..da32a108a7b 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ixgbe/ixgbe_fcoe.c
@@ -499,6 +499,10 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)
499 struct ixgbe_hw *hw = &adapter->hw; 499 struct ixgbe_hw *hw = &adapter->hw;
500 struct ixgbe_fcoe *fcoe = &adapter->fcoe; 500 struct ixgbe_fcoe *fcoe = &adapter->fcoe;
501 struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_FCOE]; 501 struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_FCOE];
502#ifdef CONFIG_IXGBE_DCB
503 u8 tc;
504 u32 up2tc;
505#endif
502 506
503 /* create the pool for ddp if not created yet */ 507 /* create the pool for ddp if not created yet */
504 if (!fcoe->pool) { 508 if (!fcoe->pool) {
@@ -540,6 +544,17 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)
540 IXGBE_FCRXCTRL_FCOELLI | 544 IXGBE_FCRXCTRL_FCOELLI |
541 IXGBE_FCRXCTRL_FCCRCBO | 545 IXGBE_FCRXCTRL_FCCRCBO |
542 (FC_FCOE_VER << IXGBE_FCRXCTRL_FCOEVER_SHIFT)); 546 (FC_FCOE_VER << IXGBE_FCRXCTRL_FCOEVER_SHIFT));
547#ifdef CONFIG_IXGBE_DCB
548 up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
549 for (i = 0; i < MAX_USER_PRIORITY; i++) {
550 tc = (u8)(up2tc >> (i * IXGBE_RTTUP2TC_UP_SHIFT));
551 tc &= (MAX_TRAFFIC_CLASS - 1);
552 if (fcoe->tc == tc) {
553 fcoe->up = i;
554 break;
555 }
556 }
557#endif
543} 558}
544 559
545/** 560/**
@@ -671,19 +686,7 @@ out_disable:
671 */ 686 */
672u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter) 687u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter)
673{ 688{
674 int i; 689 return 1 << adapter->fcoe.up;
675 u8 tc;
676 u32 up2tc;
677
678 up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
679 for (i = 0; i < MAX_USER_PRIORITY; i++) {
680 tc = (u8)(up2tc >> (i * IXGBE_RTTUP2TC_UP_SHIFT));
681 tc &= (MAX_TRAFFIC_CLASS - 1);
682 if (adapter->fcoe.tc == tc)
683 return 1 << i;
684 }
685
686 return 0;
687} 690}
688 691
689/** 692/**
@@ -710,6 +713,7 @@ u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up)
710 up2tc >>= (i * IXGBE_RTTUP2TC_UP_SHIFT); 713 up2tc >>= (i * IXGBE_RTTUP2TC_UP_SHIFT);
711 up2tc &= (MAX_TRAFFIC_CLASS - 1); 714 up2tc &= (MAX_TRAFFIC_CLASS - 1);
712 adapter->fcoe.tc = (u8)up2tc; 715 adapter->fcoe.tc = (u8)up2tc;
716 adapter->fcoe.up = i;
713 return 0; 717 return 0;
714 } 718 }
715 } 719 }
diff --git a/drivers/net/ixgbe/ixgbe_fcoe.h b/drivers/net/ixgbe/ixgbe_fcoe.h
index b5dee7b3ef1..de8ff53187d 100644
--- a/drivers/net/ixgbe/ixgbe_fcoe.h
+++ b/drivers/net/ixgbe/ixgbe_fcoe.h
@@ -62,7 +62,10 @@ struct ixgbe_fcoe_ddp {
62}; 62};
63 63
64struct ixgbe_fcoe { 64struct ixgbe_fcoe {
65#ifdef CONFIG_IXGBE_DCB
65 u8 tc; 66 u8 tc;
67 u8 up;
68#endif
66 spinlock_t lock; 69 spinlock_t lock;
67 struct pci_pool *pool; 70 struct pci_pool *pool;
68 struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; 71 struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX];
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 9ba506f6ef2..09990ed105f 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -3958,8 +3958,10 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
3958 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE; 3958 adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
3959 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; 3959 adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
3960 adapter->ring_feature[RING_F_FCOE].indices = 0; 3960 adapter->ring_feature[RING_F_FCOE].indices = 0;
3961#ifdef CONFIG_IXGBE_DCB
3961 /* Default traffic class to use for FCoE */ 3962 /* Default traffic class to use for FCoE */
3962 adapter->fcoe.tc = IXGBE_FCOE_DEFTC; 3963 adapter->fcoe.tc = IXGBE_FCOE_DEFTC;
3964#endif
3963#endif /* IXGBE_FCOE */ 3965#endif /* IXGBE_FCOE */
3964 } 3966 }
3965 3967
@@ -5332,6 +5334,12 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
5332 (skb->protocol == htons(ETH_P_FCOE))) { 5334 (skb->protocol == htons(ETH_P_FCOE))) {
5333 tx_flags |= IXGBE_TX_FLAGS_FCOE; 5335 tx_flags |= IXGBE_TX_FLAGS_FCOE;
5334#ifdef IXGBE_FCOE 5336#ifdef IXGBE_FCOE
5337#ifdef CONFIG_IXGBE_DCB
5338 tx_flags &= ~(IXGBE_TX_FLAGS_VLAN_PRIO_MASK
5339 << IXGBE_TX_FLAGS_VLAN_SHIFT);
5340 tx_flags |= ((adapter->fcoe.up << 13)
5341 << IXGBE_TX_FLAGS_VLAN_SHIFT);
5342#endif
5335 r_idx = smp_processor_id(); 5343 r_idx = smp_processor_id();
5336 r_idx &= (adapter->ring_feature[RING_F_FCOE].indices - 1); 5344 r_idx &= (adapter->ring_feature[RING_F_FCOE].indices - 1);
5337 r_idx += adapter->ring_feature[RING_F_FCOE].mask; 5345 r_idx += adapter->ring_feature[RING_F_FCOE].mask;