aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h36
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c4
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c3
3 files changed, 39 insertions, 4 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index 70b6a05834d1..97b3d32a98bd 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -246,8 +246,37 @@ enum {
246 BNX2X_MAX_CNIC_ETH_CL_ID_IDX, 246 BNX2X_MAX_CNIC_ETH_CL_ID_IDX,
247}; 247};
248 248
249#define BNX2X_CNIC_START_ETH_CID(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) *\ 249/* use a value high enough to be above all the PFs, which has least significant
250 * nibble as 8, so when cnic needs to come up with a CID for UIO to use to
251 * calculate doorbell address according to old doorbell configuration scheme
252 * (db_msg_sz 1 << 7 * cid + 0x40 DPM offset) it can come up with a valid number
253 * We must avoid coming up with cid 8 for iscsi since according to this method
254 * the designated UIO cid will come out 0 and it has a special handling for that
255 * case which doesn't suit us. Therefore will will cieling to closes cid which
256 * has least signigifcant nibble 8 and if it is 8 we will move forward to 0x18.
257 */
258
259#define BNX2X_1st_NON_L2_ETH_CID(bp) (BNX2X_NUM_NON_CNIC_QUEUES(bp) * \
250 (bp)->max_cos) 260 (bp)->max_cos)
261/* amount of cids traversed by UIO's DPM addition to doorbell */
262#define UIO_DPM 8
263/* roundup to DPM offset */
264#define UIO_ROUNDUP(bp) (roundup(BNX2X_1st_NON_L2_ETH_CID(bp), \
265 UIO_DPM))
266/* offset to nearest value which has lsb nibble matching DPM */
267#define UIO_CID_OFFSET(bp) ((UIO_ROUNDUP(bp) + UIO_DPM) % \
268 (UIO_DPM * 2))
269/* add offset to rounded-up cid to get a value which could be used with UIO */
270#define UIO_DPM_ALIGN(bp) (UIO_ROUNDUP(bp) + UIO_CID_OFFSET(bp))
271/* but wait - avoid UIO special case for cid 0 */
272#define UIO_DPM_CID0_OFFSET(bp) ((UIO_DPM * 2) * \
273 (UIO_DPM_ALIGN(bp) == UIO_DPM))
274/* Properly DPM aligned CID dajusted to cid 0 secal case */
275#define BNX2X_CNIC_START_ETH_CID(bp) (UIO_DPM_ALIGN(bp) + \
276 (UIO_DPM_CID0_OFFSET(bp)))
277/* how many cids were wasted - need this value for cid allocation */
278#define UIO_CID_PAD(bp) (BNX2X_CNIC_START_ETH_CID(bp) - \
279 BNX2X_1st_NON_L2_ETH_CID(bp))
251 /* iSCSI L2 */ 280 /* iSCSI L2 */
252#define BNX2X_ISCSI_ETH_CID(bp) (BNX2X_CNIC_START_ETH_CID(bp)) 281#define BNX2X_ISCSI_ETH_CID(bp) (BNX2X_CNIC_START_ETH_CID(bp))
253 /* FCoE L2 */ 282 /* FCoE L2 */
@@ -1680,10 +1709,11 @@ struct bnx2x {
1680 * Maximum CID count that might be required by the bnx2x: 1709 * Maximum CID count that might be required by the bnx2x:
1681 * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI 1710 * Max RSS * Max_Tx_Multi_Cos + FCoE + iSCSI
1682 */ 1711 */
1712
1683#define BNX2X_L2_CID_COUNT(bp) (BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \ 1713#define BNX2X_L2_CID_COUNT(bp) (BNX2X_NUM_ETH_QUEUES(bp) * BNX2X_MULTI_TX_COS \
1684 + 2 * CNIC_SUPPORT(bp)) 1714 + CNIC_SUPPORT(bp) * (2 + UIO_CID_PAD(bp)))
1685#define BNX2X_L2_MAX_CID(bp) (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \ 1715#define BNX2X_L2_MAX_CID(bp) (BNX2X_MAX_RSS_COUNT(bp) * BNX2X_MULTI_TX_COS \
1686 + 2 * CNIC_SUPPORT(bp)) 1716 + CNIC_SUPPORT(bp) * (2 + UIO_CID_PAD(bp)))
1687#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\ 1717#define L2_ILT_LINES(bp) (DIV_ROUND_UP(BNX2X_L2_CID_COUNT(bp),\
1688 ILT_PAGE_CIDS)) 1718 ILT_PAGE_CIDS))
1689 1719
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 62c59eda1239..a6704b555042 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13632,6 +13632,10 @@ void bnx2x_setup_cnic_info(struct bnx2x *bp)
13632 cp->fcoe_init_cid = BNX2X_FCOE_ETH_CID(bp); 13632 cp->fcoe_init_cid = BNX2X_FCOE_ETH_CID(bp);
13633 cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID(bp); 13633 cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID(bp);
13634 13634
13635 DP(NETIF_MSG_IFUP, "BNX2X_1st_NON_L2_ETH_CID(bp) %x, cp->starting_cid %x, cp->fcoe_init_cid %x, cp->iscsi_l2_cid %x\n",
13636 BNX2X_1st_NON_L2_ETH_CID(bp), cp->starting_cid, cp->fcoe_init_cid,
13637 cp->iscsi_l2_cid);
13638
13635 if (NO_ISCSI_OOO(bp)) 13639 if (NO_ISCSI_OOO(bp))
13636 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO; 13640 cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO;
13637} 13641}
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index 8142480d9770..93da16b36df0 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -5217,7 +5217,8 @@ static void cnic_init_rings(struct cnic_dev *dev)
5217 "iSCSI CLIENT_SETUP did not complete\n"); 5217 "iSCSI CLIENT_SETUP did not complete\n");
5218 cnic_spq_completion(dev, DRV_CTL_RET_L2_SPQ_CREDIT_CMD, 1); 5218 cnic_spq_completion(dev, DRV_CTL_RET_L2_SPQ_CREDIT_CMD, 1);
5219 cnic_ring_ctl(dev, cid, cli, 1); 5219 cnic_ring_ctl(dev, cid, cli, 1);
5220 *cid_ptr = cid; 5220 *cid_ptr = cid >> 4;
5221 *(cid_ptr + 1) = cid * bp->db_size;
5221 } 5222 }
5222} 5223}
5223 5224