Adjusted the code as suggested, and applied to master~ ! Thx very much for the help and explanation throughout the time,
Alex Wang, On Mon, Apr 14, 2014 at 10:24 PM, Pravin Shelar <pshe...@nicira.com> wrote: > On Tue, Apr 15, 2014 at 6:42 AM, Alex Wang <al...@nicira.com> wrote: > > In order to allow handlers directly read upcalls from datapath, > > we need to support per-handler netlink socket for each vport in > > datapath. This commit makes this happen. Also, it is guaranteed > > backward and forward compatibility with previous branch. > > > > Signed-off-by: Alex Wang <al...@nicira.com> > > Acked-by: Thomas Graf <tg...@redhat.com> > > > > --- > > V7 -> V8: > > - declare "u32 *ids" as "u32 ids[]" to save space and pointer > indirection. > > - use rcu_dereference() when the dereference only happens within the > > rcu read-side critical section. > > - fix the comments. > > > > V6 -> V7: > > - rebase. > > > > V5 -> V6: > > - '__force' cast 'struct vport_portids *' in ovs_vport_free(). > > > > V4 -> V5: > > - use nla_memcpy() instead of memcpy(). > > - move 'struct rcu_head' back in the 'struct vport_portids' > > for cacheline efficiency. > > > > V3 -> V4: > > - define the type of OVS_VPORT_ATTR_UPCALL_PID to NLA_U32. > > - add check of the OVS_VPORT_ATTR_UPCALL_PID in attr array in > > ovs_vport_cmd_set(). > > - use reciprocal_div() in the modular computation, to reduce the > > overhead. > > > > V2 -> V3: > > - use OVS_DP_ATTR_USER_FEATURES to control the type of > > OVS_VPORT_ATTR_UPCALL_PID attribute returned by the > ovs_vport_cmd_get(). > > - directly free the 'vport->upcall_portids' in ovs_vport_free(). > > - add check to guarantee pids array length is always positive. > > > > PATCH -> V2: > > - rebase. > > > > major changes since RFC: > > - guarantee the compatibility with branch-2.1 userspace. > > - use rcu to protect upcall port_id array multi-access. > > - use skb_get_rxhash() to select the port id to send upcall. > .... > > > diff --git a/datapath/vport.h b/datapath/vport.h > > index 18b723e..09ecf7c 100644 > > --- a/datapath/vport.h > > +++ b/datapath/vport.h > > @@ -23,6 +23,7 @@ > > #include <linux/list.h> > > #include <linux/netlink.h> > > #include <linux/openvswitch.h> > > +#include <linux/reciprocal_div.h> > > #include <linux/skbuff.h> > > #include <linux/spinlock.h> > > #include <linux/u64_stats_sync.h> > > @@ -50,6 +51,11 @@ void ovs_vport_get_stats(struct vport *, struct > ovs_vport_stats *); > > int ovs_vport_set_options(struct vport *, struct nlattr *options); > > int ovs_vport_get_options(const struct vport *, struct sk_buff *); > > > > +int ovs_vport_set_upcall_portids(struct vport *, struct nlattr *pids); > > +int ovs_vport_get_upcall_portids(const struct vport *, struct sk_buff > *); > > + > extra blank line. > > +u32 ovs_vport_find_portid(const struct vport *, struct sk_buff *); > > + > Lets rename to make the consistent. > s/ovs_vport_find_portid/ovs_vport_find_upcall_portid > > > int ovs_vport_send(struct vport *, struct sk_buff *); > > > > /* The following definitions are for implementers of vport devices: */ > > @@ -60,13 +66,27 @@ struct vport_err_stats { > > u64 tx_dropped; > > u64 tx_errors; > > }; > > Looks good to me. > Acked-by: Pravin B Shelar <pshe...@nicira.com> > > Thanks. >
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev