Message ID | 20180424131953.6474-1-luc.vanoostenryck@gmail.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
Series | openvswitch: make vport_ops:send()'s return type consistent | expand |
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>
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; };
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(-)