aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2019-01-25 09:50:32 -0800
committerAshish Chaudhari <ashish.chaudhari@ettus.com>2019-01-25 13:30:22 -0800
commita293410435d085cf8e2e736d68197e10709c92f4 (patch)
treeff5e5b9fff1228c409385608f3c394dc33dc9ec4 /host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c
parent090bd9a625570c0f8a357cfb15074011c1c4b908 (diff)
downloaduhd-a293410435d085cf8e2e736d68197e10709c92f4.tar.gz
uhd-a293410435d085cf8e2e736d68197e10709c92f4.tar.bz2
uhd-a293410435d085cf8e2e736d68197e10709c92f4.zip
uhd-dpdk: Cover all paths to request TX offloads
Some NICs were not enabling TX IP checksum offloads. This fixes that issue.
Diffstat (limited to 'host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c')
-rw-r--r--host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c b/host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c
index 4fc375b77..9429cd6cb 100644
--- a/host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c
+++ b/host/lib/transport/uhd-dpdk/uhd_dpdk_udp.c
@@ -457,11 +457,13 @@ static void uhd_dpdk_ipv4_prep(struct uhd_dpdk_port *port,
ip_hdr->fragment_offset = rte_cpu_to_be_16(IPV4_HDR_DF_FLAG);
ip_hdr->time_to_live = 64;
ip_hdr->next_proto_id = proto_id;
- ip_hdr->hdr_checksum = 0; /* FIXME: Assuming hardware can offload */
- mbuf->ol_flags |= PKT_TX_IP_CKSUM;
+ ip_hdr->hdr_checksum = 0; // Require HW offload
ip_hdr->src_addr = port->ipv4_addr;
ip_hdr->dst_addr = dst_ipv4_addr;
+ mbuf->ol_flags = PKT_TX_IP_CKSUM | PKT_TX_IPV4;
+ mbuf->l2_len = sizeof(struct ether_hdr);
+ mbuf->l3_len = sizeof(struct ipv4_hdr);
mbuf->pkt_len = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + payload_len;
mbuf->data_len = sizeof(struct ether_hdr) + sizeof(struct ipv4_hdr) + payload_len;
}
@@ -493,6 +495,7 @@ int uhd_dpdk_udp_prep(struct uhd_dpdk_socket *sock,
tx_hdr->dst_port = pdata->dst_port;
tx_hdr->dgram_len = rte_cpu_to_be_16(8 + udp_data_len);
tx_hdr->dgram_cksum = 0;
+ mbuf->l4_len = sizeof(struct udp_hdr);
return 0;
}