From: Gregory Rose <gvrose8192-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Luc Van Oostenryck
<luc.vanoostenryck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Re: [PATCH] openvswitch: make vport_ops:send()'s return type consistent
Date: Mon, 7 May 2018 13:44:53 -0700 [thread overview]
Message-ID: <b1b45047-7730-a6b1-c80c-4443339ac20d@gmail.com> (raw)
In-Reply-To: <20180424131953.6474-1-luc.vanoostenryck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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>
_______________________________________________
dev mailing list
dev@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
prev parent reply other threads:[~2018-05-07 20:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-24 13:19 [PATCH] openvswitch: make vport_ops:send()'s return type consistent Luc Van Oostenryck
[not found] ` <20180424131953.6474-1-luc.vanoostenryck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-07 20:44 ` Gregory Rose [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b1b45047-7730-a6b1-c80c-4443339ac20d@gmail.com \
--to=gvrose8192-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=luc.vanoostenryck-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).