All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops
@ 2018-09-26 18:40 Yifeng Sun
  2018-09-28 17:12 ` Pravin Shelar
  2018-09-29 18:44 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Yifeng Sun @ 2018-09-26 18:40 UTC (permalink / raw)
  To: netdev; +Cc: Yifeng Sun

This patch fixes the bug that all datapath and vport ops are returning
wrong values (OVS_FLOW_CMD_NEW or OVS_DP_CMD_NEW) in their replies.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 net/openvswitch/datapath.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 0f5ce77..6679e96 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1182,14 +1182,14 @@ static int ovs_flow_cmd_set(struct sk_buff *skb, struct genl_info *info)
 						       ovs_header->dp_ifindex,
 						       reply, info->snd_portid,
 						       info->snd_seq, 0,
-						       OVS_FLOW_CMD_NEW,
+						       OVS_FLOW_CMD_SET,
 						       ufid_flags);
 			BUG_ON(error < 0);
 		}
 	} else {
 		/* Could not alloc without acts before locking. */
 		reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex,
-						info, OVS_FLOW_CMD_NEW, false,
+						info, OVS_FLOW_CMD_SET, false,
 						ufid_flags);
 
 		if (IS_ERR(reply)) {
@@ -1265,7 +1265,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	reply = ovs_flow_cmd_build_info(flow, ovs_header->dp_ifindex, info,
-					OVS_FLOW_CMD_NEW, true, ufid_flags);
+					OVS_FLOW_CMD_GET, true, ufid_flags);
 	if (IS_ERR(reply)) {
 		err = PTR_ERR(reply);
 		goto unlock;
@@ -1389,7 +1389,7 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
 		if (ovs_flow_cmd_fill_info(flow, ovs_header->dp_ifindex, skb,
 					   NETLINK_CB(cb->skb).portid,
 					   cb->nlh->nlmsg_seq, NLM_F_MULTI,
-					   OVS_FLOW_CMD_NEW, ufid_flags) < 0)
+					   OVS_FLOW_CMD_GET, ufid_flags) < 0)
 			break;
 
 		cb->args[0] = bucket;
@@ -1730,7 +1730,7 @@ static int ovs_dp_cmd_set(struct sk_buff *skb, struct genl_info *info)
 	ovs_dp_change(dp, info->attrs);
 
 	err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
-				   info->snd_seq, 0, OVS_DP_CMD_NEW);
+				   info->snd_seq, 0, OVS_DP_CMD_SET);
 	BUG_ON(err < 0);
 
 	ovs_unlock();
@@ -1761,7 +1761,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
 		goto err_unlock_free;
 	}
 	err = ovs_dp_cmd_fill_info(dp, reply, info->snd_portid,
-				   info->snd_seq, 0, OVS_DP_CMD_NEW);
+				   info->snd_seq, 0, OVS_DP_CMD_GET);
 	BUG_ON(err < 0);
 	ovs_unlock();
 
@@ -1785,7 +1785,7 @@ static int ovs_dp_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
 		if (i >= skip &&
 		    ovs_dp_cmd_fill_info(dp, skb, NETLINK_CB(cb->skb).portid,
 					 cb->nlh->nlmsg_seq, NLM_F_MULTI,
-					 OVS_DP_CMD_NEW) < 0)
+					 OVS_DP_CMD_GET) < 0)
 			break;
 		i++;
 	}
@@ -2101,7 +2101,7 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
 
 	err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info),
 				      info->snd_portid, info->snd_seq, 0,
-				      OVS_VPORT_CMD_NEW);
+				      OVS_VPORT_CMD_SET);
 	BUG_ON(err < 0);
 
 	ovs_unlock();
@@ -2182,7 +2182,7 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
 		goto exit_unlock_free;
 	err = ovs_vport_cmd_fill_info(vport, reply, genl_info_net(info),
 				      info->snd_portid, info->snd_seq, 0,
-				      OVS_VPORT_CMD_NEW);
+				      OVS_VPORT_CMD_GET);
 	BUG_ON(err < 0);
 	rcu_read_unlock();
 
@@ -2218,7 +2218,7 @@ static int ovs_vport_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb)
 						    NETLINK_CB(cb->skb).portid,
 						    cb->nlh->nlmsg_seq,
 						    NLM_F_MULTI,
-						    OVS_VPORT_CMD_NEW) < 0)
+						    OVS_VPORT_CMD_GET) < 0)
 				goto out;
 
 			j++;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops
  2018-09-26 18:40 [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops Yifeng Sun
@ 2018-09-28 17:12 ` Pravin Shelar
  2018-09-29 18:44 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Pravin Shelar @ 2018-09-28 17:12 UTC (permalink / raw)
  To: Yifeng Sun; +Cc: Linux Kernel Network Developers

On Wed, Sep 26, 2018 at 11:40 AM Yifeng Sun <pkusunyifeng@gmail.com> wrote:
>
> This patch fixes the bug that all datapath and vport ops are returning
> wrong values (OVS_FLOW_CMD_NEW or OVS_DP_CMD_NEW) in their replies.
>
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
I am surprised this was not found earlier.

Acked-by: Pravin B Shelar <pshelar@ovn.org>

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops
  2018-09-26 18:40 [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops Yifeng Sun
  2018-09-28 17:12 ` Pravin Shelar
@ 2018-09-29 18:44 ` David Miller
  2018-10-17  8:24   ` Koichiro Den
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2018-09-29 18:44 UTC (permalink / raw)
  To: pkusunyifeng; +Cc: netdev

From: Yifeng Sun <pkusunyifeng@gmail.com>
Date: Wed, 26 Sep 2018 11:40:14 -0700

> This patch fixes the bug that all datapath and vport ops are returning
> wrong values (OVS_FLOW_CMD_NEW or OVS_DP_CMD_NEW) in their replies.
> 
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops
  2018-09-29 18:44 ` David Miller
@ 2018-10-17  8:24   ` Koichiro Den
  0 siblings, 0 replies; 4+ messages in thread
From: Koichiro Den @ 2018-10-17  8:24 UTC (permalink / raw)
  To: David Miller, pkusunyifeng; +Cc: netdev

On Sat, 2018-09-29 at 11:44 -0700, David Miller wrote:
> From: Yifeng Sun <pkusunyifeng@gmail.com>
> Date: Wed, 26 Sep 2018 11:40:14 -0700
> 
> > This patch fixes the bug that all datapath and vport ops are returning
> > wrong values (OVS_FLOW_CMD_NEW or OVS_DP_CMD_NEW) in their replies.
> > 
> > Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
> 
> Applied.

Not directly relating to ovs, but as a similar existing behaviour, we do have
somewhat odd response for CTRL_CMD_GETFAMILY. I mean this part:

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 25eeb6d2a75a..17428d5d1434 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -789,7 +789,7 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct
netlink_callback *cb)

                if (ctrl_fill_info(rt, NETLINK_CB(cb->skb).portid,
                                   cb->nlh->nlmsg_seq, NLM_F_MULTI,
-                                  skb, CTRL_CMD_NEWFAMILY) < 0) {
+                                  skb, CTRL_CMD_GETFAMILY) < 0) {
                        n--;
                        break;
                }
@@ -886,7 +886,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct
genl_info *info)
        }

        msg = ctrl_build_family_msg(res, info->snd_portid, info->snd_seq,
-                                   CTRL_CMD_NEWFAMILY);
+                                   CTRL_CMD_GETFAMILY);
        if (IS_ERR(msg))
                return PTR_ERR(msg);

David, do you think we should retain this existing bahaviour, since this would
be a relatively huge breaking change for userland apps?

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-17 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-26 18:40 [PATCH] [PATCH net-next] openvswitch: Use correct reply values in datapath and vport ops Yifeng Sun
2018-09-28 17:12 ` Pravin Shelar
2018-09-29 18:44 ` David Miller
2018-10-17  8:24   ` Koichiro Den

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.