On Thu, Jul 21, 2016 at 12:38 AM, Jamal Hadi Salim <j...@mojatatu.com> wrote: > It is an involved change (and i was fond of the container_of() > trickery;)). > > Looking at this patch I cant grok some parts - maybe i need to apply it > when i am not in a hurry to see clearly. > Mostly this around things like: > --- > const struct tc_action *a > struct tcf_mirred *m = to_mirred(a) > --- > > Essentially this reduces to > struct tcf_mirred *m = (struct tcf_mirred *)a > > How would that work?
This works because we always put struct tc_action as the first member of each specific action, e.g. tcf_mirred, struct tcf_mirred { struct tc_action common; int tcfm_eaction; int tcfm_ifindex; int tcfm_ok_push; struct net_device __rcu *tcfm_dev; struct list_head tcfm_list; }; We can put a container_of() if you want to relax this rule, but we already use the same trick in many other places in networking subsystem. ;) > Do we still need the void *priv No, I already removed it in this patch. Thanks.