bnx2x: handle iSCSI SD mode
PATCH 1/1 bnx2x: handle iSCSI SD mode
in iSCSI SD mode to bnx2x device assigned single mac address which is supposted to be iscsi mac. If this mode is recognized bnx2x will disable LRO, decrease number of queues to 1 and rx ring size to the minumum allowed by FW, this in order minimize memory use. It will tranfer mac for iscsi usage and zero primary mac of the netdev.
Signed-off-by Dmitry Kravkov <[email protected]>
Signed-off-by Eilon Greenstein <[email protected]>
Reviewed-by Michael Chan <[email protected]>
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 12 +++++ drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 21 ++++++++- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | 12 +++++ drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 50 +++++++++++++++++++--- 4 files changed, 86 insertions(+), 9 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +12 -0
@@ -2084,4 +2084,16 @@ static const u32 dmae_reg_go_c[] = {void bnx2x_set_ethtool_ops (struct net_device *netdev);void bnx2x_notify_link_changed (struct bnx2x *bp); + + +#define BNX2X_MF_PROTOCOL (bp) \ + ((bp)->mf_config[BP_VN(bp)] & FUNC_MF_CFG_PROTOCOL_MASK) + +#ifdef BCM_CNIC +#define BNX2X_IS_MF_PROTOCOL_ISCSI (bp) \ + (BNX2X_MF_PROTOCOL(bp) == FUNC_MF_CFG_PROTOCOL_ISCSI) + +#define IS_MF_ISCSI_SD (bp) (IS_MF_SD(bp) && BNX2X_IS_MF_PROTOCOL_ISCSI(bp)) +#endif +#endif /* bnx2x.h */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +18 -3
@@ -1427,6 +1427,11 @@ void bnx2x_set_num_queues(struct bnx2x *bp)break ; } +#ifdef BCM_CNIC +/* override in ISCSI SD mod */ +if (IS_MF_ISCSI_SD (bp)) + bp->num_queues =1 ; +#endif /* Add special queues */ bp->num_queues +=NON_ETH_CONTEXT_USE ; }
@@ -2970,8 +2975,13 @@ int bnx2x_change_mac_addr(struct net_device *dev, void *p)struct bnx2x *bp =netdev_priv (dev);int rc =0 ; -if (!is_valid_ether_addr ((u8 *)(addr->sa_data))) +if (!bnx2x_is_valid_ether_addr (bp, addr->sa_data)) +return -EINVAL ; + +#ifdef BCM_CNIC +if (IS_MF_ISCSI_SD (bp) && !is_zero_ether_addr (addr->sa_data))return -EINVAL ; +#endif if (netif_running (dev)) { rc =bnx2x_set_eth_mac (bp, false);
@@ -3087,7 +3097,12 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index)u8 cos;int rx_ring_size =0 ; -/* if rx_ring_size specified - use it */ +#ifdef BCM_CNIC +if (IS_MF_ISCSI_SD (bp)) { + rx_ring_size =MIN_RX_SIZE_NONTPA ; + bp->rx_ring_size = rx_ring_size; + } else +#endif if (!bp->rx_ring_size) { rx_ring_size =MAX_RX_AVAIL /BNX2X_NUM_RX_QUEUES (bp);
@@ -3097,7 +3112,7 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index) MIN_RX_SIZE_TPA, rx_ring_size); bp->rx_ring_size = rx_ring_size; - }else + }else /* if rx_ring_size specified - use it */ rx_ring_size = bp->rx_ring_size;/* Common */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +12 -0
@@ -20,6 +20,7 @@#include <linux/types.h> #include <linux/pci.h> #include <linux/netdevice.h> +#include <linux/etherdevice.h> #include "bnx2x.h"
@@ -1554,4 +1555,15 @@ static inline void bnx2x_update_drv_flags(struct bnx2x *bp, u32 flags, u32 set) } } +static inline bool bnx2x_is_valid_ether_addr (struct bnx2x *bp,u8 *addr) +{ +if (is_valid_ether_addr (addr)) +return true; +#ifdef BCM_CNIC +if (is_zero_ether_addr (addr) &&IS_MF_ISCSI_SD (bp)) +return true; +#endif +return false; +} +#endif /* BNX2X_CMN_H */
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +44 -6
109 lines not on this page · raw message
Signature · 1 line
1.7.7.2