Hi Wan Junjie,
On Tue, Apr 04, 2023 at 03:42:47PM +0800, Wan Junjie wrote:
> Hi Simon,
>
> On Wed, Mar 29, 2023 at 11:57 PM Simon Horman <[email protected]>
> wrote:
> > On Fri, Mar 10, 2023 at 09:03:48PM +0800, Wan Junjie wrote:
...
> > > @@ -805,5 +831,73 @@ ofputil_format_meter_mod(struct ds *s, const struct
> > > ofputil_meter_mod *mm)
> > > ds_put_format(s, " cmd:%d ", mm->command);
> > > }
> > >
> > > - ofputil_format_meter_config(s, &mm->meter);
> > > + ofputil_format_meter_config(s, &mm->meter, false);
> > > +}
> > > +
> > > +/* If 'command' is given as -2, each line may start with a command name
> > > ("add",
> > > + * "modify", "delete"). A missing command name is treated as "add".
> > > + */
> > > +char * OVS_WARN_UNUSED_RESULT
> > > +parse_ofp_meter_mod_file(const char *file_name,
> > > + int command,
> > > + struct ofputil_meter_mod **mms, size_t *n_mms,
> > > + enum ofputil_protocol *usable_protocols)
> > > +{
> >
> > This appears to largely duplicate parse_ofp_group_mod_file().
> > Could shared code be used?
> >
> They don't share structures like ofputil_meter_mod. An option is to
> union them or make a generic function with void pointer.
> But this may be a bad idea, like parse_ofp_group_mod_file did not
> reuse code from parse_ofp_flow_mod_file, we may change
> meter's structure in the future. Then the functions will diff a lot
> and be hard to manage in one function.
> If we want to make all the ofp structure reuse a common code then a
> huge refactor to the ofp level will be needed.
Understood. I do think there would be some value in consolidating things.
But I accept that it would be complex. And can be considered out of scope
for this patchset.
...
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev