[i40e] Can i40e NIC send tcp packets split by rte_gso_segment
jiangheng
15720603159 at 163.com
Tue Sep 27 15:27:43 CEST 2022
Hi team
I coded a dameon based on dpdk, and I am using GSO(generic segment offload) feature in dpdk19.11, however this feature does not work on i40e NIC.
below is some of my code:
struct rte_gso_ctx gso_ctx;
int gso_ctx_setup(struct rte_gso_ctx *gso_ctx, int port_id)
{
struct rte_mempool *mp = rte_mempool_lookup("gso_pool", 128 * 10, 4, 0, RTE_PKTMBUF_HEADROOM + 128, SOCKET_ID_ANY);
gso_ctx->direct_pool = mp;
gso_ctx->indirect_pool = mp;
gso_ctx->gso_types = DEV_TX_OFFLOAD_TCP_TSO;
gso_ctx->gso_szie = 1514;
gso_ctx->flag = 0;
return 0;
}
then I use the following function to split and send the input large tcp packets:
#define GSO_MAX_PKT_BURST 128
// pkt have 3 nb_segs, pkt_len is 1514 + 1460 + 1460 ....
tx_xmit (struct rte_mbuf *pkt)
{
uint32_t sent_pkts = 0;
struct rte_mbuf *gso_segments[GSO_MAX_PKT_BURST];
uint16_t nb_segments = 0;
int ret;
ret = rte_gso_segment(pkt, &gso_ctx, &gso_segments[nb_segments], GSO_MAX_PKT_BURST - nb_segments);
if (ret > 0) {
nb_segments += ret;
} else {
printf("unable to segment packet\n");
rte_pktmbuf_free(pkt);
}
rte_eth_tx_burst(port_id, queue_id, &gso_segments[0], nb_segments)
}
mbuf initialization:
struct rte_mbuf *head = m;
for (int i =0; i < head->nb_segs; i++) {
m->ol_flags = PKT_TX_IPV4 | PKT_TX_TCP_CKSUM | PKT_TX_IP_CKSUM | PKT_TX_TCP_SEG | DEV_TCP_OFFLOAD_TCP_TSO;
// i am sure the tcp header and data are correct
m->data_len = 1514 or 1460;
m->pkt_len = 1514 + 1460 + 1460;
m->l2_len = 14;
m->l3_len = 20;
m->l4_len = 20;
m = m->next;
}
The tcp package split by rte_gso_segment can transfer to i40e_xmit_pkts function ,and it retrurn ok, but the tcp data cannot be sent out.
The same code can sent tcp data correctly if the hinic NIC is used.
please help check whether the above configuration are correct if used i40e NIC? By the way, how do i enable TSO feature for i40e NIC in dpdk19.11 ?
More information about the users
mailing list