LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] openvswitch: make vport_ops:send()'s return type consistent
@ 2018-04-24 13:19 Luc Van Oostenryck
  2018-05-07 20:44 ` [ovs-dev] " Gregory Rose
  0 siblings, 1 reply; 2+ messages in thread
From: Luc Van Oostenryck @ 2018-04-24 13:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: Luc Van Oostenryck, Pravin B Shelar, David S. Miller, netdev, dev

The method struct vport_ops:send() is defined as returning an
'netdev_tx_t', which is defined as a typedef for a bitwise type
and otherwise used for the start_xmit() methods.
However, most openvswitch drivers use for this method dev_queue_xmit()
which returns an 'int' and the return value of vport_ops:send() is
in fact never used.

Make things typewise consistent and use 'int' for vport_ops:send()
as well for internal_dev_recv() (which is the only proper send method)
as using 'netdev_tx_t' doesn't offer any advantages and in fact seems,
if not wrong at least, inadequate.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 net/openvswitch/vport-internal_dev.c | 6 +++---
 net/openvswitch/vport.h              | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 3ea55618e..2fd68c2fb 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -231,7 +231,7 @@ static void internal_dev_destroy(struct vport *vport)
 	rtnl_unlock();
 }
 
-static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
+static int internal_dev_recv(struct sk_buff *skb)
 {
 	struct net_device *netdev = skb->dev;
 	struct pcpu_sw_netstats *stats;
@@ -239,7 +239,7 @@ static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
 	if (unlikely(!(netdev->flags & IFF_UP))) {
 		kfree_skb(skb);
 		netdev->stats.rx_dropped++;
-		return NETDEV_TX_OK;
+		return 0;
 	}
 
 	skb_dst_drop(skb);
@@ -257,7 +257,7 @@ static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
 	u64_stats_update_end(&stats->syncp);
 
 	netif_rx(skb);
-	return NETDEV_TX_OK;
+	return 0;
 }
 
 static struct vport_ops ovs_internal_vport_ops = {
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index cda66c26a..8dcb48fe8 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -141,7 +141,7 @@ struct vport_ops {
 	int (*set_options)(struct vport *, struct nlattr *);
 	int (*get_options)(const struct vport *, struct sk_buff *);
 
-	netdev_tx_t (*send) (struct sk_buff *skb);
+	int (*send) (struct sk_buff *skb);
 	struct module *owner;
 	struct list_head list;
 };
-- 
2.17.0

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

* Re: [ovs-dev] [PATCH] openvswitch: make vport_ops:send()'s return type consistent
  2018-04-24 13:19 [PATCH] openvswitch: make vport_ops:send()'s return type consistent Luc Van Oostenryck
@ 2018-05-07 20:44 ` Gregory Rose
  0 siblings, 0 replies; 2+ messages in thread
From: Gregory Rose @ 2018-05-07 20:44 UTC (permalink / raw)
  To: Luc Van Oostenryck, linux-kernel; +Cc: dev, netdev, David S. Miller

On 4/24/2018 6:19 AM, Luc Van Oostenryck wrote:
> The method struct vport_ops:send() is defined as returning an
> 'netdev_tx_t', which is defined as a typedef for a bitwise type
> and otherwise used for the start_xmit() methods.
> However, most openvswitch drivers use for this method dev_queue_xmit()
> which returns an 'int' and the return value of vport_ops:send() is
> in fact never used.
>
> Make things typewise consistent and use 'int' for vport_ops:send()
> as well for internal_dev_recv() (which is the only proper send method)
> as using 'netdev_tx_t' doesn't offer any advantages and in fact seems,
> if not wrong at least, inadequate.
>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>   net/openvswitch/vport-internal_dev.c | 6 +++---
>   net/openvswitch/vport.h              | 2 +-
>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
> index 3ea55618e..2fd68c2fb 100644
> --- a/net/openvswitch/vport-internal_dev.c
> +++ b/net/openvswitch/vport-internal_dev.c
> @@ -231,7 +231,7 @@ static void internal_dev_destroy(struct vport *vport)
>   	rtnl_unlock();
>   }
>   
> -static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
> +static int internal_dev_recv(struct sk_buff *skb)
>   {
>   	struct net_device *netdev = skb->dev;
>   	struct pcpu_sw_netstats *stats;
> @@ -239,7 +239,7 @@ static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
>   	if (unlikely(!(netdev->flags & IFF_UP))) {
>   		kfree_skb(skb);
>   		netdev->stats.rx_dropped++;
> -		return NETDEV_TX_OK;
> +		return 0;
>   	}
>   
>   	skb_dst_drop(skb);
> @@ -257,7 +257,7 @@ static netdev_tx_t internal_dev_recv(struct sk_buff *skb)
>   	u64_stats_update_end(&stats->syncp);
>   
>   	netif_rx(skb);
> -	return NETDEV_TX_OK;
> +	return 0;
>   }
>   
>   static struct vport_ops ovs_internal_vport_ops = {
> diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
> index cda66c26a..8dcb48fe8 100644
> --- a/net/openvswitch/vport.h
> +++ b/net/openvswitch/vport.h
> @@ -141,7 +141,7 @@ struct vport_ops {
>   	int (*set_options)(struct vport *, struct nlattr *);
>   	int (*get_options)(const struct vport *, struct sk_buff *);
>   
> -	netdev_tx_t (*send) (struct sk_buff *skb);
> +	int (*send) (struct sk_buff *skb);
>   	struct module *owner;
>   	struct list_head list;
>   };

Yes, it does seem odd to use a tx return type for receive.  Nice fixup.

Reviewed-by: Greg Rose <gvrose8192@gmail.com>

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

end of thread, other threads:[~2018-05-07 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 13:19 [PATCH] openvswitch: make vport_ops:send()'s return type consistent Luc Van Oostenryck
2018-05-07 20:44 ` [ovs-dev] " Gregory Rose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).