Skip to content

Commit 7e3e375

Browse files
Sudarsana Reddy Kallurudavem330
authored andcommitted
qed: Add missing device config for RoCE EDPM in UFP mode.
This patch adds support to configure the DORQ to use vlan-id/priority for roce EDPM. Fixes: cac6f691 ("qed: Add support for Unified Fabric Port") Signed-off-by: Sudarsana Reddy Kalluru <Sudarsana.Kalluru@cavium.com> Signed-off-by: Tomer Tayar <Tomer.Tayar@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0216da9 commit 7e3e375

File tree

3 files changed

+48
-22
lines changed

3 files changed

+48
-22
lines changed

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

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,8 @@ qed_dcbx_dp_protocol(struct qed_hwfn *p_hwfn, struct qed_dcbx_results *p_data)
190190

191191
static void
192192
qed_dcbx_set_params(struct qed_dcbx_results *p_data,
193-
struct qed_hwfn *p_hwfn,
194-
struct qed_hw_info *p_info,
195-
bool enable,
196-
u8 prio,
197-
u8 tc,
193+
struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
194+
bool enable, u8 prio, u8 tc,
198195
enum dcbx_protocol_type type,
199196
enum qed_pci_personality personality)
200197
{
@@ -213,18 +210,24 @@ qed_dcbx_set_params(struct qed_dcbx_results *p_data,
213210
p_data->arr[type].dont_add_vlan0 = true;
214211

215212
/* QM reconf data */
216-
if (p_info->personality == personality)
217-
qed_hw_info_set_offload_tc(p_info, tc);
213+
if (p_hwfn->hw_info.personality == personality)
214+
qed_hw_info_set_offload_tc(&p_hwfn->hw_info, tc);
215+
216+
/* Configure dcbx vlan priority in doorbell block for roce EDPM */
217+
if (test_bit(QED_MF_UFP_SPECIFIC, &p_hwfn->cdev->mf_bits) &&
218+
type == DCBX_PROTOCOL_ROCE) {
219+
qed_wr(p_hwfn, p_ptt, DORQ_REG_TAG1_OVRD_MODE, 1);
220+
qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_PCP_BB_K2, prio << 1);
221+
}
218222
}
219223

220224
/* Update app protocol data and hw_info fields with the TLV info */
221225
static void
222226
qed_dcbx_update_app_info(struct qed_dcbx_results *p_data,
223-
struct qed_hwfn *p_hwfn,
224-
bool enable,
225-
u8 prio, u8 tc, enum dcbx_protocol_type type)
227+
struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
228+
bool enable, u8 prio, u8 tc,
229+
enum dcbx_protocol_type type)
226230
{
227-
struct qed_hw_info *p_info = &p_hwfn->hw_info;
228231
enum qed_pci_personality personality;
229232
enum dcbx_protocol_type id;
230233
int i;
@@ -237,7 +240,7 @@ qed_dcbx_update_app_info(struct qed_dcbx_results *p_data,
237240

238241
personality = qed_dcbx_app_update[i].personality;
239242

240-
qed_dcbx_set_params(p_data, p_hwfn, p_info, enable,
243+
qed_dcbx_set_params(p_data, p_hwfn, p_ptt, enable,
241244
prio, tc, type, personality);
242245
}
243246
}
@@ -271,7 +274,7 @@ qed_dcbx_get_app_protocol_type(struct qed_hwfn *p_hwfn,
271274
* reconfiguring QM. Get protocol specific data for PF update ramrod command.
272275
*/
273276
static int
274-
qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
277+
qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
275278
struct qed_dcbx_results *p_data,
276279
struct dcbx_app_priority_entry *p_tbl,
277280
u32 pri_tc_tbl, int count, u8 dcbx_version)
@@ -315,7 +318,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
315318
enable = true;
316319
}
317320

318-
qed_dcbx_update_app_info(p_data, p_hwfn, enable,
321+
qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, enable,
319322
priority, tc, type);
320323
}
321324
}
@@ -337,7 +340,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
337340
continue;
338341

339342
enable = (type == DCBX_PROTOCOL_ETH) ? false : !!dcbx_version;
340-
qed_dcbx_update_app_info(p_data, p_hwfn, enable,
343+
qed_dcbx_update_app_info(p_data, p_hwfn, p_ptt, enable,
341344
priority, tc, type);
342345
}
343346

@@ -347,7 +350,8 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
347350
/* Parse app TLV's to update TC information in hw_info structure for
348351
* reconfiguring QM. Get protocol specific data for PF update ramrod command.
349352
*/
350-
static int qed_dcbx_process_mib_info(struct qed_hwfn *p_hwfn)
353+
static int
354+
qed_dcbx_process_mib_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
351355
{
352356
struct dcbx_app_priority_feature *p_app;
353357
struct dcbx_app_priority_entry *p_tbl;
@@ -371,7 +375,7 @@ static int qed_dcbx_process_mib_info(struct qed_hwfn *p_hwfn)
371375
p_info = &p_hwfn->hw_info;
372376
num_entries = QED_MFW_GET_FIELD(p_app->flags, DCBX_APP_NUM_ENTRIES);
373377

374-
rc = qed_dcbx_process_tlv(p_hwfn, &data, p_tbl, pri_tc_tbl,
378+
rc = qed_dcbx_process_tlv(p_hwfn, p_ptt, &data, p_tbl, pri_tc_tbl,
375379
num_entries, dcbx_version);
376380
if (rc)
377381
return rc;
@@ -897,7 +901,7 @@ qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn,
897901
return rc;
898902

899903
if (type == QED_DCBX_OPERATIONAL_MIB) {
900-
rc = qed_dcbx_process_mib_info(p_hwfn);
904+
rc = qed_dcbx_process_mib_info(p_hwfn, p_ptt);
901905
if (!rc) {
902906
/* reconfigure tcs of QM queues according
903907
* to negotiation results

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,13 +1581,29 @@ static void qed_mcp_update_stag(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
15811581
p_hwfn->mcp_info->func_info.ovlan = (u16)shmem_info.ovlan_stag &
15821582
FUNC_MF_CFG_OV_STAG_MASK;
15831583
p_hwfn->hw_info.ovlan = p_hwfn->mcp_info->func_info.ovlan;
1584-
if ((p_hwfn->hw_info.hw_mode & BIT(MODE_MF_SD)) &&
1585-
(p_hwfn->hw_info.ovlan != QED_MCP_VLAN_UNSET)) {
1586-
qed_wr(p_hwfn, p_ptt,
1587-
NIG_REG_LLH_FUNC_TAG_VALUE, p_hwfn->hw_info.ovlan);
1584+
if (test_bit(QED_MF_OVLAN_CLSS, &p_hwfn->cdev->mf_bits)) {
1585+
if (p_hwfn->hw_info.ovlan != QED_MCP_VLAN_UNSET) {
1586+
qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_VALUE,
1587+
p_hwfn->hw_info.ovlan);
1588+
qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_EN, 1);
1589+
1590+
/* Configure DB to add external vlan to EDPM packets */
1591+
qed_wr(p_hwfn, p_ptt, DORQ_REG_TAG1_OVRD_MODE, 1);
1592+
qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_EXT_VID_BB_K2,
1593+
p_hwfn->hw_info.ovlan);
1594+
} else {
1595+
qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_EN, 0);
1596+
qed_wr(p_hwfn, p_ptt, NIG_REG_LLH_FUNC_TAG_VALUE, 0);
1597+
qed_wr(p_hwfn, p_ptt, DORQ_REG_TAG1_OVRD_MODE, 0);
1598+
qed_wr(p_hwfn, p_ptt, DORQ_REG_PF_EXT_VID_BB_K2, 0);
1599+
}
1600+
15881601
qed_sp_pf_update_stag(p_hwfn);
15891602
}
15901603

1604+
DP_VERBOSE(p_hwfn, QED_MSG_SP, "ovlan = %d hw_mode = 0x%x\n",
1605+
p_hwfn->mcp_info->func_info.ovlan, p_hwfn->hw_info.hw_mode);
1606+
15911607
/* Acknowledge the MFW */
15921608
qed_mcp_cmd(p_hwfn, p_ptt, DRV_MSG_CODE_S_TAG_UPDATE_ACK, 0,
15931609
&resp, &param);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@
216216
0x00c000UL
217217
#define DORQ_REG_IFEN \
218218
0x100040UL
219+
#define DORQ_REG_TAG1_OVRD_MODE \
220+
0x1008b4UL
221+
#define DORQ_REG_PF_PCP_BB_K2 \
222+
0x1008c4UL
223+
#define DORQ_REG_PF_EXT_VID_BB_K2 \
224+
0x1008c8UL
219225
#define DORQ_REG_DB_DROP_REASON \
220226
0x100a2cUL
221227
#define DORQ_REG_DB_DROP_DETAILS \

0 commit comments

Comments
 (0)