Skip to content

Commit 064d5e6

Browse files
committed
Merge branch 'u32-hwoffload-fixes'
Jakub Kicinski says: ==================== cls_u32 hardware offload fixes This set fixes two small issues with error codes I noticed in cls_u32. Second patch could be viewed as user space API change but that portion of API is not part of any release, yet. Compile tested only. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 7b01b8e + d47a0f3 commit 064d5e6

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

net/sched/cls_u32.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -457,20 +457,21 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp,
457457
struct tc_to_netdev offload;
458458
int err;
459459

460+
if (!tc_should_offload(dev, flags))
461+
return tc_skip_sw(flags) ? -EINVAL : 0;
462+
460463
offload.type = TC_SETUP_CLSU32;
461464
offload.cls_u32 = &u32_offload;
462465

463-
if (tc_should_offload(dev, flags)) {
464-
offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
465-
offload.cls_u32->hnode.divisor = h->divisor;
466-
offload.cls_u32->hnode.handle = h->handle;
467-
offload.cls_u32->hnode.prio = h->prio;
466+
offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
467+
offload.cls_u32->hnode.divisor = h->divisor;
468+
offload.cls_u32->hnode.handle = h->handle;
469+
offload.cls_u32->hnode.prio = h->prio;
468470

469-
err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
470-
tp->protocol, &offload);
471-
if (tc_skip_sw(flags))
472-
return err;
473-
}
471+
err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
472+
tp->protocol, &offload);
473+
if (tc_skip_sw(flags))
474+
return err;
474475

475476
return 0;
476477
}
@@ -863,7 +864,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
863864
if (tb[TCA_U32_FLAGS]) {
864865
flags = nla_get_u32(tb[TCA_U32_FLAGS]);
865866
if (!tc_flags_valid(flags))
866-
return err;
867+
return -EINVAL;
867868
}
868869

869870
n = (struct tc_u_knode *)*arg;

0 commit comments

Comments
 (0)