@@ -2192,15 +2192,46 @@ qed_dcbnl_ieee_peer_getpfc(struct qed_dev *cdev, struct ieee_pfc *pfc)
2192
2192
return qed_dcbnl_get_ieee_pfc (cdev , pfc , true);
2193
2193
}
2194
2194
2195
+ static int qed_get_sf_ieee_value (u8 selector , u8 * sf_ieee )
2196
+ {
2197
+ switch (selector ) {
2198
+ case IEEE_8021QAZ_APP_SEL_ETHERTYPE :
2199
+ * sf_ieee = QED_DCBX_SF_IEEE_ETHTYPE ;
2200
+ break ;
2201
+ case IEEE_8021QAZ_APP_SEL_STREAM :
2202
+ * sf_ieee = QED_DCBX_SF_IEEE_TCP_PORT ;
2203
+ break ;
2204
+ case IEEE_8021QAZ_APP_SEL_DGRAM :
2205
+ * sf_ieee = QED_DCBX_SF_IEEE_UDP_PORT ;
2206
+ break ;
2207
+ case IEEE_8021QAZ_APP_SEL_ANY :
2208
+ * sf_ieee = QED_DCBX_SF_IEEE_TCP_UDP_PORT ;
2209
+ break ;
2210
+ default :
2211
+ return - EINVAL ;
2212
+ }
2213
+
2214
+ return 0 ;
2215
+ }
2216
+
2195
2217
static int qed_dcbnl_ieee_getapp (struct qed_dev * cdev , struct dcb_app * app )
2196
2218
{
2197
2219
struct qed_hwfn * hwfn = QED_LEADING_HWFN (cdev );
2198
2220
struct qed_dcbx_get * dcbx_info ;
2199
2221
struct qed_app_entry * entry ;
2200
- bool ethtype ;
2201
2222
u8 prio = 0 ;
2223
+ u8 sf_ieee ;
2202
2224
int i ;
2203
2225
2226
+ DP_VERBOSE (hwfn , QED_MSG_DCB , "selector = %d protocol = %d\n" ,
2227
+ app -> selector , app -> protocol );
2228
+
2229
+ if (qed_get_sf_ieee_value (app -> selector , & sf_ieee )) {
2230
+ DP_INFO (cdev , "Invalid selector field value %d\n" ,
2231
+ app -> selector );
2232
+ return - EINVAL ;
2233
+ }
2234
+
2204
2235
dcbx_info = qed_dcbnl_get_dcbx (hwfn , QED_DCBX_OPERATIONAL_MIB );
2205
2236
if (!dcbx_info )
2206
2237
return - EINVAL ;
@@ -2211,11 +2242,9 @@ static int qed_dcbnl_ieee_getapp(struct qed_dev *cdev, struct dcb_app *app)
2211
2242
return - EINVAL ;
2212
2243
}
2213
2244
2214
- /* ieee defines the selector field value for ethertype to be 1 */
2215
- ethtype = !!((app -> selector - 1 ) == DCB_APP_IDTYPE_ETHTYPE );
2216
2245
for (i = 0 ; i < QED_DCBX_MAX_APP_PROTOCOL ; i ++ ) {
2217
2246
entry = & dcbx_info -> operational .params .app_entry [i ];
2218
- if ((entry -> ethtype == ethtype ) &&
2247
+ if ((entry -> sf_ieee == sf_ieee ) &&
2219
2248
(entry -> proto_id == app -> protocol )) {
2220
2249
prio = entry -> prio ;
2221
2250
break ;
@@ -2243,14 +2272,22 @@ static int qed_dcbnl_ieee_setapp(struct qed_dev *cdev, struct dcb_app *app)
2243
2272
struct qed_dcbx_set dcbx_set ;
2244
2273
struct qed_app_entry * entry ;
2245
2274
struct qed_ptt * ptt ;
2246
- bool ethtype ;
2275
+ u8 sf_ieee ;
2247
2276
int rc , i ;
2248
2277
2278
+ DP_VERBOSE (hwfn , QED_MSG_DCB , "selector = %d protocol = %d pri = %d\n" ,
2279
+ app -> selector , app -> protocol , app -> priority );
2249
2280
if (app -> priority < 0 || app -> priority >= QED_MAX_PFC_PRIORITIES ) {
2250
2281
DP_INFO (hwfn , "Invalid priority %d\n" , app -> priority );
2251
2282
return - EINVAL ;
2252
2283
}
2253
2284
2285
+ if (qed_get_sf_ieee_value (app -> selector , & sf_ieee )) {
2286
+ DP_INFO (cdev , "Invalid selector field value %d\n" ,
2287
+ app -> selector );
2288
+ return - EINVAL ;
2289
+ }
2290
+
2254
2291
dcbx_info = qed_dcbnl_get_dcbx (hwfn , QED_DCBX_OPERATIONAL_MIB );
2255
2292
if (!dcbx_info )
2256
2293
return - EINVAL ;
@@ -2268,11 +2305,9 @@ static int qed_dcbnl_ieee_setapp(struct qed_dev *cdev, struct dcb_app *app)
2268
2305
if (rc )
2269
2306
return - EINVAL ;
2270
2307
2271
- /* ieee defines the selector field value for ethertype to be 1 */
2272
- ethtype = !!((app -> selector - 1 ) == DCB_APP_IDTYPE_ETHTYPE );
2273
2308
for (i = 0 ; i < QED_DCBX_MAX_APP_PROTOCOL ; i ++ ) {
2274
2309
entry = & dcbx_set .config .params .app_entry [i ];
2275
- if ((entry -> ethtype == ethtype ) &&
2310
+ if ((entry -> sf_ieee == sf_ieee ) &&
2276
2311
(entry -> proto_id == app -> protocol ))
2277
2312
break ;
2278
2313
/* First empty slot */
@@ -2288,7 +2323,7 @@ static int qed_dcbnl_ieee_setapp(struct qed_dev *cdev, struct dcb_app *app)
2288
2323
}
2289
2324
2290
2325
dcbx_set .override_flags |= QED_DCBX_OVERRIDE_APP_CFG ;
2291
- dcbx_set .config .params .app_entry [i ].ethtype = ethtype ;
2326
+ dcbx_set .config .params .app_entry [i ].sf_ieee = sf_ieee ;
2292
2327
dcbx_set .config .params .app_entry [i ].proto_id = app -> protocol ;
2293
2328
dcbx_set .config .params .app_entry [i ].prio = BIT (app -> priority );
2294
2329
0 commit comments