[ovs-dev] [netlink v5 54/61] datapath: Convert ODP_DP_* commands to use AF_NETLINK socket layer.

Jesse Gross jesse at nicira.com
Fri Jan 28 00:53:01 UTC 2011


On Wed, Jan 26, 2011 at 4:23 PM, Ben Pfaff <blp at nicira.com> wrote:
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index db20cf9..f42ead1 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> +static int odp_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
[...]
> +       reply = odp_dp_cmd_build_info(dp, info->snd_pid, info->snd_seq, ODP_DP_CMD_NEW);
> +       if (IS_ERR(reply)) {
> +               err = PTR_ERR(reply);
> +               netlink_set_err(INIT_NET_GENL_SOCK, 0,
> +                               dp_datapath_multicast_group.id, err);
> +               return 0;
> +       }
> +
> +       genl_notify(reply, genl_info_net(info), info->snd_pid,
> +                   dp_datapath_multicast_group.id, info->nlhdr, GFP_KERNEL);
> +       return 0;
>  }

In the other places we allocate the reply message before actually
making the change and abort if it fails.  Here we create the reply
afterwards and set an error if fails.  What's the rationale for the
difference?

>  static const struct genl_family_and_ops dp_genl_families[] = {
> +       { &dp_datapath_genl_family,
> +         dp_datapath_genl_ops, ARRAY_SIZE(dp_datapath_genl_ops),
> +         &dp_datapath_multicast_group },

Why do we need separate multicast groups for notifications for each
family?  The messages contain the family ID, so there shouldn't be any
ambiguity.  I guess that RTNL has quite a few different groups so
there is precedence for this type of thing but we seem much more
narrowly targeted than that.




More information about the dev mailing list