[ovs-dev] [PATCH net-next v3 1/3] net: openvswitch: improve coding style

Tonghao Zhang xiangxia.m.yue at gmail.com
Tue Sep 1 11:54:14 UTC 2020


On Wed, Aug 26, 2020 at 5:51 AM Stefano Brivio <sbrivio at redhat.com> wrote:
>
> On Tue, 25 Aug 2020 13:06:34 +0800
> xiangxia.m.yue at gmail.com wrote:
>
> > +++ b/net/openvswitch/datapath.c
> >
> > [...]
> >
> > @@ -2095,7 +2099,7 @@ static void ovs_update_headroom(struct datapath *dp, unsigned int new_headroom)
> >       dp->max_headroom = new_headroom;
> >       for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++)
>
> While at it, you could also add curly brackets here.
>
> > +++ b/net/openvswitch/flow_table.c
> >
> > [...]
> >
> > @@ -111,9 +111,11 @@ static void flow_free(struct sw_flow *flow)
> >       if (ovs_identifier_is_key(&flow->id))
> >               kfree(flow->id.unmasked_key);
> >       if (flow->sf_acts)
> > -             ovs_nla_free_flow_actions((struct sw_flow_actions __force *)flow->sf_acts);
> > +             ovs_nla_free_flow_actions((struct sw_flow_actions __force *)
> > +                                       flow->sf_acts);
> >       /* We open code this to make sure cpu 0 is always considered */
> > -     for (cpu = 0; cpu < nr_cpu_ids; cpu = cpumask_next(cpu, &flow->cpu_used_mask))
> > +     for (cpu = 0; cpu < nr_cpu_ids;
> > +          cpu = cpumask_next(cpu, &flow->cpu_used_mask))
>
> ...and here.
>
> > @@ -273,7 +275,7 @@ static int tbl_mask_array_add_mask(struct flow_table *tbl,
> >
> >       if (ma_count >= ma->max) {
> >               err = tbl_mask_array_realloc(tbl, ma->max +
> > -                                           MASK_ARRAY_SIZE_MIN);
> > +                                          MASK_ARRAY_SIZE_MIN);
>
> This is not aligned properly either, MASK_ARRAY_SIZE_MIN is added to
> ma->max and should be aligned to it.
>
> > @@ -448,16 +450,17 @@ int ovs_flow_tbl_init(struct flow_table *table)
> >
> >  static void flow_tbl_destroy_rcu_cb(struct rcu_head *rcu)
> >  {
> > -     struct table_instance *ti = container_of(rcu, struct table_instance, rcu);
> > +     struct table_instance *ti =
> > +             container_of(rcu, struct table_instance, rcu);
>
> The assignment could very well go on a separate line.
Hi Stefano
Sorry for missing the comment. I update the patch in v4. Thanks.

> --
> Stefano
>


-- 
Best regards, Tonghao


More information about the dev mailing list