Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a3348722 authored by Barak Witkowski's avatar Barak Witkowski Committed by David S. Miller
Browse files

bnx2x: add afex support



Following patch adds afex multifunction support to the driver (afex
multifunction is based on vntag header) and updates FW version used to 7.2.51.

Support includes the following:

1. Configure vif parameters in firmware (default vlan, vif id, default
   priority, allowed priorities) according to values received from NIC.
2. Configure FW to strip/add default vlan according to afex vlan mode.
3. Notify link up to OS only after vif is fully initialized.
4. Support vif list set/get requests and configure FW accordingly.
5. Supply afex statistics upon request from NIC.
6. Special handling to L2 interface in case of FCoE vif.

Signed-off-by: default avatarBarak Witkowski <barak@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5b263f53
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -1063,6 +1063,13 @@ struct bnx2x_slowpath {
		struct flow_control_configuration pfc_config;
	} func_rdata;

	/* afex ramrod can not be a part of func_rdata union because these
	 * events might arrive in parallel to other events from func_rdata.
	 * Therefore, if they would have been defined in the same union,
	 * data can get corrupted.
	 */
	struct afex_vif_list_ramrod_data func_afex_rdata;

	/* used by dmae command executer */
	struct dmae_command		dmae[MAX_DMAE_C];

@@ -1179,6 +1186,7 @@ struct bnx2x_fw_stats_data {
enum {
	BNX2X_SP_RTNL_SETUP_TC,
	BNX2X_SP_RTNL_TX_TIMEOUT,
	BNX2X_SP_RTNL_AFEX_F_UPDATE,
	BNX2X_SP_RTNL_FAN_FAILURE,
};

@@ -1343,13 +1351,14 @@ struct bnx2x {
	struct cmng_init	cmng;

	u32			mf_config[E1HVN_MAX];
	u32			mf2_config[E2_FUNC_MAX];
	u32			mf_ext_config;
	u32			path_has_ovlan; /* E3 */
	u16			mf_ov;
	u8			mf_mode;
#define IS_MF(bp)		(bp->mf_mode != 0)
#define IS_MF_SI(bp)		(bp->mf_mode == MULTI_FUNCTION_SI)
#define IS_MF_SD(bp)		(bp->mf_mode == MULTI_FUNCTION_SD)
#define IS_MF_AFEX(bp)		(bp->mf_mode == MULTI_FUNCTION_AFEX)

	u8			wol;

@@ -1592,6 +1601,9 @@ struct bnx2x {
	struct dcbx_features			dcbx_remote_feat;
	u32					dcbx_remote_flags;
#endif
	/* AFEX: store default vlan used */
	int					afex_def_vlan_tag;
	enum mf_cfg_afex_vlan_mode		afex_vlan_mode;
	u32					pending_max;

	/* multiple tx classes of service */
@@ -2148,9 +2160,16 @@ void bnx2x_notify_link_changed(struct bnx2x *bp);
#define IS_MF_ISCSI_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp))
#define IS_MF_FCOE_SD(bp) (IS_MF_SD(bp) && BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp))

#define BNX2X_MF_EXT_PROTOCOL_FCOE(bp)  ((bp)->mf_ext_config & \
					 MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD)

#define IS_MF_FCOE_AFEX(bp) (IS_MF_AFEX(bp) && BNX2X_MF_EXT_PROTOCOL_FCOE(bp))
#define IS_MF_STORAGE_SD(bp) (IS_MF_SD(bp) && \
				(BNX2X_IS_MF_SD_PROTOCOL_ISCSI(bp) || \
				 BNX2X_IS_MF_SD_PROTOCOL_FCOE(bp)))
#else
#define IS_MF_FCOE_AFEX(bp)	false
#endif


#endif /* bnx2x.h */
+12 −4
Original line number Diff line number Diff line
@@ -1467,8 +1467,8 @@ void bnx2x_set_num_queues(struct bnx2x *bp)
	bp->num_queues = bnx2x_calc_num_queues(bp);

#ifdef BCM_CNIC
	/* override in STORAGE SD mode */
	if (IS_MF_STORAGE_SD(bp))
	/* override in STORAGE SD modes */
	if (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))
		bp->num_queues = 1;
#endif
	/* Add special queues */
@@ -1900,8 +1900,14 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
			SHMEM2_WR(bp, dcc_support,
				  (SHMEM_DCC_SUPPORT_DISABLE_ENABLE_PF_TLV |
				   SHMEM_DCC_SUPPORT_BANDWIDTH_ALLOCATION_TLV));
		if (SHMEM2_HAS(bp, afex_driver_support))
			SHMEM2_WR(bp, afex_driver_support,
				  SHMEM_AFEX_SUPPORTED_VERSION_ONE);
	}

	/* Set AFEX default VLAN tag to an invalid value */
	bp->afex_def_vlan_tag = -1;

	bp->state = BNX2X_STATE_OPENING_WAIT4_PORT;
	rc = bnx2x_func_start(bp);
	if (rc) {
@@ -3073,7 +3079,8 @@ int bnx2x_change_mac_addr(struct net_device *dev, void *p)
	}

#ifdef BCM_CNIC
	if (IS_MF_STORAGE_SD(bp) && !is_zero_ether_addr(addr->sa_data)) {
	if ((IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp)) &&
	    !is_zero_ether_addr(addr->sa_data)) {
		BNX2X_ERR("Can't configure non-zero address on iSCSI or FCoE functions in MF-SD mode\n");
		return -EINVAL;
	}
@@ -3195,7 +3202,8 @@ static int bnx2x_alloc_fp_mem_at(struct bnx2x *bp, int index)
	int rx_ring_size = 0;

#ifdef BCM_CNIC
	if (!bp->rx_ring_size && IS_MF_STORAGE_SD(bp)) {
	if (!bp->rx_ring_size &&
	    (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))) {
		rx_ring_size = MIN_RX_SIZE_NONTPA;
		bp->rx_ring_size = rx_ring_size;
	} else
+2 −1
Original line number Diff line number Diff line
@@ -1694,7 +1694,8 @@ 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_STORAGE_SD(bp))
	if (is_zero_ether_addr(addr) &&
	    (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp)))
		return true;
#endif
	return false;
+2 −2
Original line number Diff line number Diff line
@@ -1430,7 +1430,7 @@ static void bnx2x_get_ringparam(struct net_device *dev,
	else
		ering->rx_pending = MAX_RX_AVAIL;

	ering->tx_max_pending = MAX_TX_AVAIL;
	ering->tx_max_pending = IS_MF_FCOE_AFEX(bp) ? 0 : MAX_TX_AVAIL;
	ering->tx_pending = bp->tx_ring_size;
}

@@ -1448,7 +1448,7 @@ static int bnx2x_set_ringparam(struct net_device *dev,
	if ((ering->rx_pending > MAX_RX_AVAIL) ||
	    (ering->rx_pending < (bp->disable_tpa ? MIN_RX_SIZE_NONTPA :
						    MIN_RX_SIZE_TPA)) ||
	    (ering->tx_pending > MAX_TX_AVAIL) ||
	    (ering->tx_pending > (IS_MF_FCOE_AFEX(bp) ? 0 : MAX_TX_AVAIL)) ||
	    (ering->tx_pending <= MAX_SKB_FRAGS + 4)) {
		DP(BNX2X_MSG_ETHTOOL, "Command parameters not supported\n");
		return -EINVAL;
+1 −1
Original line number Diff line number Diff line
@@ -387,7 +387,7 @@

#define STATS_QUERY_CMD_COUNT 16

#define NIV_LIST_TABLE_SIZE 4096
#define AFEX_LIST_TABLE_SIZE 4096

#define INVALID_VNIC_ID	0xFF

Loading