@@ -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 */
9798union 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 {
240242static bool src_proto (enum protocol_type type )
241243{
242244 return type == PROTOCOLID_ISCSI ||
245+ type == PROTOCOLID_FCOE ||
243246 type == PROTOCOLID_ROCE ;
244247}
245248
246249static 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 */
253262struct 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+
16971754void 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
17021760void 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
17131772int 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 ;
0 commit comments