Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351234
b: refs/heads/master
c: 290ca2b
h: refs/heads/master
v: v3
  • Loading branch information
Ariel Elior authored and David S. Miller committed Jan 2, 2013
1 parent 532e64a commit cb9be09
Show file tree
Hide file tree
Showing 7 changed files with 571 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dc1ba591463ca0f7ba2ac9af6ee4a5305f27ca1f
refs/heads/master: 290ca2bb456d4214f00ba0b83fcb9793963fe007
2 changes: 1 addition & 1 deletion trunk/drivers/net/ethernet/broadcom/bnx2x/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

obj-$(CONFIG_BNX2X) += bnx2x.o

bnx2x-objs := bnx2x_main.o bnx2x_link.o bnx2x_cmn.o bnx2x_ethtool.o bnx2x_stats.o bnx2x_dcb.o bnx2x_sp.o bnx2x_vfpf.o
bnx2x-objs := bnx2x_main.o bnx2x_link.o bnx2x_cmn.o bnx2x_ethtool.o bnx2x_stats.o bnx2x_dcb.o bnx2x_sp.o bnx2x_vfpf.o bnx2x_sriov.o
8 changes: 8 additions & 0 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

#ifndef BNX2X_H
#define BNX2X_H

#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/dma-mapping.h>
#include <linux/types.h>
#include <linux/pci_regs.h>

/* compilation time flags */

Expand Down Expand Up @@ -966,6 +969,7 @@ extern struct workqueue_struct *bnx2x_wq;
#define BNX2X_MAX_NUM_OF_VFS 64
#define BNX2X_VF_CID_WND 0
#define BNX2X_CIDS_PER_VF (1 << BNX2X_VF_CID_WND)
#define BNX2X_FIRST_VF_CID 256
#define BNX2X_VF_CIDS (BNX2X_MAX_NUM_OF_VFS * BNX2X_CIDS_PER_VF)
#define BNX2X_VF_ID_INVALID 0xFF

Expand Down Expand Up @@ -1117,6 +1121,7 @@ struct hw_context {
/* forward */
struct bnx2x_ilt;

struct bnx2x_vfdb;

enum bnx2x_recovery_state {
BNX2X_RECOVERY_DONE,
Expand Down Expand Up @@ -1606,6 +1611,9 @@ struct bnx2x {
char fw_ver[32];
const struct firmware *firmware;

struct bnx2x_vfdb *vfdb;
#define IS_SRIOV(bp) ((bp)->vfdb)

/* DCB support on/off */
u16 dcb_state;
#define BNX2X_DCB_STATE_OFF 0
Expand Down
28 changes: 28 additions & 0 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7270,12 +7270,21 @@ static int bnx2x_init_hw_func(struct bnx2x *bp)
ilt = BP_ILT(bp);
cdu_ilt_start = ilt->clients[ILT_CLIENT_CDU].start;

if (IS_SRIOV(bp))
cdu_ilt_start += BNX2X_FIRST_VF_CID/ILT_PAGE_CIDS;
cdu_ilt_start = bnx2x_iov_init_ilt(bp, cdu_ilt_start);

/* since BNX2X_FIRST_VF_CID > 0 the PF L2 cids precedes
* those of the VFs, so start line should be reset
*/
cdu_ilt_start = ilt->clients[ILT_CLIENT_CDU].start;
for (i = 0; i < L2_ILT_LINES(bp); i++) {
ilt->lines[cdu_ilt_start + i].page = bp->context[i].vcxt;
ilt->lines[cdu_ilt_start + i].page_mapping =
bp->context[i].cxt_mapping;
ilt->lines[cdu_ilt_start + i].size = bp->context[i].size;
}

bnx2x_ilt_init_op(bp, INITOP_SET);

if (!CONFIGURE_NIC_MODE(bp)) {
Expand Down Expand Up @@ -7881,6 +7890,8 @@ int bnx2x_set_int_mode(struct bnx2x *bp)
/* must be called prior to any HW initializations */
static inline u16 bnx2x_cid_ilt_lines(struct bnx2x *bp)
{
if (IS_SRIOV(bp))
return (BNX2X_FIRST_VF_CID + BNX2X_VF_CIDS)/ILT_PAGE_CIDS;
return L2_ILT_LINES(bp);
}

Expand Down Expand Up @@ -12106,8 +12117,12 @@ static int bnx2x_set_qm_cid_count(struct bnx2x *bp)
{
int cid_count = BNX2X_L2_MAX_CID(bp);

if (IS_SRIOV(bp))
cid_count += BNX2X_VF_CIDS;

if (CNIC_SUPPORT(bp))
cid_count += CNIC_CID_MAX;

return roundup(cid_count, QM_CID_ROUND);
}

Expand Down Expand Up @@ -12312,6 +12327,16 @@ static int bnx2x_init_one(struct pci_dev *pdev,
goto init_one_exit;
}

/* Enable SRIOV if capability found in configuration space.
* Once the generic SR-IOV framework makes it in from the
* pci tree this will be revised, to allow dynamic control
* over the number of VFs. Right now, change the num of vfs
* param below to enable SR-IOV.
*/
rc = bnx2x_iov_init_one(bp, int_mode, 0/*num vfs*/);
if (rc)
goto init_one_exit;

/* calc qm_cid_count */
bp->qm_cid_count = bnx2x_set_qm_cid_count(bp);
BNX2X_DEV_INFO("qm_cid_count %d\n", bp->qm_cid_count);
Expand Down Expand Up @@ -12435,6 +12460,9 @@ static void bnx2x_remove_one(struct pci_dev *pdev)

/* Make sure RESET task is not scheduled before continuing */
cancel_delayed_work_sync(&bp->sp_rtnl_task);

bnx2x_iov_remove_one(bp);

/* send message via vfpf channel to release the resources of this vf */
if (IS_VF(bp))
bnx2x_vfpf_release(bp);
Expand Down
9 changes: 9 additions & 0 deletions trunk/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -6305,6 +6305,15 @@
#define PCI_PM_DATA_B 0x414
#define PCI_ID_VAL1 0x434
#define PCI_ID_VAL2 0x438
#define GRC_CONFIG_REG_PF_INIT_VF 0x624
#define GRC_CR_PF_INIT_VF_PF_FIRST_VF_NUM_MASK 0xf
/* First VF_NUM for PF is encoded in this register.
* The number of VFs assigned to a PF is assumed to be a multiple of 8.
* Software should program these bits based on Total Number of VFs \
* programmed for each PF.
* Since registers from 0x000-0x7ff are split across functions, each PF will
* have the same location for the same 4 bits
*/

#define PXPCS_TL_CONTROL_5 0x814
#define PXPCS_TL_CONTROL_5_UNKNOWNTYPE_ERR_ATTN (1 << 29) /*WC*/
Expand Down
Loading

0 comments on commit cb9be09

Please sign in to comment.