Skip to content

Commit a0b4a80

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2024-08-20 (ice) This series contains updates to ice driver only. Maciej fixes issues with Rx data path on architectures with PAGE_SIZE >= 8192; correcting page reuse usage and calculations for last offset and truesize. Michal corrects assignment of devlink port number to use PF id. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ice: use internal pf id instead of function number ice: fix truesize operations for PAGE_SIZE >= 8192 ice: fix ICE_LAST_OFFSET formula ice: fix page reuse when PAGE_SIZE is over 8k ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 8baeef7 + 503ab6e commit a0b4a80

File tree

3 files changed

+26
-46
lines changed

3 files changed

+26
-46
lines changed

drivers/net/ethernet/intel/ice/devlink/devlink_port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ int ice_devlink_create_pf_port(struct ice_pf *pf)
337337
return -EIO;
338338

339339
attrs.flavour = DEVLINK_PORT_FLAVOUR_PHYSICAL;
340-
attrs.phys.port_number = pf->hw.bus.func;
340+
attrs.phys.port_number = pf->hw.pf_id;
341341

342342
/* As FW supports only port split options for whole device,
343343
* set port split options only for first PF.
@@ -455,7 +455,7 @@ int ice_devlink_create_vf_port(struct ice_vf *vf)
455455
return -EINVAL;
456456

457457
attrs.flavour = DEVLINK_PORT_FLAVOUR_PCI_VF;
458-
attrs.pci_vf.pf = pf->hw.bus.func;
458+
attrs.pci_vf.pf = pf->hw.pf_id;
459459
attrs.pci_vf.vf = vf->vf_id;
460460

461461
ice_devlink_set_switch_id(pf, &attrs.switch_id);

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,25 @@ static void ice_xsk_pool_fill_cb(struct ice_rx_ring *ring)
512512
xsk_pool_fill_cb(ring->xsk_pool, &desc);
513513
}
514514

515+
/**
516+
* ice_get_frame_sz - calculate xdp_buff::frame_sz
517+
* @rx_ring: the ring being configured
518+
*
519+
* Return frame size based on underlying PAGE_SIZE
520+
*/
521+
static unsigned int ice_get_frame_sz(struct ice_rx_ring *rx_ring)
522+
{
523+
unsigned int frame_sz;
524+
525+
#if (PAGE_SIZE >= 8192)
526+
frame_sz = rx_ring->rx_buf_len;
527+
#else
528+
frame_sz = ice_rx_pg_size(rx_ring) / 2;
529+
#endif
530+
531+
return frame_sz;
532+
}
533+
515534
/**
516535
* ice_vsi_cfg_rxq - Configure an Rx queue
517536
* @ring: the ring being configured
@@ -576,7 +595,7 @@ static int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)
576595
}
577596
}
578597

579-
xdp_init_buff(&ring->xdp, ice_rx_pg_size(ring) / 2, &ring->xdp_rxq);
598+
xdp_init_buff(&ring->xdp, ice_get_frame_sz(ring), &ring->xdp_rxq);
580599
ring->xdp.data = NULL;
581600
ring->xdp_ext.pkt_ctx = &ring->pkt_ctx;
582601
err = ice_setup_rx_ctx(ring);

drivers/net/ethernet/intel/ice/ice_txrx.c

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -521,30 +521,6 @@ int ice_setup_rx_ring(struct ice_rx_ring *rx_ring)
521521
return -ENOMEM;
522522
}
523523

524-
/**
525-
* ice_rx_frame_truesize
526-
* @rx_ring: ptr to Rx ring
527-
* @size: size
528-
*
529-
* calculate the truesize with taking into the account PAGE_SIZE of
530-
* underlying arch
531-
*/
532-
static unsigned int
533-
ice_rx_frame_truesize(struct ice_rx_ring *rx_ring, const unsigned int size)
534-
{
535-
unsigned int truesize;
536-
537-
#if (PAGE_SIZE < 8192)
538-
truesize = ice_rx_pg_size(rx_ring) / 2; /* Must be power-of-2 */
539-
#else
540-
truesize = rx_ring->rx_offset ?
541-
SKB_DATA_ALIGN(rx_ring->rx_offset + size) +
542-
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) :
543-
SKB_DATA_ALIGN(size);
544-
#endif
545-
return truesize;
546-
}
547-
548524
/**
549525
* ice_run_xdp - Executes an XDP program on initialized xdp_buff
550526
* @rx_ring: Rx ring
@@ -837,16 +813,15 @@ ice_can_reuse_rx_page(struct ice_rx_buf *rx_buf)
837813
if (!dev_page_is_reusable(page))
838814
return false;
839815

840-
#if (PAGE_SIZE < 8192)
841816
/* if we are only owner of page we can reuse it */
842817
if (unlikely(rx_buf->pgcnt - pagecnt_bias > 1))
843818
return false;
844-
#else
819+
#if (PAGE_SIZE >= 8192)
845820
#define ICE_LAST_OFFSET \
846-
(SKB_WITH_OVERHEAD(PAGE_SIZE) - ICE_RXBUF_2048)
821+
(SKB_WITH_OVERHEAD(PAGE_SIZE) - ICE_RXBUF_3072)
847822
if (rx_buf->page_offset > ICE_LAST_OFFSET)
848823
return false;
849-
#endif /* PAGE_SIZE < 8192) */
824+
#endif /* PAGE_SIZE >= 8192) */
850825

851826
/* If we have drained the page fragment pool we need to update
852827
* the pagecnt_bias and page count so that we fully restock the
@@ -949,12 +924,7 @@ ice_get_rx_buf(struct ice_rx_ring *rx_ring, const unsigned int size,
949924
struct ice_rx_buf *rx_buf;
950925

951926
rx_buf = &rx_ring->rx_buf[ntc];
952-
rx_buf->pgcnt =
953-
#if (PAGE_SIZE < 8192)
954-
page_count(rx_buf->page);
955-
#else
956-
0;
957-
#endif
927+
rx_buf->pgcnt = page_count(rx_buf->page);
958928
prefetchw(rx_buf->page);
959929

960930
if (!size)
@@ -1160,11 +1130,6 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget)
11601130
bool failure;
11611131
u32 first;
11621132

1163-
/* Frame size depend on rx_ring setup when PAGE_SIZE=4K */
1164-
#if (PAGE_SIZE < 8192)
1165-
xdp->frame_sz = ice_rx_frame_truesize(rx_ring, 0);
1166-
#endif
1167-
11681133
xdp_prog = READ_ONCE(rx_ring->xdp_prog);
11691134
if (xdp_prog) {
11701135
xdp_ring = rx_ring->xdp_ring;
@@ -1223,10 +1188,6 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget)
12231188
hard_start = page_address(rx_buf->page) + rx_buf->page_offset -
12241189
offset;
12251190
xdp_prepare_buff(xdp, hard_start, offset, size, !!offset);
1226-
#if (PAGE_SIZE > 4096)
1227-
/* At larger PAGE_SIZE, frame_sz depend on len size */
1228-
xdp->frame_sz = ice_rx_frame_truesize(rx_ring, size);
1229-
#endif
12301191
xdp_buff_clear_frags_flag(xdp);
12311192
} else if (ice_add_xdp_frag(rx_ring, xdp, rx_buf, size)) {
12321193
break;

0 commit comments

Comments
 (0)