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

Commit b9871bcf authored by Ariel Elior's avatar Ariel Elior Committed by David S. Miller
Browse files

bnx2x: VF RSS support - PF side



This patch adds support for Receive Side Scaling for queues of
Virtual Functions on the PF side. This includes support for the
requests for multiple queues from VF drivers, configuration of the
HW for multiple queues per VF, and support for rss configuration
of said queues.

Signed-off-by: default avatarAriel Elior <ariele@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 53cf5275
Loading
Loading
Loading
Loading
+22 −10
Original line number Original line Diff line number Diff line
@@ -825,15 +825,13 @@ static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp)
#define BD_UNMAP_LEN(bd)		(le16_to_cpu((bd)->nbytes))
#define BD_UNMAP_LEN(bd)		(le16_to_cpu((bd)->nbytes))


#define BNX2X_DB_MIN_SHIFT		3	/* 8 bytes */
#define BNX2X_DB_MIN_SHIFT		3	/* 8 bytes */
#define BNX2X_DB_SHIFT			7	/* 128 bytes*/
#define BNX2X_DB_SHIFT			3	/* 8 bytes*/
#if (BNX2X_DB_SHIFT < BNX2X_DB_MIN_SHIFT)
#if (BNX2X_DB_SHIFT < BNX2X_DB_MIN_SHIFT)
#error "Min DB doorbell stride is 8"
#error "Min DB doorbell stride is 8"
#endif
#endif
#define DPM_TRIGER_TYPE			0x40
#define DOORBELL(bp, cid, val) \
#define DOORBELL(bp, cid, val) \
	do { \
	do { \
		writel((u32)(val), bp->doorbells + (bp->db_size * (cid)) + \
		writel((u32)(val), bp->doorbells + (bp->db_size * (cid))); \
		       DPM_TRIGER_TYPE); \
	} while (0)
	} while (0)


/* TX CSUM helpers */
/* TX CSUM helpers */
@@ -1100,13 +1098,27 @@ struct bnx2x_port {
extern struct workqueue_struct *bnx2x_wq;
extern struct workqueue_struct *bnx2x_wq;


#define BNX2X_MAX_NUM_OF_VFS	64
#define BNX2X_MAX_NUM_OF_VFS	64
#define BNX2X_VF_CID_WND	0
#define BNX2X_VF_CID_WND	4 /* log num of queues per VF. HW config. */
#define BNX2X_CIDS_PER_VF	(1 << BNX2X_VF_CID_WND)
#define BNX2X_CIDS_PER_VF	(1 << BNX2X_VF_CID_WND)
#define BNX2X_CLIENTS_PER_VF	1

#define BNX2X_FIRST_VF_CID	256
/* We need to reserve doorbell addresses for all VF and queue combinations */
#define BNX2X_VF_CIDS		(BNX2X_MAX_NUM_OF_VFS * BNX2X_CIDS_PER_VF)
#define BNX2X_VF_CIDS		(BNX2X_MAX_NUM_OF_VFS * BNX2X_CIDS_PER_VF)

/* The doorbell is configured to have the same number of CIDs for PFs and for
 * VFs. For this reason the PF CID zone is as large as the VF zone.
 */
#define BNX2X_FIRST_VF_CID	BNX2X_VF_CIDS
#define BNX2X_MAX_NUM_VF_QUEUES	64
#define BNX2X_VF_ID_INVALID	0xFF
#define BNX2X_VF_ID_INVALID	0xFF


/* the number of VF CIDS multiplied by the amount of bytes reserved for each
 * cid must not exceed the size of the VF doorbell
 */
#define BNX2X_VF_BAR_SIZE	512
#if (BNX2X_VF_BAR_SIZE < BNX2X_CIDS_PER_VF * (1 << BNX2X_DB_SHIFT))
#error "VF doorbell bar size is 512"
#endif

/*
/*
 * The total number of L2 queues, MSIX vectors and HW contexts (CIDs) is
 * The total number of L2 queues, MSIX vectors and HW contexts (CIDs) is
 * control by the number of fast-path status blocks supported by the
 * control by the number of fast-path status blocks supported by the
@@ -1650,10 +1662,10 @@ struct bnx2x {
	dma_addr_t			fw_stats_data_mapping;
	dma_addr_t			fw_stats_data_mapping;
	int				fw_stats_data_sz;
	int				fw_stats_data_sz;


	/* For max 196 cids (64*3 + non-eth), 32KB ILT page size and 1KB
	/* For max 1024 cids (VF RSS), 32KB ILT page size and 1KB
	 * context size we need 8 ILT entries.
	 * context size we need 8 ILT entries.
	 */
	 */
#define ILT_MAX_L2_LINES	8
#define ILT_MAX_L2_LINES	32
	struct hw_context	context[ILT_MAX_L2_LINES];
	struct hw_context	context[ILT_MAX_L2_LINES];


	struct bnx2x_ilt	*ilt;
	struct bnx2x_ilt	*ilt;
@@ -1869,7 +1881,7 @@ extern int num_queues;
#define FUNC_FLG_TPA		0x0008
#define FUNC_FLG_TPA		0x0008
#define FUNC_FLG_SPQ		0x0010
#define FUNC_FLG_SPQ		0x0010
#define FUNC_FLG_LEADING	0x0020	/* PF only */
#define FUNC_FLG_LEADING	0x0020	/* PF only */

#define FUNC_FLG_LEADING_STATS	0x0040
struct bnx2x_func_init_params {
struct bnx2x_func_init_params {
	/* dma */
	/* dma */
	dma_addr_t	fw_stat_map;	/* valid iff FUNC_FLG_STATS */
	dma_addr_t	fw_stat_map;	/* valid iff FUNC_FLG_STATS */
+5 −0
Original line number Original line Diff line number Diff line
@@ -4784,6 +4784,11 @@ int bnx2x_resume(struct pci_dev *pdev)
void bnx2x_set_ctx_validation(struct bnx2x *bp, struct eth_context *cxt,
void bnx2x_set_ctx_validation(struct bnx2x *bp, struct eth_context *cxt,
			      u32 cid)
			      u32 cid)
{
{
	if (!cxt) {
		BNX2X_ERR("bad context pointer %p\n", cxt);
		return;
	}

	/* ustorm cxt validation */
	/* ustorm cxt validation */
	cxt->ustorm_ag_context.cdu_usage =
	cxt->ustorm_ag_context.cdu_usage =
		CDU_RSRVD_VALUE_TYPE_A(HW_CID(bp, cid),
		CDU_RSRVD_VALUE_TYPE_A(HW_CID(bp, cid),
+1 −1
Original line number Original line Diff line number Diff line
@@ -6893,7 +6893,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp)
		bnx2x_init_block(bp, BLOCK_TM, PHASE_COMMON);
		bnx2x_init_block(bp, BLOCK_TM, PHASE_COMMON);


	bnx2x_init_block(bp, BLOCK_DORQ, PHASE_COMMON);
	bnx2x_init_block(bp, BLOCK_DORQ, PHASE_COMMON);
	REG_WR(bp, DORQ_REG_DPM_CID_OFST, BNX2X_DB_SHIFT);

	if (!CHIP_REV_IS_SLOW(bp))
	if (!CHIP_REV_IS_SLOW(bp))
		/* enable hw interrupt from doorbell Q */
		/* enable hw interrupt from doorbell Q */
		REG_WR(bp, DORQ_REG_DORQ_INT_MASK, 0);
		REG_WR(bp, DORQ_REG_DORQ_INT_MASK, 0);
+1 −0
Original line number Original line Diff line number Diff line
@@ -6335,6 +6335,7 @@
#define PCI_ID_VAL2					0x438
#define PCI_ID_VAL2					0x438
#define PCI_ID_VAL3					0x43c
#define PCI_ID_VAL3					0x43c


#define GRC_CONFIG_REG_VF_MSIX_CONTROL		    0x61C
#define GRC_CONFIG_REG_PF_INIT_VF		0x624
#define GRC_CONFIG_REG_PF_INIT_VF		0x624
#define GRC_CR_PF_INIT_VF_PF_FIRST_VF_NUM_MASK	0xf
#define GRC_CR_PF_INIT_VF_PF_FIRST_VF_NUM_MASK	0xf
/* First VF_NUM for PF is encoded in this register.
/* First VF_NUM for PF is encoded in this register.
+10 −0
Original line number Original line Diff line number Diff line
@@ -4416,6 +4416,16 @@ void bnx2x_init_rss_config_obj(struct bnx2x *bp,
	rss_obj->config_rss = bnx2x_setup_rss;
	rss_obj->config_rss = bnx2x_setup_rss;
}
}


int validate_vlan_mac(struct bnx2x *bp,
		      struct bnx2x_vlan_mac_obj *vlan_mac)
{
	if (!vlan_mac->get_n_elements) {
		BNX2X_ERR("vlan mac object was not intialized\n");
		return -EINVAL;
	}
	return 0;
}

/********************** Queue state object ***********************************/
/********************** Queue state object ***********************************/


/**
/**
Loading