Skip to content

Commit 3107fdc

Browse files
Jakub Kicinskidavem330
authored andcommitted
nfp: use tc_cls_can_offload_and_chain0()
Make use of tc_cls_can_offload_and_chain0() to set extack msg in case ethtool tc offload flag is not set or chain unsupported. Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a2b212a commit 3107fdc

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

drivers/net/ethernet/netronome/nfp/bpf/main.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,
130130
"only offload of BPF classifiers supported");
131131
return -EOPNOTSUPP;
132132
}
133-
if (!tc_can_offload_extack(nn->dp.netdev, cls_bpf->common.extack))
133+
if (!tc_cls_can_offload_and_chain0(nn->dp.netdev, &cls_bpf->common))
134134
return -EOPNOTSUPP;
135135
if (!nfp_net_ebpf_capable(nn)) {
136136
NL_SET_ERR_MSG_MOD(cls_bpf->common.extack,
@@ -142,8 +142,6 @@ static int nfp_bpf_setup_tc_block_cb(enum tc_setup_type type,
142142
"only ETH_P_ALL supported as filter protocol");
143143
return -EOPNOTSUPP;
144144
}
145-
if (cls_bpf->common.chain_index)
146-
return -EOPNOTSUPP;
147145

148146
/* Only support TC direct action */
149147
if (!cls_bpf->exts_integrated ||

drivers/net/ethernet/netronome/nfp/flower/offload.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,7 @@ static int
483483
nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev,
484484
struct tc_cls_flower_offload *flower, bool egress)
485485
{
486-
if (!eth_proto_is_802_3(flower->common.protocol) ||
487-
flower->common.chain_index)
486+
if (!eth_proto_is_802_3(flower->common.protocol))
488487
return -EOPNOTSUPP;
489488

490489
switch (flower->command) {
@@ -504,7 +503,7 @@ int nfp_flower_setup_tc_egress_cb(enum tc_setup_type type, void *type_data,
504503
{
505504
struct nfp_repr *repr = cb_priv;
506505

507-
if (!tc_can_offload(repr->netdev))
506+
if (!tc_cls_can_offload_and_chain0(repr->netdev, type_data))
508507
return -EOPNOTSUPP;
509508

510509
switch (type) {
@@ -521,7 +520,7 @@ static int nfp_flower_setup_tc_block_cb(enum tc_setup_type type,
521520
{
522521
struct nfp_repr *repr = cb_priv;
523522

524-
if (!tc_can_offload(repr->netdev))
523+
if (!tc_cls_can_offload_and_chain0(repr->netdev, type_data))
525524
return -EOPNOTSUPP;
526525

527526
switch (type) {

0 commit comments

Comments
 (0)