From: "Laatz, Kevin" <kevin.laatz@intel.com>
To: Maxim Mikityanskiy <maximmi@mellanox.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"Topel, Bjorn" <bjorn.topel@intel.com>,
"Karlsson, Magnus" <magnus.karlsson@intel.com>,
"jakub.kicinski@netronome.com" <jakub.kicinski@netronome.com>,
"jonathan.lemon@gmail.com" <jonathan.lemon@gmail.com>,
Saeed Mahameed <saeedm@mellanox.com>,
"stephen@networkplumber.org" <stephen@networkplumber.org>,
"Richardson, Bruce" <bruce.richardson@intel.com>,
"Loftus, Ciara" <ciara.loftus@intel.com>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"intel-wired-lan@lists.osuosl.org"
<intel-wired-lan@lists.osuosl.org>
Subject: Re: [PATCH bpf-next v3 06/11] mlx5e: modify driver for handling offsets
Date: Thu, 25 Jul 2019 18:00:42 +0100 [thread overview]
Message-ID: <4a8bea9e-6b0c-152c-fcbc-6be414a4a324@intel.com> (raw)
In-Reply-To: <c5704b74-8efe-af2a-68e6-716fa89a5665@mellanox.com>
On 25/07/2019 11:15, Maxim Mikityanskiy wrote:
> On 2019-07-24 08:10, Kevin Laatz wrote:
>> With the addition of the unaligned chunks option, we need to make sure we
>> handle the offsets accordingly based on the mode we are currently running
>> in. This patch modifies the driver to appropriately mask the address for
>> each case.
>>
>> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
>>
>> ---
>> v3:
>> - Use new helper function to handle offset
>> ---
>> drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c | 8 ++++++--
>> drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c | 9 +++++++--
>> 2 files changed, 13 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
>> index b0b982cf69bb..d5245893d2c8 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
>> @@ -122,6 +122,7 @@ bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
>> void *va, u16 *rx_headroom, u32 *len, bool xsk)
>> {
>> struct bpf_prog *prog = READ_ONCE(rq->xdp_prog);
>> + struct xdp_umem *umem = rq->umem;
>> struct xdp_buff xdp;
>> u32 act;
>> int err;
>> @@ -138,8 +139,11 @@ bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
>> xdp.rxq = &rq->xdp_rxq;
>>
>> act = bpf_prog_run_xdp(prog, &xdp);
>> - if (xsk)
>> - xdp.handle += xdp.data - xdp.data_hard_start;
>> + if (xsk) {
>> + u64 off = xdp.data - xdp.data_hard_start;
>> +
>> + xdp.handle = xsk_umem_handle_offset(umem, xdp.handle, off);
>> + }
> What's missed is that umem_headroom is added to handle directly in
> mlx5e_xsk_page_alloc_umem. In my understanding umem_headroom should go
> to the offset part (high 16 bits) of the handle, to
> xsk_umem_handle_offset has to support increasing the offset.
Will look into it and make the changes for the v4
>> switch (act) {
>> case XDP_PASS:
>> *rx_headroom = xdp.data - xdp.data_hard_start;
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c
>> index 35e188cf4ea4..f596e63cba00 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c
>> @@ -61,6 +61,7 @@ bool mlx5e_xsk_tx(struct mlx5e_xdpsq *sq, unsigned int budget)
>> struct mlx5e_xdp_xmit_data xdptxd;
>> bool work_done = true;
>> bool flush = false;
>> + u64 addr, offset;
>>
>> xdpi.mode = MLX5E_XDP_XMIT_MODE_XSK;
>>
>> @@ -82,8 +83,12 @@ bool mlx5e_xsk_tx(struct mlx5e_xdpsq *sq, unsigned int budget)
>> break;
>> }
>>
>> - xdptxd.dma_addr = xdp_umem_get_dma(umem, desc.addr);
>> - xdptxd.data = xdp_umem_get_data(umem, desc.addr);
>> + /* for unaligned chunks need to take offset from upper bits */
>> + offset = (desc.addr >> XSK_UNALIGNED_BUF_OFFSET_SHIFT);
>> + addr = (desc.addr & XSK_UNALIGNED_BUF_ADDR_MASK);
>> +
>> + xdptxd.dma_addr = xdp_umem_get_dma(umem, addr + offset);
>> + xdptxd.data = xdp_umem_get_data(umem, addr + offset);
> Why can't these calculations be encapsulated into
> xdp_umem_get_{dma,data}? I think they are common for all drivers, aren't
> they?
>
> Even if there is some reason not to put this bitshifting stuff into
> xdp_umem_get_* functions, I suggest to encapsulate it into a function
> anyway, because it's a good idea to keep those calculations in a single
> place.
Nice suggestion! I will move it to the xdp_umem_get_* functions in the
v4. Thanks
next prev parent reply other threads:[~2019-07-25 17:00 UTC|newest]
Thread overview: 136+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 9:09 [PATCH 00/11] XDP unaligned chunk placement support Kevin Laatz
2019-06-20 9:09 ` [PATCH 01/11] i40e: simplify Rx buffer recycle Kevin Laatz
2019-06-24 14:29 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 02/11] ixgbe: " Kevin Laatz
2019-06-24 14:30 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 03/11] xdp: add offset param to zero_copy_allocator Kevin Laatz
2019-06-24 14:31 ` Björn Töpel
2019-06-24 19:23 ` Jakub Kicinski
2019-06-25 13:14 ` Laatz, Kevin
2019-06-20 9:09 ` [PATCH 04/11] i40e: add offset to zca_free Kevin Laatz
2019-06-24 14:32 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 05/11] ixgbe: " Kevin Laatz
2019-06-24 14:32 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 06/11] xsk: add support to allow unaligned chunk placement Kevin Laatz
2019-06-24 15:29 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 07/11] libbpf: add flags to umem config Kevin Laatz
2019-06-24 15:30 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 08/11] samples/bpf: add unaligned chunks mode support to xdpsock Kevin Laatz
2019-06-24 15:31 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 09/11] samples/bpf: add buffer recycling for unaligned chunks " Kevin Laatz
2019-06-24 15:35 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 10/11] samples/bpf: use hugepages in xdpsock app Kevin Laatz
2019-06-24 15:36 ` Björn Töpel
2019-06-20 9:09 ` [PATCH 11/11] doc/af_xdp: include unaligned chunk case Kevin Laatz
2019-06-24 15:34 ` Björn Töpel
2019-07-16 3:06 ` [PATCH v2 00/10] XDP unaligned chunk placement support Kevin Laatz
2019-07-16 3:06 ` [PATCH v2 01/10] i40e: simplify Rx buffer recycle Kevin Laatz
2019-07-19 17:19 ` [Intel-wired-lan] " Bowers, AndrewX
2019-07-16 3:06 ` [PATCH v2 02/10] ixgbe: " Kevin Laatz
2019-07-19 17:20 ` [Intel-wired-lan] " Bowers, AndrewX
2019-07-16 3:06 ` [PATCH v2 03/10] xsk: add support to allow unaligned chunk placement Kevin Laatz
2019-07-19 17:21 ` [Intel-wired-lan] " Bowers, AndrewX
2019-07-16 3:06 ` [PATCH v2 04/10] i40e: modify driver for handling offsets Kevin Laatz
2019-07-19 17:22 ` [Intel-wired-lan] " Bowers, AndrewX
2019-07-16 3:06 ` [PATCH v2 05/10] ixgbe: " Kevin Laatz
2019-07-19 17:22 ` [Intel-wired-lan] " Bowers, AndrewX
2019-07-16 3:06 ` [PATCH v2 06/10] libbpf: add flags to umem config Kevin Laatz
2019-07-16 3:06 ` [PATCH v2 07/10] samples/bpf: add unaligned chunks mode support to xdpsock Kevin Laatz
2019-07-16 3:06 ` [PATCH v2 08/10] samples/bpf: add buffer recycling for unaligned chunks " Kevin Laatz
2019-07-16 3:06 ` [PATCH v2 09/10] samples/bpf: use hugepages in xdpsock app Kevin Laatz
2019-07-16 3:06 ` [PATCH v2 10/10] doc/af_xdp: include unaligned chunk case Kevin Laatz
2019-07-23 21:08 ` [PATCH v2 00/10] XDP unaligned chunk placement support Alexei Starovoitov
2019-07-24 13:25 ` [Intel-wired-lan] " Magnus Karlsson
2019-07-25 15:43 ` Jonathan Lemon
2019-07-24 5:10 ` [PATCH bpf-next v3 00/11] " Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 01/11] i40e: simplify Rx buffer recycle Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 02/11] ixgbe: " Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 03/11] xsk: add support to allow unaligned chunk placement Kevin Laatz
2019-07-25 2:22 ` Jakub Kicinski
2019-07-25 17:01 ` Laatz, Kevin
2019-07-25 9:27 ` Maxim Mikityanskiy
2019-07-25 17:00 ` Laatz, Kevin
2019-07-25 10:08 ` Maxim Mikityanskiy
2019-07-25 15:39 ` Jonathan Lemon
2019-07-24 5:10 ` [PATCH bpf-next v3 04/11] i40e: modify driver for handling offsets Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 05/11] ixgbe: " Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 06/11] mlx5e: " Kevin Laatz
2019-07-25 10:15 ` Maxim Mikityanskiy
2019-07-25 17:00 ` Laatz, Kevin [this message]
2019-07-24 5:10 ` [PATCH bpf-next v3 07/11] libbpf: add flags to umem config Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 08/11] samples/bpf: add unaligned chunks mode support to xdpsock Kevin Laatz
2019-07-25 9:43 ` Maxim Mikityanskiy
2019-07-25 17:00 ` Laatz, Kevin
2019-07-24 5:10 ` [PATCH bpf-next v3 09/11] samples/bpf: add buffer recycling for unaligned chunks " Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 10/11] samples/bpf: use hugepages in xdpsock app Kevin Laatz
2019-07-24 5:10 ` [PATCH bpf-next v3 11/11] doc/af_xdp: include unaligned chunk case Kevin Laatz
2019-07-25 15:39 ` [PATCH bpf-next v3 00/11] XDP unaligned chunk placement support Jonathan Lemon
2019-07-25 15:56 ` Richardson, Bruce
2019-07-25 17:30 ` Jonathan Lemon
2019-07-26 8:41 ` Bruce Richardson
2019-07-30 8:53 ` [PATCH bpf-next v4 " Kevin Laatz
2019-07-30 8:53 ` [PATCH bpf-next v4 01/11] i40e: simplify Rx buffer recycle Kevin Laatz
2019-07-30 8:53 ` [PATCH bpf-next v4 02/11] ixgbe: " Kevin Laatz
2019-07-30 8:53 ` [PATCH bpf-next v4 03/11] libbpf: add flags to umem config Kevin Laatz
2019-07-31 12:45 ` [Intel-wired-lan] " Björn Töpel
2019-07-31 14:25 ` Björn Töpel
2019-08-01 6:59 ` Andrii Nakryiko
2019-08-01 7:34 ` Björn Töpel
2019-08-02 7:19 ` Andrii Nakryiko
2019-08-02 7:26 ` Björn Töpel
2019-07-30 8:53 ` [PATCH bpf-next v4 04/11] xsk: add support to allow unaligned chunk placement Kevin Laatz
2019-07-31 18:11 ` Jonathan Lemon
2019-07-30 8:53 ` [PATCH bpf-next v4 05/11] i40e: modify driver for handling offsets Kevin Laatz
2019-07-30 8:53 ` [PATCH bpf-next v4 06/11] ixgbe: " Kevin Laatz
2019-07-30 8:53 ` [PATCH bpf-next v4 07/11] mlx5e: " Kevin Laatz
2019-07-31 18:10 ` Jonathan Lemon
2019-08-01 10:05 ` Maxim Mikityanskiy
2019-08-19 14:36 ` Maxim Mikityanskiy
2019-08-19 14:47 ` Laatz, Kevin
2019-07-30 8:53 ` [PATCH bpf-next v4 08/11] samples/bpf: add unaligned chunks mode support to xdpsock Kevin Laatz
2019-07-30 8:53 ` [PATCH bpf-next v4 09/11] samples/bpf: add buffer recycling for unaligned chunks " Kevin Laatz
2019-07-31 18:26 ` Jonathan Lemon
2019-07-30 8:53 ` [PATCH bpf-next v4 10/11] samples/bpf: use hugepages in xdpsock app Kevin Laatz
2019-07-30 8:54 ` [PATCH bpf-next v4 11/11] doc/af_xdp: include unaligned chunk case Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 00/11] XDP unaligned chunk placement support Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 01/11] i40e: simplify Rx buffer recycle Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 02/11] ixgbe: " Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 03/11] xsk: add support to allow unaligned chunk placement Kevin Laatz
2019-08-22 18:43 ` Jonathan Lemon
2019-08-23 13:35 ` Laatz, Kevin
2019-08-27 7:36 ` Maxim Mikityanskiy
2019-08-22 1:44 ` [PATCH bpf-next v5 04/11] i40e: modify driver for handling offsets Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 05/11] ixgbe: " Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 06/11] mlx5e: " Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 07/11] libbpf: add flags to umem config Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 08/11] samples/bpf: add unaligned chunks mode support to xdpsock Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 09/11] samples/bpf: add buffer recycling for unaligned chunks " Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 10/11] samples/bpf: use hugepages in xdpsock app Kevin Laatz
2019-08-22 1:44 ` [PATCH bpf-next v5 11/11] doc/af_xdp: include unaligned chunk case Kevin Laatz
2019-08-27 2:25 ` [PATCH bpf-next v6 00/12] XDP unaligned chunk placement support Kevin Laatz
2019-08-27 2:25 ` [PATCH bpf-next v6 01/12] i40e: simplify Rx buffer recycle Kevin Laatz
2019-08-30 15:37 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 02/12] ixgbe: " Kevin Laatz
2019-08-30 15:39 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 03/12] xsk: add support to allow unaligned chunk placement Kevin Laatz
2019-08-30 15:41 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 04/12] i40e: modify driver for handling offsets Kevin Laatz
2019-08-30 15:42 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 05/12] ixgbe: " Kevin Laatz
2019-08-30 15:42 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 06/12] mlx5e: " Kevin Laatz
2019-08-30 15:43 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 07/12] net/mlx5e: Allow XSK frames smaller than a page Kevin Laatz
2019-08-30 15:45 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 08/12] libbpf: add flags to umem config Kevin Laatz
2019-08-30 15:46 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 09/12] samples/bpf: add unaligned chunks mode support to xdpsock Kevin Laatz
2019-08-30 15:47 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 10/12] samples/bpf: add buffer recycling for unaligned chunks " Kevin Laatz
2019-08-30 15:49 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 11/12] samples/bpf: use hugepages in xdpsock app Kevin Laatz
2019-08-30 15:51 ` Jonathan Lemon
2019-08-27 2:25 ` [PATCH bpf-next v6 12/12] doc/af_xdp: include unaligned chunk case Kevin Laatz
2019-08-30 15:51 ` Jonathan Lemon
2019-08-30 15:52 ` [PATCH bpf-next v6 00/12] XDP unaligned chunk placement support Jonathan Lemon
2019-08-30 23:29 ` Daniel Borkmann
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=4a8bea9e-6b0c-152c-fcbc-6be414a4a324@intel.com \
--to=kevin.laatz@intel.com \
--cc=ast@kernel.org \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=bruce.richardson@intel.com \
--cc=ciara.loftus@intel.com \
--cc=daniel@iogearbox.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jakub.kicinski@netronome.com \
--cc=jonathan.lemon@gmail.com \
--cc=magnus.karlsson@intel.com \
--cc=maximmi@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
--cc=stephen@networkplumber.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).