From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by dpdk.org (Postfix) with ESMTP id D642D7F9C for ; Fri, 14 Nov 2014 17:54:02 +0100 (CET) Received: by mail-wi0-f174.google.com with SMTP id h11so81242wiw.1 for ; Fri, 14 Nov 2014 09:04:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QagW+9wlCs2AB5OfYeV+3bJnFdb6hDIzROn0mYjzO3I=; b=lODKJ+B72g6xnx/6k0rtDFDbksoh0T2DT9ItDSo0/RUIuSaZpJNQ/TrL1sYZldQOlt VToQYiLjo05AnHbi+XN256vDpKPamgymZHu+gIwBaPmP+KzNw8o09L3I1zJq+leXa7G7 VvxRN2fNFmjMa+nnxLTarsijmsnJ8Jcojr5tV+AJYfzGiT9v1023eHUDN+oK6Kpyy2wZ XaWsAr+k5ClYCf6ERUf3S7da1bLDZLXCvLQmLlDq3ag4ujT3YQKMacvBTTl+qUSFU1iE RJHMAP7WYxDaXtGrjuCrVTsTjgyHQz15/VX2BI6xd2xUaTsCA9PNbzSh4ByJ15JpkN/X ukAg== X-Gm-Message-State: ALoCoQnz2fI5sTtoWb3FT2dD9eWlyq8D2ehjHxNft+MKROw7/yvFHSv55y7o7AlBJ6YvQekBbzrY X-Received: by 10.194.170.232 with SMTP id ap8mr15765004wjc.2.1415984646583; Fri, 14 Nov 2014 09:04:06 -0800 (PST) Received: from glumotte.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id cu9sm40352554wjb.0.2014.11.14.09.04.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Nov 2014 09:04:06 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Fri, 14 Nov 2014 18:03:29 +0100 Message-Id: <1415984609-2484-14-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1415984609-2484-1-git-send-email-olivier.matz@6wind.com> References: <1415635166-1364-1-git-send-email-olivier.matz@6wind.com> <1415984609-2484-1-git-send-email-olivier.matz@6wind.com> Cc: jigsaw@gmail.com Subject: [dpdk-dev] [PATCH v2 13/13] testpmd: add a verbose mode csum forward engine X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Nov 2014 16:54:03 -0000 If the user specifies 'set verbose 1' in testpmd command line, the csum forward engine will dump some informations about received and transmitted packets, especially which flags are set and what values are assigned to l2_len, l3_len, l4_len and tso_segsz. This can help someone implementing TSO or hardware checksum offload to understand how to configure the mbufs. Example of output for one packet: -------------- rx: l2_len=14 ethertype=800 l3_len=20 l4_proto=6 l4_len=20 tx: m->l2_len=14 m->l3_len=20 m->l4_len=20 tx: m->tso_segsz=800 tx: flags=PKT_TX_IP_CKSUM PKT_TX_TCP_SEG -------------- Signed-off-by: Olivier Matz --- app/test-pmd/csumonly.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 9a2beac..9e8c811 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -459,6 +459,57 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) m->tso_segsz = tso_segsz; m->ol_flags = ol_flags; + /* if verbose mode is enabled, dump debug info */ + if (verbose_level > 0) { + struct { + uint64_t flag; + uint64_t mask; + } tx_flags[] = { + { PKT_TX_IP_CKSUM, PKT_TX_IP_CKSUM }, + { PKT_TX_UDP_CKSUM, PKT_TX_L4_MASK }, + { PKT_TX_TCP_CKSUM, PKT_TX_L4_MASK }, + { PKT_TX_SCTP_CKSUM, PKT_TX_L4_MASK }, + { PKT_TX_VXLAN_CKSUM, PKT_TX_VXLAN_CKSUM }, + { PKT_TX_TCP_SEG, PKT_TX_TCP_SEG }, + }; + unsigned j; + const char *name; + + printf("-----------------\n"); + /* dump rx parsed packet info */ + printf("rx: l2_len=%d ethertype=%x l3_len=%d " + "l4_proto=%d l4_len=%d\n", + l2_len, rte_be_to_cpu_16(ethertype), + l3_len, l4_proto, l4_len); + if (tunnel == 1) + printf("rx: outer_l2_len=%d outer_ethertype=%x " + "outer_l3_len=%d\n", outer_l2_len, + rte_be_to_cpu_16(outer_ethertype), + outer_l3_len); + /* dump tx packet info */ + if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM | + TESTPMD_TX_OFFLOAD_UDP_CKSUM | + TESTPMD_TX_OFFLOAD_TCP_CKSUM | + TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) || + tso_segsz != 0) + printf("tx: m->l2_len=%d m->l3_len=%d " + "m->l4_len=%d\n", + m->l2_len, m->l3_len, m->l4_len); + if ((tunnel == 1) && + (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_VXLAN_CKSUM)) + printf("tx: m->inner_l2_len=%d m->inner_l3_len=%d\n", + m->inner_l2_len, m->inner_l3_len); + if (tso_segsz != 0) + printf("tx: m->tso_segsz=%d\n", m->tso_segsz); + printf("tx: flags="); + for (j = 0; j < sizeof(tx_flags)/sizeof(*tx_flags); j++) { + name = rte_get_tx_ol_flag_name(tx_flags[j].flag); + if ((m->ol_flags & tx_flags[j].mask) == + tx_flags[j].flag) + printf("%s ", name); + } + printf("\n"); + } } nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx); fs->tx_packets += nb_tx; -- 2.1.0