diff options
author | Vladislav Zolotarov <vladz@broadcom.com> | 2010-12-13 00:44:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-12-16 16:15:54 -0500 |
commit | 8307fa3e86a83924dd7f8310ce1e051f34986fe8 (patch) | |
tree | e3e018d2d9505db8c6586f1f03fb92fa6ec23f7f | |
parent | ec6ba945211b1c1f97d3d19fe60f166c9a92241d (diff) |
bnx2x: add a select queue callback
This callback required to allow FCoE traffic to be
sent on separate priority queue from other L2 traffic,
which is managed by PFC in HW.
Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Shmulik Ravid-Rabinovitz <shmulikr@broadcom.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 29 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.h | 3 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_main.c | 1 |
3 files changed, 33 insertions, 0 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index fa12365faec2..10eef5434386 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -1167,6 +1167,35 @@ void bnx2x_netif_stop(struct bnx2x *bp, int disable_hw) | |||
1167 | netif_tx_disable(bp->dev); | 1167 | netif_tx_disable(bp->dev); |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb) | ||
1171 | { | ||
1172 | #ifdef BCM_CNIC | ||
1173 | struct bnx2x *bp = netdev_priv(dev); | ||
1174 | if (NO_FCOE(bp)) | ||
1175 | return skb_tx_hash(dev, skb); | ||
1176 | else { | ||
1177 | struct ethhdr *hdr = (struct ethhdr *)skb->data; | ||
1178 | u16 ether_type = ntohs(hdr->h_proto); | ||
1179 | |||
1180 | /* Skip VLAN tag if present */ | ||
1181 | if (ether_type == ETH_P_8021Q) { | ||
1182 | struct vlan_ethhdr *vhdr = | ||
1183 | (struct vlan_ethhdr *)skb->data; | ||
1184 | |||
1185 | ether_type = ntohs(vhdr->h_vlan_encapsulated_proto); | ||
1186 | } | ||
1187 | |||
1188 | /* If ethertype is FCoE or FIP - use FCoE ring */ | ||
1189 | if ((ether_type == ETH_P_FCOE) || (ether_type == ETH_P_FIP)) | ||
1190 | return bnx2x_fcoe(bp, index); | ||
1191 | } | ||
1192 | #endif | ||
1193 | /* Select a none-FCoE queue: if FCoE is enabled, exclude FCoE L2 ring | ||
1194 | */ | ||
1195 | return __skb_tx_hash(dev, skb, | ||
1196 | dev->real_num_tx_queues - FCOE_CONTEXT_USE); | ||
1197 | } | ||
1198 | |||
1170 | void bnx2x_set_num_queues(struct bnx2x *bp) | 1199 | void bnx2x_set_num_queues(struct bnx2x *bp) |
1171 | { | 1200 | { |
1172 | switch (bp->multi_mode) { | 1201 | switch (bp->multi_mode) { |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h index 4bb011358ed9..258f0c04716b 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.h +++ b/drivers/net/bnx2x/bnx2x_cmn.h | |||
@@ -343,6 +343,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode); | |||
343 | /* hard_xmit callback */ | 343 | /* hard_xmit callback */ |
344 | netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev); | 344 | netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev); |
345 | 345 | ||
346 | /* select_queue callback */ | ||
347 | u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb); | ||
348 | |||
346 | int bnx2x_change_mac_addr(struct net_device *dev, void *p); | 349 | int bnx2x_change_mac_addr(struct net_device *dev, void *p); |
347 | 350 | ||
348 | /* NAPI poll Rx part */ | 351 | /* NAPI poll Rx part */ |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index e6e2746e8bfe..563b2cb8e544 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -8977,6 +8977,7 @@ static const struct net_device_ops bnx2x_netdev_ops = { | |||
8977 | .ndo_open = bnx2x_open, | 8977 | .ndo_open = bnx2x_open, |
8978 | .ndo_stop = bnx2x_close, | 8978 | .ndo_stop = bnx2x_close, |
8979 | .ndo_start_xmit = bnx2x_start_xmit, | 8979 | .ndo_start_xmit = bnx2x_start_xmit, |
8980 | .ndo_select_queue = bnx2x_select_queue, | ||
8980 | .ndo_set_multicast_list = bnx2x_set_rx_mode, | 8981 | .ndo_set_multicast_list = bnx2x_set_rx_mode, |
8981 | .ndo_set_mac_address = bnx2x_change_mac_addr, | 8982 | .ndo_set_mac_address = bnx2x_change_mac_addr, |
8982 | .ndo_validate_addr = eth_validate_addr, | 8983 | .ndo_validate_addr = eth_validate_addr, |