Skip to content

Commit 5d2fdd8

Browse files
Subbaraya Sundeepdavem330
authored andcommitted
octeontx2-pf: Use NL_SET_ERR_MSG_MOD for TC
This patch modifies all netdev_err messages in tc code to NL_SET_ERR_MSG_MOD. NL_SET_ERR_MSG_MOD does not support format specifiers yet hence netdev_err messages with only strings are modified. Signed-off-by: Subbaraya Sundeep <[email protected]> Signed-off-by: Sunil Kovvuri Goutham <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2ca89a2 commit 5d2fdd8

File tree

1 file changed

+17
-12
lines changed
  • drivers/net/ethernet/marvell/octeontx2/nic

1 file changed

+17
-12
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,15 +223,17 @@ static int otx2_tc_egress_matchall_delete(struct otx2_nic *nic,
223223

224224
static int otx2_tc_parse_actions(struct otx2_nic *nic,
225225
struct flow_action *flow_action,
226-
struct npc_install_flow_req *req)
226+
struct npc_install_flow_req *req,
227+
struct flow_cls_offload *f)
227228
{
229+
struct netlink_ext_ack *extack = f->common.extack;
228230
struct flow_action_entry *act;
229231
struct net_device *target;
230232
struct otx2_nic *priv;
231233
int i;
232234

233235
if (!flow_action_has_entries(flow_action)) {
234-
netdev_info(nic->netdev, "no tc actions specified");
236+
NL_SET_ERR_MSG_MOD(extack, "no tc actions specified");
235237
return -EINVAL;
236238
}
237239

@@ -248,8 +250,8 @@ static int otx2_tc_parse_actions(struct otx2_nic *nic,
248250
priv = netdev_priv(target);
249251
/* npc_install_flow_req doesn't support passing a target pcifunc */
250252
if (rvu_get_pf(nic->pcifunc) != rvu_get_pf(priv->pcifunc)) {
251-
netdev_info(nic->netdev,
252-
"can't redirect to other pf/vf\n");
253+
NL_SET_ERR_MSG_MOD(extack,
254+
"can't redirect to other pf/vf");
253255
return -EOPNOTSUPP;
254256
}
255257
req->vf = priv->pcifunc & RVU_PFVF_FUNC_MASK;
@@ -272,6 +274,7 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic,
272274
struct flow_cls_offload *f,
273275
struct npc_install_flow_req *req)
274276
{
277+
struct netlink_ext_ack *extack = f->common.extack;
275278
struct flow_msg *flow_spec = &req->packet;
276279
struct flow_msg *flow_mask = &req->mask;
277280
struct flow_dissector *dissector;
@@ -336,7 +339,7 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic,
336339

337340
flow_rule_match_eth_addrs(rule, &match);
338341
if (!is_zero_ether_addr(match.mask->src)) {
339-
netdev_err(nic->netdev, "src mac match not supported\n");
342+
NL_SET_ERR_MSG_MOD(extack, "src mac match not supported");
340343
return -EOPNOTSUPP;
341344
}
342345

@@ -354,11 +357,11 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic,
354357
flow_rule_match_ip(rule, &match);
355358
if ((ntohs(flow_spec->etype) != ETH_P_IP) &&
356359
match.mask->tos) {
357-
netdev_err(nic->netdev, "tos not supported\n");
360+
NL_SET_ERR_MSG_MOD(extack, "tos not supported");
358361
return -EOPNOTSUPP;
359362
}
360363
if (match.mask->ttl) {
361-
netdev_err(nic->netdev, "ttl not supported\n");
364+
NL_SET_ERR_MSG_MOD(extack, "ttl not supported");
362365
return -EOPNOTSUPP;
363366
}
364367
flow_spec->tos = match.key->tos;
@@ -414,8 +417,8 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic,
414417

415418
if (ipv6_addr_loopback(&match.key->dst) ||
416419
ipv6_addr_loopback(&match.key->src)) {
417-
netdev_err(nic->netdev,
418-
"Flow matching on IPv6 loopback addr is not supported\n");
420+
NL_SET_ERR_MSG_MOD(extack,
421+
"Flow matching IPv6 loopback addr not supported");
419422
return -EOPNOTSUPP;
420423
}
421424

@@ -464,7 +467,7 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic,
464467
req->features |= BIT_ULL(NPC_SPORT_SCTP);
465468
}
466469

467-
return otx2_tc_parse_actions(nic, &rule->action, req);
470+
return otx2_tc_parse_actions(nic, &rule->action, req, f);
468471
}
469472

470473
static int otx2_del_mcam_flow_entry(struct otx2_nic *nic, u16 entry)
@@ -525,6 +528,7 @@ static int otx2_tc_del_flow(struct otx2_nic *nic,
525528
static int otx2_tc_add_flow(struct otx2_nic *nic,
526529
struct flow_cls_offload *tc_flow_cmd)
527530
{
531+
struct netlink_ext_ack *extack = tc_flow_cmd->common.extack;
528532
struct otx2_tc_info *tc_info = &nic->tc_info;
529533
struct otx2_tc_flow *new_node, *old_node;
530534
struct npc_install_flow_req *req;
@@ -562,7 +566,8 @@ static int otx2_tc_add_flow(struct otx2_nic *nic,
562566
otx2_tc_del_flow(nic, tc_flow_cmd);
563567

564568
if (bitmap_full(tc_info->tc_entries_bitmap, nic->flow_cfg->tc_max_flows)) {
565-
netdev_err(nic->netdev, "Not enough MCAM space to add the flow\n");
569+
NL_SET_ERR_MSG_MOD(extack,
570+
"Not enough MCAM space to add the flow");
566571
otx2_mbox_reset(&nic->mbox.mbox, 0);
567572
mutex_unlock(&nic->mbox.lock);
568573
return -ENOMEM;
@@ -580,7 +585,7 @@ static int otx2_tc_add_flow(struct otx2_nic *nic,
580585
/* Send message to AF */
581586
rc = otx2_sync_mbox_msg(&nic->mbox);
582587
if (rc) {
583-
netdev_err(nic->netdev, "Failed to install MCAM flow entry\n");
588+
NL_SET_ERR_MSG_MOD(extack, "Failed to install MCAM flow entry");
584589
mutex_unlock(&nic->mbox.lock);
585590
goto out;
586591
}

0 commit comments

Comments
 (0)