Thanks Pravin for the review~,
make all-recursive > make[1]: Entering directory `/home/pravin/ovs/openvswitch' > Making all in datapath > make[2]: Entering directory `/home/pravin/ovs/openvswitch/datapath' > Making all in linux > make[3]: Entering directory `/home/pravin/ovs/openvswitch/datapath/linux' > make -C /lib/modules/2.6.32-358.123.2.openstack.el6.x86_64/build/ > M=/home/pravin/ovs/openvswitch/datapath/linux modules > make[4]: Entering directory > `/home/pravin/linux/linux-2.6.32-358.123.2.openstack.el6.x86_64' > CC [M] /home/pravin/ovs/openvswitch/datapath/linux/actions.o > In file included from > /home/pravin/ovs/openvswitch/datapath/linux/../flow.h:33, > from > /home/pravin/ovs/openvswitch/datapath/linux/../datapath.h:30, > from > /home/pravin/ovs/openvswitch/datapath/linux/actions.c:37: > > /home/pravin/ovs/openvswitch/datapath/linux/compat/include/linux/flex_array.h:30: > error: field 'reciprocal_elems' has incomplete type Fixed, > > @@ -94,7 +94,7 @@ struct flex_array *flex_array_alloc(int element_size, > unsigned int total, > > { > > struct flex_array *ret; > > int elems_per_part = 0; > > - int reciprocal_elems = 0; > > + struct reciprocal_value reciprocal_elems = 0; > > int max_size = 0; > > > Use {} to set zero to struct. > Thanks, will use it. > > diff --git a/datapath/linux/compat/include/linux/reciprocal_div.h > b/datapath/linux/compat/include/linux/reciprocal_div.h > > new file mode 100644 > > index 0000000..15d40db > > --- /dev/null > > +++ b/datapath/linux/compat/include/linux/reciprocal_div.h > > @@ -0,0 +1,37 @@ > > +#ifndef _LINUX_RECIPROCAL_DIV_H > > +#define _LINUX_RECIPROCAL_DIV_H > > + > This constant should have WRAPPER as suffix so that we can include > reciprocal_div.h > if available. Fixed it, > * This algorithm is based on the paper "Division by Invariant > > + * Integers Using Multiplication" by Torbjörn Granlund and Peter > > + * L. Montgomery. > > + * > > + * The assembler implementation from Agner Fog, which this code is > > + * based on, can be found here: > > + * http://www.agner.org/optimize/asmlib.zip > > + * > > + * This optimization for A/B is helpful if the divisor B is mostly > > + * runtime invariant. The reciprocal of B is calculated in the > > + * slow-path with reciprocal_value(). The fast-path can then just use > > + * a much faster multiplication operation with a variable dividend A > > + * to calculate the division A/B. > > + */ > > + > Include reciprocal_div.h if available. Fixed, > > +struct reciprocal_value reciprocal_value(u32 d) > > { > > - u64 val = (1LL << 32) + (k - 1); > > - do_div(val, k); > > - return (u32)val; > > + struct reciprocal_value R; > > + u64 m; > > + int l; > > + > > + l = fls(d - 1); > > + m = ((1ULL << 32) * ((1ULL << l) - d)); > > + do_div(m, d); > > + ++m; > > + R.m = (u32)m; > > + R.sh1 = min(l, 1); > > + R.sh2 = max(l - 1, 0); > > + > > + return R; > > } > > -#endif > > +EXPORT_SYMBOL(reciprocal_value); > > Why are you exporting this symbol? > I'll remove this line.
_______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev