Re: linux-next: manual merge of the bpf-next tree with the net-next tree

From: Alexander Lobakin
Date: Mon Feb 20 2023 - 06:54:17 EST


From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Date: Mon, 20 Feb 2023 10:00:56 +1100

> Hi all,
>
> Today's linux-next merge of the bpf-next tree got a conflict in:
>
> drivers/net/ethernet/intel/ice/ice_xsk.c
>
> between commit:
>
> 675f176b4dcc ("Merge ra.kernel.org:/pub/scm/linux/kernel/git/netdev/net")
>
> from the net-next tree and commit:
>
> aa1d3faf71a6 ("ice: Robustify cleaning/completing XDP Tx buffers")
>
> from the bpf-next tree.
>
> I fixed it up (I guessed - see below) and can carry the fix as
> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging. You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
>

Hi,

the correct fix will be as follows (at least my Git yielded me this when
merging net-next with bpf-next).
Strange movements from Git, but basically the resolution is to pick the
latest ice_xsk.c from bpf-next and then manually carry Larysa's fix[0]
for @xsk_frames (she initially did it for bpf-next, so it's easier for
us to resolve this conflict).
Much thanks for noticing and notifying.

[0]
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=1f090494170ea298530cf1285fb8d078e355b4c0

Thanks,
Olek
---
diff --cc drivers/net/ethernet/intel/ice/ice_xsk.c
index b2d96ae5668c,917c75e530ca..1fcfa07c205b
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@@ -629,29 -613,28 +614,30 @@@ static void ice_clean_xdp_irq_zc(struc

last_rs = xdp_ring->next_to_use ? xdp_ring->next_to_use - 1 : cnt - 1;
tx_desc = ICE_TX_DESC(xdp_ring, last_rs);
- if ((tx_desc->cmd_type_offset_bsz &
- cpu_to_le64(ICE_TX_DESC_DTYPE_DESC_DONE))) {
+ if (tx_desc->cmd_type_offset_bsz &
+ cpu_to_le64(ICE_TX_DESC_DTYPE_DESC_DONE)) {
if (last_rs >= ntc)
- xsk_frames = last_rs - ntc + 1;
+ completed_frames = last_rs - ntc + 1;
else
- xsk_frames = last_rs + cnt - ntc + 1;
+ completed_frames = last_rs + cnt - ntc + 1;
}

- if (!xsk_frames)
+ if (!completed_frames)
return;

- if (likely(!xdp_ring->xdp_tx_active))
+ if (likely(!xdp_ring->xdp_tx_active)) {
+ xsk_frames = completed_frames;
goto skip;
+ }

ntc = xdp_ring->next_to_clean;
- for (i = 0; i < xsk_frames; i++) {
+ for (i = 0; i < completed_frames; i++) {
tx_buf = &xdp_ring->tx_buf[ntc];

- if (tx_buf->raw_buf) {
- ice_clean_xdp_tx_buf(xdp_ring, tx_buf);
- tx_buf->raw_buf = NULL;
+ if (tx_buf->type == ICE_TX_BUF_XSK_TX) {
+ tx_buf->type = ICE_TX_BUF_EMPTY;
+ xsk_buff_free(tx_buf->xdp);
+ xdp_ring->xdp_tx_active--;
} else {
xsk_frames++;
}