DPDK usage discussions
 help / color / mirror / Atom feed
From: jiangheng <15720603159@163.com>
To: users@dpdk.org
Subject: [i40e] can i40e NIC send tcp packets split by rte_gso_segment
Date: Tue, 27 Sep 2022 20:08:43 +0800 (CST)	[thread overview]
Message-ID: <2aa1855b.ca49.1837ed9740b.Coremail.15720603159@163.com> (raw)

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 ? 


             reply	other threads:[~2022-10-04  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 12:08 jiangheng [this message]
2022-09-27 13:27 [i40e] Can " jiangheng
2022-09-28  1:51 [i40e] can " jiangheng (G)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2aa1855b.ca49.1837ed9740b.Coremail.15720603159@163.com \
    --to=15720603159@163.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).