Skip to content

Commit 1e128c8

Browse files
Arun Easidavem330
authored andcommitted
qed: Add support for hardware offloaded FCoE.
This adds the backbone required for the various HW initalizations which are necessary for the FCoE driver (qedf) for QLogic FastLinQ 4xxxx line of adapters - FW notification, resource initializations, etc. Signed-off-by: Arun Easi <[email protected]> Signed-off-by: Yuval Mintz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f787d1d commit 1e128c8

25 files changed

+3211
-19
lines changed

drivers/net/ethernet/qlogic/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,7 @@ config QED_RDMA
114114
config QED_ISCSI
115115
bool
116116

117+
config QED_FCOE
118+
bool
119+
117120
endif # NET_VENDOR_QLOGIC

drivers/net/ethernet/qlogic/qed/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ qed-$(CONFIG_QED_SRIOV) += qed_sriov.o qed_vf.o
77
qed-$(CONFIG_QED_LL2) += qed_ll2.o
88
qed-$(CONFIG_QED_RDMA) += qed_roce.o
99
qed-$(CONFIG_QED_ISCSI) += qed_iscsi.o qed_ooo.o
10+
qed-$(CONFIG_QED_FCOE) += qed_fcoe.o

drivers/net/ethernet/qlogic/qed/qed.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ extern const struct qed_common_ops qed_common_ops_pass;
6060
#define QED_WFQ_UNIT 100
6161

6262
#define ISCSI_BDQ_ID(_port_id) (_port_id)
63+
#define FCOE_BDQ_ID(_port_id) ((_port_id) + 2)
6364
#define QED_WID_SIZE (1024)
6465
#define QED_PF_DEMS_SIZE (4)
6566

@@ -167,6 +168,7 @@ struct qed_tunn_update_params {
167168
*/
168169
enum qed_pci_personality {
169170
QED_PCI_ETH,
171+
QED_PCI_FCOE,
170172
QED_PCI_ISCSI,
171173
QED_PCI_ETH_ROCE,
172174
QED_PCI_DEFAULT /* default in shmem */
@@ -204,6 +206,7 @@ enum QED_FEATURE {
204206
QED_VF,
205207
QED_RDMA_CNQ,
206208
QED_VF_L2_QUE,
209+
QED_FCOE_CQ,
207210
QED_MAX_FEATURES,
208211
};
209212

@@ -221,6 +224,7 @@ enum QED_PORT_MODE {
221224

222225
enum qed_dev_cap {
223226
QED_DEV_CAP_ETH,
227+
QED_DEV_CAP_FCOE,
224228
QED_DEV_CAP_ISCSI,
225229
QED_DEV_CAP_ROCE,
226230
};
@@ -255,6 +259,10 @@ struct qed_hw_info {
255259
u32 part_num[4];
256260

257261
unsigned char hw_mac_addr[ETH_ALEN];
262+
u64 node_wwn;
263+
u64 port_wwn;
264+
265+
u16 num_fcoe_conns;
258266

259267
struct qed_igu_info *p_igu_info;
260268

@@ -410,6 +418,7 @@ struct qed_hwfn {
410418
struct qed_ooo_info *p_ooo_info;
411419
struct qed_rdma_info *p_rdma_info;
412420
struct qed_iscsi_info *p_iscsi_info;
421+
struct qed_fcoe_info *p_fcoe_info;
413422
struct qed_pf_params pf_params;
414423

415424
bool b_rdma_enabled_in_prs;
@@ -620,11 +629,13 @@ struct qed_dev {
620629

621630
u8 protocol;
622631
#define IS_QED_ETH_IF(cdev) ((cdev)->protocol == QED_PROTOCOL_ETH)
632+
#define IS_QED_FCOE_IF(cdev) ((cdev)->protocol == QED_PROTOCOL_FCOE)
623633

624634
/* Callbacks to protocol driver */
625635
union {
626636
struct qed_common_cb_ops *common;
627637
struct qed_eth_cb_ops *eth;
638+
struct qed_fcoe_cb_ops *fcoe;
628639
struct qed_iscsi_cb_ops *iscsi;
629640
} protocol_ops;
630641
void *ops_cookie;

drivers/net/ethernet/qlogic/qed/qed_cxt.c

Lines changed: 93 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ union conn_context {
9090
struct core_conn_context core_ctx;
9191
struct eth_conn_context eth_ctx;
9292
struct iscsi_conn_context iscsi_ctx;
93+
struct fcoe_conn_context fcoe_ctx;
9394
struct roce_conn_context roce_ctx;
9495
};
9596

96-
/* TYPE-0 task context - iSCSI */
97+
/* TYPE-0 task context - iSCSI, FCOE */
9798
union type0_task_context {
9899
struct iscsi_task_context iscsi_ctx;
100+
struct fcoe_task_context fcoe_ctx;
99101
};
100102

101103
/* TYPE-1 task context - ROCE */
@@ -240,15 +242,22 @@ struct qed_cxt_mngr {
240242
static bool src_proto(enum protocol_type type)
241243
{
242244
return type == PROTOCOLID_ISCSI ||
245+
type == PROTOCOLID_FCOE ||
243246
type == PROTOCOLID_ROCE;
244247
}
245248

246249
static bool tm_cid_proto(enum protocol_type type)
247250
{
248251
return type == PROTOCOLID_ISCSI ||
252+
type == PROTOCOLID_FCOE ||
249253
type == PROTOCOLID_ROCE;
250254
}
251255

256+
static bool tm_tid_proto(enum protocol_type type)
257+
{
258+
return type == PROTOCOLID_FCOE;
259+
}
260+
252261
/* counts the iids for the CDU/CDUC ILT client configuration */
253262
struct qed_cdu_iids {
254263
u32 pf_cids;
@@ -307,6 +316,22 @@ static void qed_cxt_tm_iids(struct qed_cxt_mngr *p_mngr,
307316
iids->pf_cids += p_cfg->cid_count;
308317
iids->per_vf_cids += p_cfg->cids_per_vf;
309318
}
319+
320+
if (tm_tid_proto(i)) {
321+
struct qed_tid_seg *segs = p_cfg->tid_seg;
322+
323+
/* for each segment there is at most one
324+
* protocol for which count is not 0.
325+
*/
326+
for (j = 0; j < NUM_TASK_PF_SEGMENTS; j++)
327+
iids->pf_tids[j] += segs[j].count;
328+
329+
/* The last array elelment is for the VFs. As for PF
330+
* segments there can be only one protocol for
331+
* which this value is not 0.
332+
*/
333+
iids->per_vf_tids += segs[NUM_TASK_PF_SEGMENTS].count;
334+
}
310335
}
311336

312337
iids->pf_cids = roundup(iids->pf_cids, TM_ALIGN);
@@ -1694,9 +1719,42 @@ static void qed_tm_init_pf(struct qed_hwfn *p_hwfn)
16941719
/* @@@TBD how to enable the scan for the VFs */
16951720
}
16961721

1722+
static void qed_prs_init_common(struct qed_hwfn *p_hwfn)
1723+
{
1724+
if ((p_hwfn->hw_info.personality == QED_PCI_FCOE) &&
1725+
p_hwfn->pf_params.fcoe_pf_params.is_target)
1726+
STORE_RT_REG(p_hwfn,
1727+
PRS_REG_SEARCH_RESP_INITIATOR_TYPE_RT_OFFSET, 0);
1728+
}
1729+
1730+
static void qed_prs_init_pf(struct qed_hwfn *p_hwfn)
1731+
{
1732+
struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr;
1733+
struct qed_conn_type_cfg *p_fcoe;
1734+
struct qed_tid_seg *p_tid;
1735+
1736+
p_fcoe = &p_mngr->conn_cfg[PROTOCOLID_FCOE];
1737+
1738+
/* If FCoE is active set the MAX OX_ID (tid) in the Parser */
1739+
if (!p_fcoe->cid_count)
1740+
return;
1741+
1742+
p_tid = &p_fcoe->tid_seg[QED_CXT_FCOE_TID_SEG];
1743+
if (p_hwfn->pf_params.fcoe_pf_params.is_target) {
1744+
STORE_RT_REG_AGG(p_hwfn,
1745+
PRS_REG_TASK_ID_MAX_TARGET_PF_RT_OFFSET,
1746+
p_tid->count);
1747+
} else {
1748+
STORE_RT_REG_AGG(p_hwfn,
1749+
PRS_REG_TASK_ID_MAX_INITIATOR_PF_RT_OFFSET,
1750+
p_tid->count);
1751+
}
1752+
}
1753+
16971754
void qed_cxt_hw_init_common(struct qed_hwfn *p_hwfn)
16981755
{
16991756
qed_cdu_init_common(p_hwfn);
1757+
qed_prs_init_common(p_hwfn);
17001758
}
17011759

17021760
void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn)
@@ -1708,6 +1766,7 @@ void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn)
17081766
qed_ilt_init_pf(p_hwfn);
17091767
qed_src_init_pf(p_hwfn);
17101768
qed_tm_init_pf(p_hwfn);
1769+
qed_prs_init_pf(p_hwfn);
17111770
}
17121771

17131772
int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn,
@@ -1885,6 +1944,27 @@ int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn)
18851944
p_params->num_cons, 1);
18861945
break;
18871946
}
1947+
case QED_PCI_FCOE:
1948+
{
1949+
struct qed_fcoe_pf_params *p_params;
1950+
1951+
p_params = &p_hwfn->pf_params.fcoe_pf_params;
1952+
1953+
if (p_params->num_cons && p_params->num_tasks) {
1954+
qed_cxt_set_proto_cid_count(p_hwfn,
1955+
PROTOCOLID_FCOE,
1956+
p_params->num_cons,
1957+
0);
1958+
1959+
qed_cxt_set_proto_tid_count(p_hwfn, PROTOCOLID_FCOE,
1960+
QED_CXT_FCOE_TID_SEG, 0,
1961+
p_params->num_tasks, true);
1962+
} else {
1963+
DP_INFO(p_hwfn->cdev,
1964+
"Fcoe personality used without setting params!\n");
1965+
}
1966+
break;
1967+
}
18881968
case QED_PCI_ISCSI:
18891969
{
18901970
struct qed_iscsi_pf_params *p_params;
@@ -1927,6 +2007,10 @@ int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
19272007

19282008
/* Verify the personality */
19292009
switch (p_hwfn->hw_info.personality) {
2010+
case QED_PCI_FCOE:
2011+
proto = PROTOCOLID_FCOE;
2012+
seg = QED_CXT_FCOE_TID_SEG;
2013+
break;
19302014
case QED_PCI_ISCSI:
19312015
proto = PROTOCOLID_ISCSI;
19322016
seg = QED_CXT_ISCSI_TID_SEG;
@@ -2215,15 +2299,19 @@ int qed_cxt_get_task_ctx(struct qed_hwfn *p_hwfn,
22152299
{
22162300
struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr;
22172301
struct qed_ilt_client_cfg *p_cli;
2218-
struct qed_ilt_cli_blk *p_seg;
22192302
struct qed_tid_seg *p_seg_info;
2220-
u32 proto, seg;
2221-
u32 total_lines;
2222-
u32 tid_size, ilt_idx;
2303+
struct qed_ilt_cli_blk *p_seg;
22232304
u32 num_tids_per_block;
2305+
u32 tid_size, ilt_idx;
2306+
u32 total_lines;
2307+
u32 proto, seg;
22242308

22252309
/* Verify the personality */
22262310
switch (p_hwfn->hw_info.personality) {
2311+
case QED_PCI_FCOE:
2312+
proto = PROTOCOLID_FCOE;
2313+
seg = QED_CXT_FCOE_TID_SEG;
2314+
break;
22272315
case QED_PCI_ISCSI:
22282316
proto = PROTOCOLID_ISCSI;
22292317
seg = QED_CXT_ISCSI_TID_SEG;

drivers/net/ethernet/qlogic/qed/qed_cxt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
9191

9292
#define QED_CXT_ISCSI_TID_SEG PROTOCOLID_ISCSI
9393
#define QED_CXT_ROCE_TID_SEG PROTOCOLID_ROCE
94+
#define QED_CXT_FCOE_TID_SEG PROTOCOLID_FCOE
9495
enum qed_cxt_elem_type {
9596
QED_ELEM_CXT,
9697
QED_ELEM_SRQ,
@@ -204,4 +205,6 @@ int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto);
204205

205206
#define QED_CTX_WORKING_MEM 0
206207
#define QED_CTX_FL_MEM 1
208+
int qed_cxt_get_task_ctx(struct qed_hwfn *p_hwfn,
209+
u32 tid, u8 ctx_type, void **task_ctx);
207210
#endif

drivers/net/ethernet/qlogic/qed/qed_dcbx.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ qed_dcbx_copy_mib(struct qed_hwfn *p_hwfn,
432432
return rc;
433433
}
434434

435-
#ifdef CONFIG_DCB
436435
static void
437436
qed_dcbx_get_priority_info(struct qed_hwfn *p_hwfn,
438437
struct qed_dcbx_app_prio *p_prio,
@@ -749,7 +748,6 @@ qed_dcbx_get_params(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
749748

750749
return 0;
751750
}
752-
#endif
753751

754752
static int
755753
qed_dcbx_read_local_lldp_mib(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
@@ -864,6 +862,15 @@ static int qed_dcbx_read_mib(struct qed_hwfn *p_hwfn,
864862
return rc;
865863
}
866864

865+
void qed_dcbx_aen(struct qed_hwfn *hwfn, u32 mib_type)
866+
{
867+
struct qed_common_cb_ops *op = hwfn->cdev->protocol_ops.common;
868+
void *cookie = hwfn->cdev->ops_cookie;
869+
870+
if (cookie && op->dcbx_aen)
871+
op->dcbx_aen(cookie, &hwfn->p_dcbx_info->get, mib_type);
872+
}
873+
867874
/* Read updated MIB.
868875
* Reconfigure QM and invoke PF update ramrod command if operational MIB
869876
* change is detected.
@@ -890,6 +897,8 @@ qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn,
890897
qed_sp_pf_update(p_hwfn);
891898
}
892899
}
900+
qed_dcbx_get_params(p_hwfn, p_ptt, &p_hwfn->p_dcbx_info->get, type);
901+
qed_dcbx_aen(p_hwfn, type);
893902

894903
return rc;
895904
}

drivers/net/ethernet/qlogic/qed/qed_dcbx.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ struct qed_dcbx_app_data {
5757
u8 tc; /* Traffic Class */
5858
};
5959

60-
#ifdef CONFIG_DCB
6160
#define QED_DCBX_VERSION_DISABLED 0
6261
#define QED_DCBX_VERSION_IEEE 1
6362
#define QED_DCBX_VERSION_CEE 2
@@ -73,7 +72,6 @@ struct qed_dcbx_set {
7372
struct qed_dcbx_admin_params config;
7473
u32 ver_num;
7574
};
76-
#endif
7775

7876
struct qed_dcbx_results {
7977
bool dcbx_enabled;
@@ -97,9 +95,8 @@ struct qed_dcbx_info {
9795
struct qed_dcbx_results results;
9896
struct dcbx_mib operational;
9997
struct dcbx_mib remote;
100-
#ifdef CONFIG_DCB
10198
struct qed_dcbx_set set;
102-
#endif
99+
struct qed_dcbx_get get;
103100
u8 dcbx_cap;
104101
};
105102

0 commit comments

Comments
 (0)