Skip to content

Commit 970cf1d

Browse files
committed
Merge branch 'qed-dcb-enhancements'
Sudarsana Reddy Kalluru says: ==================== qed*: Dcbx/dcbnl enhancements. The series has set of enhancements for dcbx/dcbnl implementation of qed/qede drivers. - Patches (1) & (3) capture the sematic and debug changes. - Patch (2) adds the driver support for populating RoCEv2 dcb data. - Patch (4) adds the required support for reading/configuring the IEEE selection field (SF). - Patch (5) adds the support for configuring the static dcbx mode. Please consider applying this to 'net-next' branch. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 9b53816 + 49632b5 commit 970cf1d

File tree

5 files changed

+100
-53
lines changed

5 files changed

+100
-53
lines changed

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

Lines changed: 92 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
271271
struct dcbx_app_priority_entry *p_tbl,
272272
u32 pri_tc_tbl, int count, u8 dcbx_version)
273273
{
274-
u8 tc, priority_map;
275274
enum dcbx_protocol_type type;
275+
u8 tc, priority_map;
276276
bool enable, ieee;
277277
u16 protocol_id;
278278
int priority;
@@ -556,8 +556,9 @@ qed_dcbx_get_pfc_data(struct qed_hwfn *p_hwfn,
556556
p_params->pfc.prio[7] = !!(pfc_map & DCBX_PFC_PRI_EN_BITMAP_PRI_7);
557557

558558
DP_VERBOSE(p_hwfn, QED_MSG_DCB,
559-
"PFC params: willing %d, pfc_bitmap %d\n",
560-
p_params->pfc.willing, pfc_map);
559+
"PFC params: willing %d, pfc_bitmap %u max_tc = %u enabled = %d\n",
560+
p_params->pfc.willing, pfc_map, p_params->pfc.max_tc,
561+
p_params->pfc.enabled);
561562
}
562563

563564
static void
@@ -576,10 +577,10 @@ qed_dcbx_get_ets_data(struct qed_hwfn *p_hwfn,
576577
p_params->max_ets_tc = QED_MFW_GET_FIELD(p_ets->flags,
577578
DCBX_ETS_MAX_TCS);
578579
DP_VERBOSE(p_hwfn, QED_MSG_DCB,
579-
"ETS params: willing %d, ets_cbs %d pri_tc_tbl_0 %x max_ets_tc %d\n",
580-
p_params->ets_willing,
581-
p_params->ets_cbs,
582-
p_ets->pri_tc_tbl[0], p_params->max_ets_tc);
580+
"ETS params: willing %d, enabled = %d ets_cbs %d pri_tc_tbl_0 %x max_ets_tc %d\n",
581+
p_params->ets_willing, p_params->ets_enabled,
582+
p_params->ets_cbs, p_ets->pri_tc_tbl[0],
583+
p_params->max_ets_tc);
583584

584585
if (p_params->ets_enabled && !p_params->max_ets_tc) {
585586
p_params->max_ets_tc = QED_MAX_PFC_PRIORITIES;
@@ -620,8 +621,7 @@ qed_dcbx_get_common_params(struct qed_hwfn *p_hwfn,
620621
}
621622

622623
static void
623-
qed_dcbx_get_local_params(struct qed_hwfn *p_hwfn,
624-
struct qed_ptt *p_ptt, struct qed_dcbx_get *params)
624+
qed_dcbx_get_local_params(struct qed_hwfn *p_hwfn, struct qed_dcbx_get *params)
625625
{
626626
struct dcbx_features *p_feat;
627627

@@ -633,8 +633,7 @@ qed_dcbx_get_local_params(struct qed_hwfn *p_hwfn,
633633
}
634634

635635
static void
636-
qed_dcbx_get_remote_params(struct qed_hwfn *p_hwfn,
637-
struct qed_ptt *p_ptt, struct qed_dcbx_get *params)
636+
qed_dcbx_get_remote_params(struct qed_hwfn *p_hwfn, struct qed_dcbx_get *params)
638637
{
639638
struct dcbx_features *p_feat;
640639

@@ -647,7 +646,6 @@ qed_dcbx_get_remote_params(struct qed_hwfn *p_hwfn,
647646

648647
static void
649648
qed_dcbx_get_operational_params(struct qed_hwfn *p_hwfn,
650-
struct qed_ptt *p_ptt,
651649
struct qed_dcbx_get *params)
652650
{
653651
struct qed_dcbx_operational_params *p_operational;
@@ -668,6 +666,7 @@ qed_dcbx_get_operational_params(struct qed_hwfn *p_hwfn,
668666
if (!enabled) {
669667
p_operational->enabled = enabled;
670668
p_operational->valid = false;
669+
DP_VERBOSE(p_hwfn, QED_MSG_DCB, "Dcbx is disabled\n");
671670
return;
672671
}
673672

@@ -681,8 +680,14 @@ qed_dcbx_get_operational_params(struct qed_hwfn *p_hwfn,
681680
DCBX_CONFIG_VERSION_CEE);
682681
p_operational->cee = val;
683682

684-
DP_VERBOSE(p_hwfn, QED_MSG_DCB, "Version support: ieee %d, cee %d\n",
685-
p_operational->ieee, p_operational->cee);
683+
val = !!(QED_MFW_GET_FIELD(flags, DCBX_CONFIG_VERSION) ==
684+
DCBX_CONFIG_VERSION_STATIC);
685+
p_operational->local = val;
686+
687+
DP_VERBOSE(p_hwfn, QED_MSG_DCB,
688+
"Version support: ieee %d, cee %d, static %d\n",
689+
p_operational->ieee, p_operational->cee,
690+
p_operational->local);
686691

687692
qed_dcbx_get_common_params(p_hwfn, &p_feat->app,
688693
p_feat->app.app_pri_tbl, &p_feat->ets,
@@ -697,7 +702,6 @@ qed_dcbx_get_operational_params(struct qed_hwfn *p_hwfn,
697702

698703
static void
699704
qed_dcbx_get_local_lldp_params(struct qed_hwfn *p_hwfn,
700-
struct qed_ptt *p_ptt,
701705
struct qed_dcbx_get *params)
702706
{
703707
struct lldp_config_params_s *p_local;
@@ -712,7 +716,6 @@ qed_dcbx_get_local_lldp_params(struct qed_hwfn *p_hwfn,
712716

713717
static void
714718
qed_dcbx_get_remote_lldp_params(struct qed_hwfn *p_hwfn,
715-
struct qed_ptt *p_ptt,
716719
struct qed_dcbx_get *params)
717720
{
718721
struct lldp_status_params_s *p_remote;
@@ -726,25 +729,24 @@ qed_dcbx_get_remote_lldp_params(struct qed_hwfn *p_hwfn,
726729
}
727730

728731
static int
729-
qed_dcbx_get_params(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
730-
struct qed_dcbx_get *p_params,
732+
qed_dcbx_get_params(struct qed_hwfn *p_hwfn, struct qed_dcbx_get *p_params,
731733
enum qed_mib_read_type type)
732734
{
733735
switch (type) {
734736
case QED_DCBX_REMOTE_MIB:
735-
qed_dcbx_get_remote_params(p_hwfn, p_ptt, p_params);
737+
qed_dcbx_get_remote_params(p_hwfn, p_params);
736738
break;
737739
case QED_DCBX_LOCAL_MIB:
738-
qed_dcbx_get_local_params(p_hwfn, p_ptt, p_params);
740+
qed_dcbx_get_local_params(p_hwfn, p_params);
739741
break;
740742
case QED_DCBX_OPERATIONAL_MIB:
741-
qed_dcbx_get_operational_params(p_hwfn, p_ptt, p_params);
743+
qed_dcbx_get_operational_params(p_hwfn, p_params);
742744
break;
743745
case QED_DCBX_REMOTE_LLDP_MIB:
744-
qed_dcbx_get_remote_lldp_params(p_hwfn, p_ptt, p_params);
746+
qed_dcbx_get_remote_lldp_params(p_hwfn, p_params);
745747
break;
746748
case QED_DCBX_LOCAL_LLDP_MIB:
747-
qed_dcbx_get_local_lldp_params(p_hwfn, p_ptt, p_params);
749+
qed_dcbx_get_local_lldp_params(p_hwfn, p_params);
748750
break;
749751
default:
750752
DP_ERR(p_hwfn, "MIB read err, unknown mib type %d\n", type);
@@ -902,25 +904,23 @@ qed_dcbx_mib_update_event(struct qed_hwfn *p_hwfn,
902904
qed_sp_pf_update(p_hwfn);
903905
}
904906
}
905-
qed_dcbx_get_params(p_hwfn, p_ptt, &p_hwfn->p_dcbx_info->get, type);
907+
908+
qed_dcbx_get_params(p_hwfn, &p_hwfn->p_dcbx_info->get, type);
906909
qed_dcbx_aen(p_hwfn, type);
907910

908911
return rc;
909912
}
910913

911914
int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn)
912915
{
913-
int rc = 0;
914-
915916
p_hwfn->p_dcbx_info = kzalloc(sizeof(*p_hwfn->p_dcbx_info), GFP_KERNEL);
916917
if (!p_hwfn->p_dcbx_info)
917-
rc = -ENOMEM;
918+
return -ENOMEM;
918919

919-
return rc;
920+
return 0;
920921
}
921922

922-
void qed_dcbx_info_free(struct qed_hwfn *p_hwfn,
923-
struct qed_dcbx_info *p_dcbx_info)
923+
void qed_dcbx_info_free(struct qed_hwfn *p_hwfn)
924924
{
925925
kfree(p_hwfn->p_dcbx_info);
926926
}
@@ -959,14 +959,9 @@ void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
959959
p_dcb_data = &p_dest->fcoe_dcb_data;
960960
qed_dcbx_update_protocol_data(p_dcb_data, p_src, DCBX_PROTOCOL_FCOE);
961961
p_dcb_data = &p_dest->roce_dcb_data;
962-
963-
if (p_src->arr[DCBX_PROTOCOL_ROCE].update)
964-
qed_dcbx_update_protocol_data(p_dcb_data, p_src,
965-
DCBX_PROTOCOL_ROCE);
966-
if (p_src->arr[DCBX_PROTOCOL_ROCE_V2].update)
967-
qed_dcbx_update_protocol_data(p_dcb_data, p_src,
968-
DCBX_PROTOCOL_ROCE_V2);
969-
962+
qed_dcbx_update_protocol_data(p_dcb_data, p_src, DCBX_PROTOCOL_ROCE);
963+
p_dcb_data = &p_dest->rroce_dcb_data;
964+
qed_dcbx_update_protocol_data(p_dcb_data, p_src, DCBX_PROTOCOL_ROCE_V2);
970965
p_dcb_data = &p_dest->iscsi_dcb_data;
971966
qed_dcbx_update_protocol_data(p_dcb_data, p_src, DCBX_PROTOCOL_ISCSI);
972967
p_dcb_data = &p_dest->eth_dcb_data;
@@ -992,7 +987,7 @@ static int qed_dcbx_query_params(struct qed_hwfn *p_hwfn,
992987
if (rc)
993988
goto out;
994989

995-
rc = qed_dcbx_get_params(p_hwfn, p_ptt, p_get, type);
990+
rc = qed_dcbx_get_params(p_hwfn, p_get, type);
996991

997992
out:
998993
qed_ptt_release(p_hwfn, p_ptt);
@@ -1167,6 +1162,9 @@ qed_dcbx_set_local_params(struct qed_hwfn *p_hwfn,
11671162
local_admin->config = DCBX_CONFIG_VERSION_DISABLED;
11681163
}
11691164

1165+
DP_VERBOSE(p_hwfn, QED_MSG_DCB, "Dcbx version = %d\n",
1166+
local_admin->config);
1167+
11701168
if (params->override_flags & QED_DCBX_OVERRIDE_PFC_CFG)
11711169
qed_dcbx_set_pfc_data(p_hwfn, &local_admin->features.pfc,
11721170
&params->config.params);
@@ -1243,6 +1241,8 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
12431241
p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_CEE;
12441242
if (dcbx_info->operational.ieee)
12451243
p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_IEEE;
1244+
if (dcbx_info->operational.local)
1245+
p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_STATIC;
12461246

12471247
p_hwfn->p_dcbx_info->set.enabled = dcbx_info->operational.enabled;
12481248
memcpy(&p_hwfn->p_dcbx_info->set.config.params,
@@ -1792,8 +1792,9 @@ static u8 qed_dcbnl_setdcbx(struct qed_dev *cdev, u8 mode)
17921792

17931793
DP_VERBOSE(hwfn, QED_MSG_DCB, "new mode = %x\n", mode);
17941794

1795-
if (!(mode & DCB_CAP_DCBX_VER_IEEE) && !(mode & DCB_CAP_DCBX_VER_CEE)) {
1796-
DP_INFO(hwfn, "Allowed mode is cee, ieee or both\n");
1795+
if (!(mode & DCB_CAP_DCBX_VER_IEEE) &&
1796+
!(mode & DCB_CAP_DCBX_VER_CEE) && !(mode & DCB_CAP_DCBX_STATIC)) {
1797+
DP_INFO(hwfn, "Allowed modes are cee, ieee or static\n");
17971798
return 1;
17981799
}
17991800

@@ -1813,6 +1814,11 @@ static u8 qed_dcbnl_setdcbx(struct qed_dev *cdev, u8 mode)
18131814
dcbx_set.enabled = true;
18141815
}
18151816

1817+
if (mode & DCB_CAP_DCBX_STATIC) {
1818+
dcbx_set.ver_num |= DCBX_CONFIG_VERSION_STATIC;
1819+
dcbx_set.enabled = true;
1820+
}
1821+
18161822
ptt = qed_ptt_acquire(hwfn);
18171823
if (!ptt)
18181824
return 1;
@@ -1821,7 +1827,7 @@ static u8 qed_dcbnl_setdcbx(struct qed_dev *cdev, u8 mode)
18211827

18221828
qed_ptt_release(hwfn, ptt);
18231829

1824-
return 0;
1830+
return rc;
18251831
}
18261832

18271833
static u8 qed_dcbnl_getfeatcfg(struct qed_dev *cdev, int featid, u8 *flags)
@@ -2200,15 +2206,46 @@ qed_dcbnl_ieee_peer_getpfc(struct qed_dev *cdev, struct ieee_pfc *pfc)
22002206
return qed_dcbnl_get_ieee_pfc(cdev, pfc, true);
22012207
}
22022208

2209+
static int qed_get_sf_ieee_value(u8 selector, u8 *sf_ieee)
2210+
{
2211+
switch (selector) {
2212+
case IEEE_8021QAZ_APP_SEL_ETHERTYPE:
2213+
*sf_ieee = QED_DCBX_SF_IEEE_ETHTYPE;
2214+
break;
2215+
case IEEE_8021QAZ_APP_SEL_STREAM:
2216+
*sf_ieee = QED_DCBX_SF_IEEE_TCP_PORT;
2217+
break;
2218+
case IEEE_8021QAZ_APP_SEL_DGRAM:
2219+
*sf_ieee = QED_DCBX_SF_IEEE_UDP_PORT;
2220+
break;
2221+
case IEEE_8021QAZ_APP_SEL_ANY:
2222+
*sf_ieee = QED_DCBX_SF_IEEE_TCP_UDP_PORT;
2223+
break;
2224+
default:
2225+
return -EINVAL;
2226+
}
2227+
2228+
return 0;
2229+
}
2230+
22032231
static int qed_dcbnl_ieee_getapp(struct qed_dev *cdev, struct dcb_app *app)
22042232
{
22052233
struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
22062234
struct qed_dcbx_get *dcbx_info;
22072235
struct qed_app_entry *entry;
2208-
bool ethtype;
22092236
u8 prio = 0;
2237+
u8 sf_ieee;
22102238
int i;
22112239

2240+
DP_VERBOSE(hwfn, QED_MSG_DCB, "selector = %d protocol = %d\n",
2241+
app->selector, app->protocol);
2242+
2243+
if (qed_get_sf_ieee_value(app->selector, &sf_ieee)) {
2244+
DP_INFO(cdev, "Invalid selector field value %d\n",
2245+
app->selector);
2246+
return -EINVAL;
2247+
}
2248+
22122249
dcbx_info = qed_dcbnl_get_dcbx(hwfn, QED_DCBX_OPERATIONAL_MIB);
22132250
if (!dcbx_info)
22142251
return -EINVAL;
@@ -2219,11 +2256,9 @@ static int qed_dcbnl_ieee_getapp(struct qed_dev *cdev, struct dcb_app *app)
22192256
return -EINVAL;
22202257
}
22212258

2222-
/* ieee defines the selector field value for ethertype to be 1 */
2223-
ethtype = !!((app->selector - 1) == DCB_APP_IDTYPE_ETHTYPE);
22242259
for (i = 0; i < QED_DCBX_MAX_APP_PROTOCOL; i++) {
22252260
entry = &dcbx_info->operational.params.app_entry[i];
2226-
if ((entry->ethtype == ethtype) &&
2261+
if ((entry->sf_ieee == sf_ieee) &&
22272262
(entry->proto_id == app->protocol)) {
22282263
prio = entry->prio;
22292264
break;
@@ -2251,14 +2286,22 @@ static int qed_dcbnl_ieee_setapp(struct qed_dev *cdev, struct dcb_app *app)
22512286
struct qed_dcbx_set dcbx_set;
22522287
struct qed_app_entry *entry;
22532288
struct qed_ptt *ptt;
2254-
bool ethtype;
2289+
u8 sf_ieee;
22552290
int rc, i;
22562291

2292+
DP_VERBOSE(hwfn, QED_MSG_DCB, "selector = %d protocol = %d pri = %d\n",
2293+
app->selector, app->protocol, app->priority);
22572294
if (app->priority < 0 || app->priority >= QED_MAX_PFC_PRIORITIES) {
22582295
DP_INFO(hwfn, "Invalid priority %d\n", app->priority);
22592296
return -EINVAL;
22602297
}
22612298

2299+
if (qed_get_sf_ieee_value(app->selector, &sf_ieee)) {
2300+
DP_INFO(cdev, "Invalid selector field value %d\n",
2301+
app->selector);
2302+
return -EINVAL;
2303+
}
2304+
22622305
dcbx_info = qed_dcbnl_get_dcbx(hwfn, QED_DCBX_OPERATIONAL_MIB);
22632306
if (!dcbx_info)
22642307
return -EINVAL;
@@ -2276,11 +2319,9 @@ static int qed_dcbnl_ieee_setapp(struct qed_dev *cdev, struct dcb_app *app)
22762319
if (rc)
22772320
return -EINVAL;
22782321

2279-
/* ieee defines the selector field value for ethertype to be 1 */
2280-
ethtype = !!((app->selector - 1) == DCB_APP_IDTYPE_ETHTYPE);
22812322
for (i = 0; i < QED_DCBX_MAX_APP_PROTOCOL; i++) {
22822323
entry = &dcbx_set.config.params.app_entry[i];
2283-
if ((entry->ethtype == ethtype) &&
2324+
if ((entry->sf_ieee == sf_ieee) &&
22842325
(entry->proto_id == app->protocol))
22852326
break;
22862327
/* First empty slot */
@@ -2296,7 +2337,7 @@ static int qed_dcbnl_ieee_setapp(struct qed_dev *cdev, struct dcb_app *app)
22962337
}
22972338

22982339
dcbx_set.override_flags |= QED_DCBX_OVERRIDE_APP_CFG;
2299-
dcbx_set.config.params.app_entry[i].ethtype = ethtype;
2340+
dcbx_set.config.params.app_entry[i].sf_ieee = sf_ieee;
23002341
dcbx_set.config.params.app_entry[i].proto_id = app->protocol;
23012342
dcbx_set.config.params.app_entry[i].prio = BIT(app->priority);
23022343

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ qed_dcbx_mib_update_event(struct qed_hwfn *,
119119
struct qed_ptt *, enum qed_mib_read_type);
120120

121121
int qed_dcbx_info_alloc(struct qed_hwfn *p_hwfn);
122-
void qed_dcbx_info_free(struct qed_hwfn *, struct qed_dcbx_info *);
122+
void qed_dcbx_info_free(struct qed_hwfn *p_hwfn);
123123
void qed_dcbx_set_pf_update_params(struct qed_dcbx_results *p_src,
124124
struct pf_update_ramrod_data *p_dest);
125125

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void qed_resc_free(struct qed_dev *cdev)
183183
}
184184
qed_iov_free(p_hwfn);
185185
qed_dmae_info_free(p_hwfn);
186-
qed_dcbx_info_free(p_hwfn, p_hwfn->p_dcbx_info);
186+
qed_dcbx_info_free(p_hwfn);
187187
}
188188
}
189189

drivers/net/ethernet/qlogic/qede/qede_dcbnl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,11 @@ static int qede_dcbnl_ieee_setapp(struct net_device *netdev,
281281
struct dcb_app *app)
282282
{
283283
struct qede_dev *edev = netdev_priv(netdev);
284+
int err;
285+
286+
err = dcb_ieee_setapp(netdev, app);
287+
if (err)
288+
return err;
284289

285290
return edev->ops->dcb->ieee_setapp(edev->cdev, app);
286291
}

include/linux/qed/qed_if.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ struct qed_dcbx_operational_params {
144144
bool enabled;
145145
bool ieee;
146146
bool cee;
147+
bool local;
147148
u32 err;
148149
};
149150

0 commit comments

Comments
 (0)