From: John Fastabend <john.fastabend@gmail.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>,
jiri@resnulli.us, amir@vadai.me, davem@davemloft.net
Cc: netdev@vger.kernel.org, jeffrey.t.kirsher@intel.com
Subject: Re: [net-next PATCH v3 3/8] net: sched: add cls_u32 offload hooks for netdevs
Date: Wed, 17 Feb 2016 06:24:21 -0800 [thread overview]
Message-ID: <56C48295.9030806@gmail.com> (raw)
In-Reply-To: <56C4528E.5090505@mojatatu.com>
On 16-02-17 02:59 AM, Jamal Hadi Salim wrote:
> On 16-02-17 12:17 AM, John Fastabend wrote:
>> This patch allows netdev drivers to consume cls_u32 offloads via
>> the ndo_setup_tc ndo op.
>>
>> This works aligns with how network drivers have been doing qdisc
>> offloads for mqprio.
>>
>
> This one i have comments on.
>
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>> ---
>> include/linux/netdevice.h | 6 ++-
>> include/net/pkt_cls.h | 34 +++++++++++++++
>> net/sched/cls_u32.c | 99
>> ++++++++++++++++++++++++++++++++++++++++++++-
[...]
>> #endif /* CONFIG_NET_CLS_IND */
>>
>> +struct tc_cls_u32_knode {
>> + struct tcf_exts *exts;
>> + u8 fshift;
>> + u32 handle;
>> + u32 val;
>> + u32 mask;
>> + u32 link_handle;
>> + struct tc_u32_sel *sel;
>> +};
>>
>
> Swapping sel and fshift would give better struct alignment.
>
Makes sense I went ahead and did this.
>> +struct tc_cls_u32_hnode {
>> + u32 handle;
>> + u32 prio;
>> + unsigned int divisor;
>> +};
>
>
> Assuming in the future "prio" would be moved to something that is more
> generic classifier specific?
>
Sure in the future it can be moved up into a generic struct if
it becomes useful there.
>> +enum tc_clsu32_command {
>> + TC_CLSU32_NEW_KNODE,
>> + TC_CLSU32_REPLACE_KNODE,
>> + TC_CLSU32_DELETE_KNODE,
>> + TC_CLSU32_NEW_HNODE,
>> + TC_CLSU32_REPLACE_HNODE,
>> + TC_CLSU32_DELETE_HNODE,
>> +};
>> +
>
> It seems to me commands should be generic which speak
> Netlinkism. A REPLACE is just a flag to NEW. You dont need
> a NEW_XXX for every object. switchdev got this right.
> If you use cmd + flags then you can have all kinds of
> netlink semantics that relay user intent from user space. Example:
> Exclusivity where user says "create if it doesnt exist but dont replace
> if it does".
> At minimal add "flags" there.
> Maybe not this release - but it makes sense to move "command" into
> tc_to_netdev; a u16 cmd + u16 flags.
>
Yep next set of patches add the specific hw/sw/both semantics
and specific error handling strategies. For this series we just
get the simplest one.
>> +struct tc_cls_u32_offload {
>> + /* knode values */
>> + enum tc_clsu32_command command;
>> + union {
>> + struct tc_cls_u32_knode knode;
>> + struct tc_cls_u32_hnode hnode;
>> + };
>> +};
>> +
>> #endif
>> diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
>> index 4fbb674..d54bc94 100644
>
>> +static void u32_replace_hw_hnode(struct tcf_proto *tp, struct
>> tc_u_hnode *h)
>> +{
>> + struct net_device *dev = tp->q->dev_queue->dev;
>> + struct tc_cls_u32_offload u32_offload = {0};
>> + struct tc_to_netdev offload;
>> +
>> + offload.type = TC_SETUP_CLSU32;
>> + offload.cls_u32 = &u32_offload;
>> +
>> + if (dev->netdev_ops->ndo_setup_tc) {
>> + offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
>
> TC_CLSU32_REPLACE_HNODE?
>
Yep I made this change and will send out v4.
[...]
>
>
> You are unconditionally calling the _hw_ api. For someone not using _hw_
> offloads, there are a few more instructions. Maybe just do the
> dev->netdev_ops->ndo_setup_tc first?
>
My simple add/rem stress test didn't seem to make any difference.
I think there is so much other stuff going on here this is in the
noise. I'll take a pass at optimizing this later for all
cases not just the hw loading ones.
>
> And to Or's point: How do i distinguish s/w from h/w?
Next series handles this for now just enable the simplest case.
>
> cheers,
> jamal
>
next prev parent reply other threads:[~2016-02-17 14:24 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 5:15 [net-next PATCH v3 0/8] tc offload for cls_u32 on ixgbe John Fastabend
2016-02-17 5:16 ` [net-next PATCH v3 1/8] net: rework ndo tc op to consume additional qdisc handle parameter John Fastabend
2016-02-17 10:42 ` Jamal Hadi Salim
2016-02-17 5:16 ` [net-next PATCH v3 2/8] net: rework setup_tc ndo op to consume general tc operand John Fastabend
2016-02-17 10:42 ` Jamal Hadi Salim
2016-02-17 5:17 ` [net-next PATCH v3 3/8] net: sched: add cls_u32 offload hooks for netdevs John Fastabend
2016-02-17 7:02 ` Jiri Pirko
2016-02-17 10:59 ` Jamal Hadi Salim
2016-02-17 14:24 ` John Fastabend [this message]
2016-02-17 23:07 ` John Fastabend
2016-02-18 9:23 ` Amir Vadai"
2016-02-19 3:37 ` Simon Horman
2016-02-19 8:16 ` Or Gerlitz
2016-02-18 12:14 ` Jamal Hadi Salim
2016-02-18 15:24 ` John Fastabend
2016-02-19 12:52 ` Jamal Hadi Salim
2016-02-17 5:17 ` [net-next PATCH v3 4/8] net: add tc offload feature flag John Fastabend
2016-02-17 11:01 ` Jamal Hadi Salim
2016-02-17 5:18 ` [net-next PATCH v3 5/8] net: tc: helper functions to query action types John Fastabend
2016-02-17 7:03 ` Jiri Pirko
2016-02-17 11:02 ` Jamal Hadi Salim
2016-02-17 5:18 ` [net-next PATCH v3 6/8] net: ixgbe: add minimal parser details for ixgbe John Fastabend
2016-02-17 11:06 ` Jamal Hadi Salim
2016-02-17 15:09 ` David Miller
2016-02-17 15:14 ` John Fastabend
2016-02-17 18:01 ` Rustad, Mark D
2016-02-17 22:34 ` John Fastabend
2016-02-17 5:18 ` [net-next PATCH v3 7/8] net: ixgbe: add support for tc_u32 offload John Fastabend
2016-02-17 11:17 ` Jamal Hadi Salim
2016-02-17 11:42 ` Jiri Pirko
2016-02-17 11:47 ` Jamal Hadi Salim
2016-02-17 14:25 ` John Fastabend
2016-02-17 5:19 ` [net-next PATCH v3 8/8] net: ixgbe: abort with cls u32 divisor groups greater than 1 John Fastabend
2016-02-17 14:48 ` [net-next PATCH v3 0/8] tc offload for cls_u32 on ixgbe David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C48295.9030806@gmail.com \
--to=john.fastabend@gmail.com \
--cc=amir@vadai.me \
--cc=davem@davemloft.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).