[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ8uoz1a-71CBCYTd5-F1zsueMq+eu9LUqUsPgQH_SawdO6GEQ@mail.gmail.com>
Date: Tue, 25 Jan 2022 10:06:13 +0100
From: Magnus Karlsson <magnus.karlsson@...il.com>
To: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Network Development <netdev@...r.kernel.org>,
"Karlsson, Magnus" <magnus.karlsson@...el.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>
Subject: Re: [PATCH bpf-next v4 2/8] ice: xsk: force rings to be sized to
power of 2
On Mon, Jan 24, 2022 at 8:38 PM Maciej Fijalkowski
<maciej.fijalkowski@...el.com> wrote:
>
> With the upcoming introduction of batching to XSK data path,
> performance wise it will be the best to have the ring descriptor count
> to be aligned to power of 2.
>
> Check if rings sizes that user is going to attach the XSK socket fulfill
nit: rings -> ring if you are making a v5 for some other reason.
> the condition above. For Tx side, although check is being done against
> the Tx queue and in the end the socket will be attached to the XDP
> queue, it is fine since XDP queues get the ring->count setting from Tx
> queues.
For me, this is fine as it makes the driver simpler and faster. But if
anyone out there is using a non power-of-2 ring size together with the
ice zero-copy driver and wants to keep it that way, now would be a
good time to protest.
Acked-by: Magnus Karlsson <magnus.karlsson@...el.com>
> Suggested-by: Alexander Lobakin <alexandr.lobakin@...el.com>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> ---
> drivers/net/ethernet/intel/ice/ice_xsk.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
> index 2388837d6d6c..0350f9c22c62 100644
> --- a/drivers/net/ethernet/intel/ice/ice_xsk.c
> +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
> @@ -327,6 +327,14 @@ int ice_xsk_pool_setup(struct ice_vsi *vsi, struct xsk_buff_pool *pool, u16 qid)
> bool if_running, pool_present = !!pool;
> int ret = 0, pool_failure = 0;
>
> + if (!is_power_of_2(vsi->rx_rings[qid]->count) ||
> + !is_power_of_2(vsi->tx_rings[qid]->count)) {
> + netdev_err(vsi->netdev,
> + "Please align ring sizes at idx %d to power of 2\n", qid);
> + pool_failure = -EINVAL;
> + goto failure;
> + }
> +
> if_running = netif_running(vsi->netdev) && ice_is_xdp_ena_vsi(vsi);
>
> if (if_running) {
> @@ -349,6 +357,7 @@ int ice_xsk_pool_setup(struct ice_vsi *vsi, struct xsk_buff_pool *pool, u16 qid)
> netdev_err(vsi->netdev, "ice_qp_ena error = %d\n", ret);
> }
>
> +failure:
> if (pool_failure) {
> netdev_err(vsi->netdev, "Could not %sable buffer pool, error = %d\n",
> pool_present ? "en" : "dis", pool_failure);
> --
> 2.33.1
>
Powered by blists - more mailing lists