Thanks Jarno, will create a v2. Antonio > -----Original Message----- > From: Jarno Rajahalme [mailto:ja...@ovn.org] > Sent: Wednesday, January 4, 2017 9:43 PM > To: Fischetti, Antonio <antonio.fische...@intel.com> > Cc: d...@openvswitch.org; Bodireddy, Bhanuprakash > <bhanuprakash.bodire...@intel.com> > Subject: Re: [PATCH] dpcls: Avoid one 8-byte chunk in subtable mask. > > > > On Jan 4, 2017, at 6:41 AM, antonio.fische...@intel.com wrote: > > > > This patch allows to skip the chunk comprising of dp_hash and in_port > > in the subtable mask when the packet is not recirculated. This will > > slightly speed up the hash computation as one expensive function call > > to hash_add64() can be skipped. > > For each new netdev flow we wildcard in_port in the mask, so in the > > physical case where dp_hash is also wildcarded, the resulting 8-byte > > chunk will not be part of the subtable mask. > > > > The idea behind is that all the packets within a given dpcls will > > have the same in_port value and typically dp_hash == 0. So they will > > have the same 8-bytes chunk in their {dp_hash, in_port} portion of the > > miniflow. This doesn't contribute effectively in spreading hash values > > and avoiding collisions. > > > > Signed-off-by: Antonio Fischetti <antonio.fische...@intel.com> > > Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com> > > Co-authored-by: Bhanuprakash Bodireddy > <bhanuprakash.bodire...@intel.com> > > Signed-off-by: Jarno Rajahalme <ja...@ovn.org> > > Co-authored-by: Jarno Rajahalme <ja...@ovn.org> > > --- > > lib/dpif-netdev.c | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c > > index 1a47a45..a808f4b 100644 > > --- a/lib/dpif-netdev.c > > +++ b/lib/dpif-netdev.c > > @@ -2277,8 +2277,20 @@ dp_netdev_flow_add(struct dp_netdev_pmd_thread > *pmd, > > struct netdev_flow_key mask; > > struct dpcls *cls; > > odp_port_t in_port = match->flow.in_port.odp_port; > > - > > + uint32_t old_odp_port; > > + > > + /* As we select the dpcls based on the port number, each netdev > flow > > + * belonging to the same dpcls will have the same odp_port value. > > + * For performance reasons here we wildcard odp_port in the mask. > In the > > + * physical case where dp_hash is also wildcarded, the resulting 8- > byte > > + * chunk {dp_hash, in_port} will be ignored by > netdev_flow_mask_init() and > > + * will not be part of the subtable mask. > > + * This will speed up the hash computation during dpcls_lookup() > because > > + * one call to hash_add64() will be skipped. */ > > + old_odp_port = match->wc.masks.in_port.odp_port; > > > Please move this line further down in the function here and do not save > the old value: > > ovs_assert(match->wc.masks.in_port.odp_port == ODPP_NONE); > > > + match->wc.masks.in_port.odp_port = 0; > > netdev_flow_mask_init(&mask, match); > > + match->wc.masks.in_port.odp_port = old_odp_port; > > And do this instead: > > match->wc.masks.in_port.odp_port = ODPP_NONE; > > > /* Make sure wc does not have metadata. */ > > ovs_assert(!FLOWMAP_HAS_FIELD(&mask.mf.map, metadata) > > && !FLOWMAP_HAS_FIELD(&mask.mf.map, regs)); > > -- > > 2.4.11 > >
_______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev