DPDK usage discussions
 help / color / mirror / Atom feed
* UDP Checksum offload with X550-T2
@ 2025-02-07 13:00 Alan Beadle
  2025-02-07 13:44 ` Alan Beadle
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Beadle @ 2025-02-07 13:00 UTC (permalink / raw)
  To: users

Hello,

I am trying to enable UDP checksum offload with an Intel X550-T2 NIC
with DPDK 23.11. The problem is that the rte_eth_tx_burst() fails when
I attempt to send an mbuf which is configured for checksum offload.

Here is what i see for this NIC when I run dpdk-devbind.py --status:
Network devices using DPDK-compatible driver
============================================
0000:65:00.1 'Ethernet Controller 10G X550T 1563' drv=vfio-pci
unused=uio_pci_generic

I have read the following page but it was difficult to tell if
anything described there applies in this case. Is what I'm trying to
do supported, or not?
https://doc.dpdk.org/guides-23.11/nics/ixgbe.html

The code was previously working when I was using a software-computed
checksum (with rte_ipv4_udptcp_cksum()).

Here is the new code I added for offload:

// When setting up the port
port_conf.txmode.offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM |
RTE_ETH_TX_OFFLOAD_UDP_CKSUM;

// When configuring the device
if (!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) ||
!(dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)) {
    rte_panic(" offload not supported");
}else{
    std::cout << "offload supported\n";
}

// Before copying the payload into the mbuf
pkt->ol_flags = RTE_MBUF_F_TX_IPV4 | RTE_MBUF_F_TX_IP_CKSUM |
RTE_MBUF_F_TX_UDP_CKSUM;
pkt->l2_len = sizeof(struct rte_ether_hdr);
pkt->l3_len = sizeof(struct rte_ipv4_hdr);

// Right before the tx_burst() call
udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ip_hdr, pkt->ol_flags);
ip_hdr->hdr_checksum = 0;

Please let me know if I am doing anything wrong here. Thank you.
-Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: UDP Checksum offload with X550-T2
  2025-02-07 13:00 UDP Checksum offload with X550-T2 Alan Beadle
@ 2025-02-07 13:44 ` Alan Beadle
  2025-02-07 22:34   ` Alan Beadle
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Beadle @ 2025-02-07 13:44 UTC (permalink / raw)
  To: users

I found examples that showed the last two lines from my prior email in
reversed order (that is, set ip_hdr->hdr_checksum = 0 before calling
rte_ipv4_phdr_cksum()). I switched those lines and it sometimes works
now, but eventually fails again (after several hundred thousand
packets) whereas the tx_burst() was reliable before I tried to use
offload. Is there still something else wrong here?

-Alan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: UDP Checksum offload with X550-T2
  2025-02-07 13:44 ` Alan Beadle
@ 2025-02-07 22:34   ` Alan Beadle
  2025-02-07 22:52     ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Beadle @ 2025-02-07 22:34 UTC (permalink / raw)
  To: users

Apparently I just needed to increase the TX ring size. I'm still
having trouble getting anywhere close to the theoretical 10 gigabit
bandwidth of my NIC without running into TX failures. Should that be
feasible with an MTU of 1514 bytes? I'm not even taxing the CPU very
much now that checksum offload is working.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: UDP Checksum offload with X550-T2
  2025-02-07 22:34   ` Alan Beadle
@ 2025-02-07 22:52     ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2025-02-07 22:52 UTC (permalink / raw)
  To: Alan Beadle; +Cc: users

On Fri, 7 Feb 2025 17:34:47 -0500
Alan Beadle <ab.beadle@gmail.com> wrote:

> Apparently I just needed to increase the TX ring size. I'm still
> having trouble getting anywhere close to the theoretical 10 gigabit
> bandwidth of my NIC without running into TX failures. Should that be
> feasible with an MTU of 1514 bytes? I'm not even taxing the CPU very
> much now that checksum offload is working.

Remember that 10 gigabit includes all the other overheads like headers, inter-frame gap etc.
MTU is usually expressed independent of headers.
	
	Interframe gap = 96 bits = 12 bytes
	max frame size = 1518 bytes (Ether + MTU + CRC)

If you are using IP + UDP need to subtract those headers as well.
Which means 1500 becomes 1440 bytes.

With DPDK, the transmit cleanup is controlled via tx_free_thresh
which may need adjust as well.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-07 22:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-07 13:00 UDP Checksum offload with X550-T2 Alan Beadle
2025-02-07 13:44 ` Alan Beadle
2025-02-07 22:34   ` Alan Beadle
2025-02-07 22:52     ` Stephen Hemminger

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).