All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Andrew Melnychenko <andrew@daynix.com>, mst@redhat.com
Cc: yan@daynix.com, yuri.benditovich@daynix.com, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH v2 1/5] net: Added SetSteeringEBPF method for NetClientState.
Date: Mon, 23 Nov 2020 14:10:41 +0800	[thread overview]
Message-ID: <883450e0-94ee-b64c-e39d-9f6ae2866593@redhat.com> (raw)
In-Reply-To: <20201119111305.485202-2-andrew@daynix.com>


On 2020/11/19 下午7:13, Andrew Melnychenko wrote:
> From: Andrew <andrew@daynix.com>
>
> For now, that method supported only by Linux TAP.
> Linux TAP uses TUNSETSTEERINGEBPF ioctl.
>
> Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
> ---
>   include/net/net.h |  2 ++
>   net/tap-bsd.c     |  5 +++++
>   net/tap-linux.c   | 13 +++++++++++++
>   net/tap-linux.h   |  1 +
>   net/tap-solaris.c |  5 +++++
>   net/tap-stub.c    |  5 +++++
>   net/tap.c         |  9 +++++++++
>   net/tap_int.h     |  1 +
>   8 files changed, 41 insertions(+)
>
> diff --git a/include/net/net.h b/include/net/net.h
> index 897b2d7595..d8a41fb010 100644
> --- a/include/net/net.h
> +++ b/include/net/net.h
> @@ -60,6 +60,7 @@ typedef int (SetVnetBE)(NetClientState *, bool);
>   typedef struct SocketReadState SocketReadState;
>   typedef void (SocketReadStateFinalize)(SocketReadState *rs);
>   typedef void (NetAnnounce)(NetClientState *);
> +typedef bool (SetSteeringEBPF)(NetClientState *, int);
>   
>   typedef struct NetClientInfo {
>       NetClientDriver type;
> @@ -81,6 +82,7 @@ typedef struct NetClientInfo {
>       SetVnetLE *set_vnet_le;
>       SetVnetBE *set_vnet_be;
>       NetAnnounce *announce;
> +    SetSteeringEBPF *set_steering_ebpf;
>   } NetClientInfo;
>   
>   struct NetClientState {
> diff --git a/net/tap-bsd.c b/net/tap-bsd.c
> index 77aaf674b1..4f64f31e98 100644
> --- a/net/tap-bsd.c
> +++ b/net/tap-bsd.c
> @@ -259,3 +259,8 @@ int tap_fd_get_ifname(int fd, char *ifname)
>   {
>       return -1;
>   }
> +
> +int tap_fd_set_steering_ebpf(int fd, int prog_fd)
> +{
> +    return -1;
> +}
> diff --git a/net/tap-linux.c b/net/tap-linux.c
> index b0635e9e32..9584769740 100644
> --- a/net/tap-linux.c
> +++ b/net/tap-linux.c
> @@ -316,3 +316,16 @@ int tap_fd_get_ifname(int fd, char *ifname)
>       pstrcpy(ifname, sizeof(ifr.ifr_name), ifr.ifr_name);
>       return 0;
>   }
> +
> +int tap_fd_set_steering_ebpf(int fd, int prog_fd)
> +{
> +    if (ioctl(fd, TUNSETSTEERINGEBPF, (void *) &prog_fd) != 0) {
> +        error_report("Issue while setting TUNSETSTEERINGEBPF:"
> +                    " %s with fd: %d, prog_fd: %d",
> +                    strerror(errno), fd, prog_fd);
> +
> +       return -1;
> +    }
> +
> +    return 0;
> +}
> diff --git a/net/tap-linux.h b/net/tap-linux.h
> index 2f36d100fc..1d06fe0de6 100644
> --- a/net/tap-linux.h
> +++ b/net/tap-linux.h
> @@ -31,6 +31,7 @@
>   #define TUNSETQUEUE  _IOW('T', 217, int)
>   #define TUNSETVNETLE _IOW('T', 220, int)
>   #define TUNSETVNETBE _IOW('T', 222, int)
> +#define TUNSETSTEERINGEBPF _IOR('T', 224, int)


Let's do this in another patch.

Thanks



  reply	other threads:[~2020-11-23  6:13 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-19 11:13 [RFC PATCH v2 0/5] eBPF RSS support for virtio-net Andrew Melnychenko
2020-11-19 11:13 ` [RFC PATCH v2 1/5] net: Added SetSteeringEBPF method for NetClientState Andrew Melnychenko
2020-11-23  6:10   ` Jason Wang [this message]
2020-11-19 11:13 ` [RFC PATCH v2 2/5] ebpf: Added eBPF RSS program Andrew Melnychenko
2020-11-24  8:14   ` Jason Wang
2020-11-19 11:13 ` [RFC PATCH v2 3/5] ebpf: Added eBPF RSS loader Andrew Melnychenko
2020-11-24  8:33   ` Jason Wang
2020-11-19 11:13 ` [RFC PATCH v2 4/5] virtio-net: Added eBPF RSS to virtio-net Andrew Melnychenko
2020-11-24  8:48   ` Jason Wang
2020-12-01  7:40     ` Yuri Benditovich
2020-12-02  4:05       ` Jason Wang
2020-12-02  7:16         ` Yuri Benditovich
2020-12-02  8:06           ` Jason Wang
2020-11-19 11:13 ` [RFC PATCH v2 5/5] docs: Added eBPF documentation Andrew Melnychenko
2020-11-24  8:54   ` Jason Wang
2020-11-26 13:00     ` Yuri Benditovich
2020-11-27  4:36       ` Jason Wang
2020-11-23  6:08 ` [RFC PATCH v2 0/5] eBPF RSS support for virtio-net Jason Wang
2020-11-26 12:52   ` Yuri Benditovich
2020-11-27  4:35     ` Jason Wang
2020-11-27  6:06       ` Yuri Benditovich
2020-11-30  2:54         ` Jason Wang
2020-12-02 13:55 ` Jason Wang
2020-12-02 14:18   ` Toke Høiland-Jørgensen
2020-12-04  7:42     ` Yuri Benditovich
2020-12-04 10:09       ` Toke Høiland-Jørgensen
2020-12-04 12:31         ` Yuri Benditovich
2020-12-04 13:57           ` Toke Høiland-Jørgensen
2020-12-06 18:44             ` Yuri Benditovich

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=883450e0-94ee-b64c-e39d-9f6ae2866593@redhat.com \
    --to=jasowang@redhat.com \
    --cc=andrew@daynix.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.com \
    --cc=yuri.benditovich@daynix.com \
    /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 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.