DPDK usage discussions
 help / color / mirror / Atom feed
* [i40e] can i40e NIC send tcp packets split by rte_gso_segment
@ 2022-09-28  1:51 jiangheng (G)
  0 siblings, 0 replies; 3+ messages in thread
From: jiangheng (G) @ 2022-09-28  1:51 UTC (permalink / raw)
  To: users

Hello

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++) {   // head->nb_segs = 3
    m->ol_flags = PKT_TX_IPV4 | PKT_TX_TCP_CKSUM | PKT_TX_IP_CKSUM | PKT_TX_TCP_SEG | DEV_TX_OFFLOAD_TCP_TSO; // 0xd4000000000020
    // 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;
}
tx_xmit(head);

The tcp package split by rte_gso_segment can transfer to i40e_xmit_pkts function: 
nb_segments = 3;
gso_segments[i]->nb_segs = 2;
gso_segments[0]->pkt_len = 1514;
gso_segments[0]->data_len = 54, gso_segments[0]->next->data_len = 1460;
gso_segments[0]->ol_flags = 0xd0000000000020

i40e_xmit_pkts returns 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 ? 


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

* [i40e] Can i40e NIC send tcp packets split by rte_gso_segment
@ 2022-09-27 13:27 jiangheng
  0 siblings, 0 replies; 3+ messages in thread
From: jiangheng @ 2022-09-27 13:27 UTC (permalink / raw)
  To: users

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 ? 


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

* [i40e] can i40e NIC send tcp packets split by rte_gso_segment
@ 2022-09-27 12:08 jiangheng
  0 siblings, 0 replies; 3+ messages in thread
From: jiangheng @ 2022-09-27 12:08 UTC (permalink / raw)
  To: users

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 ? 


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

end of thread, other threads:[~2022-10-04  6:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28  1:51 [i40e] can i40e NIC send tcp packets split by rte_gso_segment jiangheng (G)
  -- strict thread matches above, loose matches on Subject: below --
2022-09-27 13:27 [i40e] Can " jiangheng
2022-09-27 12:08 [i40e] can " jiangheng

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