[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZztcErmTWW1KjSYq@boxer>
Date: Mon, 18 Nov 2024 16:24:02 +0100
From: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
To: Song Yoong Siang <yoong.siang.song@...el.com>
CC: Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
<daniel@...earbox.net>, "David S . Miller" <davem@...emloft.net>, "Jakub
Kicinski" <kuba@...nel.org>, Jesper Dangaard Brouer <hawk@...nel.org>, "John
Fastabend" <john.fastabend@...il.com>, Tony Nguyen
<anthony.l.nguyen@...el.com>, Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Andrew Lunn <andrew+netdev@...n.ch>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Vinicius Costa Gomes
<vinicius.gomes@...el.com>, <intel-wired-lan@...ts.osuosl.org>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<bpf@...r.kernel.org>
Subject: Re: [PATCH iwl-next 1/1] igc: Allow hot-swapping XDP program
On Mon, Nov 18, 2024 at 12:15:45PM +0800, Song Yoong Siang wrote:
> Currently, the driver would always close and reopen the network interface
> when setting/removing the XDP program, regardless of the presence of XDP
> resources. This could cause unnecessary disruptions.
>
> To avoid this, introduces a check to determine if there is a need to
> close and reopen the interface, allowing for seamless hot-swapping of
> XDP programs.
>
> Signed-off-by: Song Yoong Siang <yoong.siang.song@...el.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> ---
> drivers/net/ethernet/intel/igc/igc_xdp.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_xdp.c b/drivers/net/ethernet/intel/igc/igc_xdp.c
> index e27af72aada8..869815f48ac1 100644
> --- a/drivers/net/ethernet/intel/igc/igc_xdp.c
> +++ b/drivers/net/ethernet/intel/igc/igc_xdp.c
> @@ -13,6 +13,7 @@ int igc_xdp_set_prog(struct igc_adapter *adapter, struct bpf_prog *prog,
> struct net_device *dev = adapter->netdev;
> bool if_running = netif_running(dev);
> struct bpf_prog *old_prog;
> + bool need_update;
>
> if (dev->mtu > ETH_DATA_LEN) {
> /* For now, the driver doesn't support XDP functionality with
> @@ -22,7 +23,8 @@ int igc_xdp_set_prog(struct igc_adapter *adapter, struct bpf_prog *prog,
> return -EOPNOTSUPP;
> }
>
> - if (if_running)
> + need_update = !!adapter->xdp_prog != !!prog;
> + if (if_running && need_update)
> igc_close(dev);
>
> old_prog = xchg(&adapter->xdp_prog, prog);
> @@ -34,7 +36,7 @@ int igc_xdp_set_prog(struct igc_adapter *adapter, struct bpf_prog *prog,
> else
> xdp_features_clear_redirect_target(dev);
>
> - if (if_running)
> + if (if_running && need_update)
> igc_open(dev);
>
> return 0;
> --
> 2.34.1
>
>
Powered by blists - more mailing lists