Commit 61a0f421 authored by Yi Zou's avatar Yi Zou Committed by David S. Miller

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: default avatarYi Zou <yi.zou@intel.com>
Acked-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 69ee472f
...@@ -499,6 +499,10 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) ...@@ -499,6 +499,10 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
struct ixgbe_fcoe *fcoe = &adapter->fcoe; struct ixgbe_fcoe *fcoe = &adapter->fcoe;
struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_FCOE]; struct ixgbe_ring_feature *f = &adapter->ring_feature[RING_F_FCOE];
#ifdef CONFIG_IXGBE_DCB
u8 tc;
u32 up2tc;
#endif
/* create the pool for ddp if not created yet */ /* create the pool for ddp if not created yet */
if (!fcoe->pool) { if (!fcoe->pool) {
...@@ -540,6 +544,17 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter) ...@@ -540,6 +544,17 @@ void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter)
IXGBE_FCRXCTRL_FCOELLI | IXGBE_FCRXCTRL_FCOELLI |
IXGBE_FCRXCTRL_FCCRCBO | IXGBE_FCRXCTRL_FCCRCBO |
(FC_FCOE_VER << IXGBE_FCRXCTRL_FCOEVER_SHIFT)); (FC_FCOE_VER << IXGBE_FCRXCTRL_FCOEVER_SHIFT));
#ifdef CONFIG_IXGBE_DCB
up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
for (i = 0; i < MAX_USER_PRIORITY; i++) {
tc = (u8)(up2tc >> (i * IXGBE_RTTUP2TC_UP_SHIFT));
tc &= (MAX_TRAFFIC_CLASS - 1);
if (fcoe->tc == tc) {
fcoe->up = i;
break;
}
}
#endif
} }
/** /**
...@@ -671,19 +686,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev) ...@@ -671,19 +686,7 @@ int ixgbe_fcoe_disable(struct net_device *netdev)
*/ */
u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter) u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter)
{ {
int i; return 1 << adapter->fcoe.up;
u8 tc;
u32 up2tc;
up2tc = IXGBE_READ_REG(&adapter->hw, IXGBE_RTTUP2TC);
for (i = 0; i < MAX_USER_PRIORITY; i++) {
tc = (u8)(up2tc >> (i * IXGBE_RTTUP2TC_UP_SHIFT));
tc &= (MAX_TRAFFIC_CLASS - 1);
if (adapter->fcoe.tc == tc)
return 1 << i;
}
return 0;
} }
/** /**
...@@ -710,6 +713,7 @@ u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up) ...@@ -710,6 +713,7 @@ u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up)
up2tc >>= (i * IXGBE_RTTUP2TC_UP_SHIFT); up2tc >>= (i * IXGBE_RTTUP2TC_UP_SHIFT);
up2tc &= (MAX_TRAFFIC_CLASS - 1); up2tc &= (MAX_TRAFFIC_CLASS - 1);
adapter->fcoe.tc = (u8)up2tc; adapter->fcoe.tc = (u8)up2tc;
adapter->fcoe.up = i;
return 0; return 0;
} }
} }
......
...@@ -62,7 +62,10 @@ struct ixgbe_fcoe_ddp { ...@@ -62,7 +62,10 @@ struct ixgbe_fcoe_ddp {
}; };
struct ixgbe_fcoe { struct ixgbe_fcoe {
#ifdef CONFIG_IXGBE_DCB
u8 tc; u8 tc;
u8 up;
#endif
spinlock_t lock; spinlock_t lock;
struct pci_pool *pool; struct pci_pool *pool;
struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX];
......
...@@ -3958,8 +3958,10 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) ...@@ -3958,8 +3958,10 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE; adapter->flags |= IXGBE_FLAG_FCOE_CAPABLE;
adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
adapter->ring_feature[RING_F_FCOE].indices = 0; adapter->ring_feature[RING_F_FCOE].indices = 0;
#ifdef CONFIG_IXGBE_DCB
/* Default traffic class to use for FCoE */ /* Default traffic class to use for FCoE */
adapter->fcoe.tc = IXGBE_FCOE_DEFTC; adapter->fcoe.tc = IXGBE_FCOE_DEFTC;
#endif
#endif /* IXGBE_FCOE */ #endif /* IXGBE_FCOE */
} }
...@@ -5332,6 +5334,12 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, ...@@ -5332,6 +5334,12 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
(skb->protocol == htons(ETH_P_FCOE))) { (skb->protocol == htons(ETH_P_FCOE))) {
tx_flags |= IXGBE_TX_FLAGS_FCOE; tx_flags |= IXGBE_TX_FLAGS_FCOE;
#ifdef IXGBE_FCOE #ifdef IXGBE_FCOE
#ifdef CONFIG_IXGBE_DCB
tx_flags &= ~(IXGBE_TX_FLAGS_VLAN_PRIO_MASK
<< IXGBE_TX_FLAGS_VLAN_SHIFT);
tx_flags |= ((adapter->fcoe.up << 13)
<< IXGBE_TX_FLAGS_VLAN_SHIFT);
#endif
r_idx = smp_processor_id(); r_idx = smp_processor_id();
r_idx &= (adapter->ring_feature[RING_F_FCOE].indices - 1); r_idx &= (adapter->ring_feature[RING_F_FCOE].indices - 1);
r_idx += adapter->ring_feature[RING_F_FCOE].mask; r_idx += adapter->ring_feature[RING_F_FCOE].mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment