From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: Wei Dai <wei.dai@intel.com>
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>,
Fangfang Wei <fangfangx.wei@intel.com>,
Konstantin Ananyev <konstantin.ananyev@intel.com>,
dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'examples/ip_fragmentation: fix check of packet type' has been queued to LTS release 16.11.2
Date: Fri, 7 Apr 2017 16:11:24 +0800 [thread overview]
Message-ID: <1491552724-3034-7-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1491552724-3034-1-git-send-email-yuanhan.liu@linux.intel.com>
Hi,
FYI, your patch has been queued to LTS release 16.11.2
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 04/11/17.
So please shout if anyone has objections.
Thanks.
--yliu
---
>From af67067d280646db649e8ede585d404075081d20 Mon Sep 17 00:00:00 2001
From: Wei Dai <wei.dai@intel.com>
Date: Tue, 14 Mar 2017 22:47:49 +0800
Subject: [PATCH] examples/ip_fragmentation: fix check of packet type
[ upstream commit 201d52bc0df70fd5dde9a79b5b6cd70a21f6fd34 ]
The packet_type in mbuf is not correctly filled by ixgbe 82599 NIC.
To use the ether_type in ethernet header to check packet type is
more reliaber.
Fixes: 3c0184cc0c60 ("examples: replace some offload flags with packet type")
Fixes: ab351fe1c95c ("mbuf: remove packet type from offload flags")
Reported-by: Fangfang Wei <fangfangx.wei@intel.com>
Signed-off-by: Wei Dai <wei.dai@intel.com>
Tested-by: Fangfang Wei <fangfangx.wei@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
examples/ip_fragmentation/main.c | 74 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c
index e1e32c6..349a72c 100644
--- a/examples/ip_fragmentation/main.c
+++ b/examples/ip_fragmentation/main.c
@@ -653,6 +653,74 @@ check_all_ports_link_status(uint8_t port_num, uint32_t port_mask)
}
}
+/* Check L3 packet type detection capablity of the NIC port */
+static int
+check_ptype(int portid)
+{
+ int i, ret;
+ int ptype_l3_ipv4 = 0, ptype_l3_ipv6 = 0;
+ uint32_t ptype_mask = RTE_PTYPE_L3_MASK;
+
+ ret = rte_eth_dev_get_supported_ptypes(portid, ptype_mask, NULL, 0);
+ if (ret <= 0)
+ return 0;
+
+ uint32_t ptypes[ret];
+
+ ret = rte_eth_dev_get_supported_ptypes(portid, ptype_mask, ptypes, ret);
+ for (i = 0; i < ret; ++i) {
+ if (ptypes[i] & RTE_PTYPE_L3_IPV4)
+ ptype_l3_ipv4 = 1;
+ if (ptypes[i] & RTE_PTYPE_L3_IPV6)
+ ptype_l3_ipv6 = 1;
+ }
+
+ if (ptype_l3_ipv4 == 0)
+ printf("port %d cannot parse RTE_PTYPE_L3_IPV4\n", portid);
+
+ if (ptype_l3_ipv6 == 0)
+ printf("port %d cannot parse RTE_PTYPE_L3_IPV6\n", portid);
+
+ if (ptype_l3_ipv4 && ptype_l3_ipv6)
+ return 1;
+
+ return 0;
+
+}
+
+/* Parse packet type of a packet by SW */
+static inline void
+parse_ptype(struct rte_mbuf *m)
+{
+ struct ether_hdr *eth_hdr;
+ uint32_t packet_type = RTE_PTYPE_UNKNOWN;
+ uint16_t ether_type;
+
+ eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);
+ ether_type = eth_hdr->ether_type;
+ if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4))
+ packet_type |= RTE_PTYPE_L3_IPV4_EXT_UNKNOWN;
+ else if (ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6))
+ packet_type |= RTE_PTYPE_L3_IPV6_EXT_UNKNOWN;
+
+ m->packet_type = packet_type;
+}
+
+/* callback function to detect packet type for a queue of a port */
+static uint16_t
+cb_parse_ptype(uint8_t port __rte_unused, uint16_t queue __rte_unused,
+ struct rte_mbuf *pkts[], uint16_t nb_pkts,
+ uint16_t max_pkts __rte_unused,
+ void *user_param __rte_unused)
+{
+ uint16_t i;
+
+ for (i = 0; i < nb_pkts; ++i)
+ parse_ptype(pkts[i]);
+
+ return nb_pkts;
+}
+
static int
init_routing_table(void)
{
@@ -944,6 +1012,12 @@ main(int argc, char **argv)
ret, portid);
rte_eth_promiscuous_enable(portid);
+
+ if (check_ptype(portid) == 0) {
+ rte_eth_add_rx_callback(portid, 0, cb_parse_ptype, NULL);
+ printf("Add Rx callback funciton to detect L3 packet type by SW :"
+ " port = %d\n", portid);
+ }
}
if (init_routing_table() < 0)
--
1.9.0
next prev parent reply other threads:[~2017-04-07 8:14 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-07 8:11 [dpdk-stable] patch 'pci: fix device registration on FreeBSD' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'kni: fix build with kernel 4.11' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'vfio: fix disabling INTx' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'vfio: fix secondary process start' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'nic_uio: fix device binding at boot' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'eal/linux: fix build with glibc 2.25' " Yuanhan Liu
2017-04-07 8:11 ` Yuanhan Liu [this message]
2017-04-07 8:11 ` [dpdk-stable] patch 'kni: fix build on Suse 12 SP3' " Yuanhan Liu
2017-04-10 10:01 ` Nirmoy Das
2017-04-11 12:38 ` Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/i40e: fix TC bitmap of VEB' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx5: fix VLAN stripping indication' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/i40e: fix compile error' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/bnx2x: fix transmit queue free threshold' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/e1000/base: fix multicast setting in VF' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx5: fix supported packets types' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/ixgbe/base: fix build error' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/ixgbe: fix Rx queue blocking issue' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/ixgbe: fix all queues drop setting of DCB' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/ixgbe: fix multi-queue mode check in SRIOV mode' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'app/testpmd: fix init config for multi-queue " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'app/testpmd: fix TC mapping in DCB init config' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/i40e: fix incorrect packet index reference' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/ixgbevf: set xstats id values' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/pcap: fix using mbuf after freeing it' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/ena: fix return of hash control flushing' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/thunderx: fix 32-bit build' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/thunderx: fix build on FreeBSD' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx4: update link status upon probing with LSC' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/i40e/base: fix potential out of bound array access' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx5: fix reusing Rx/Tx queues' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/ixgbe: fix TC bandwidth setting' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx4: fix returned values upon failed probing' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx5: " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/fm10k: fix pointer cast' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/qede: fix missing UDP protocol in RSS offload types' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx5: fix Tx when first segment size is too short' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'vhost: change log levels in client mode' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'vhost: fix multiple queue not enabled for old kernels' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'vhost: fix max queues' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'vhost: fix false sharing' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'vhost: fix fd leaks for vhost-user server mode' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'net/mlx5: fix an uninitialized variable' " Yuanhan Liu
2017-04-07 8:11 ` [dpdk-stable] patch 'mk: fix shell errors when building with clang' " Yuanhan Liu
2017-04-07 8:12 ` [dpdk-stable] patch 'mk: fix lib filtering when linking app' " Yuanhan Liu
2017-04-07 8:12 ` [dpdk-stable] patch 'examples/quota_watermark: fix requirement for 2M pages' " Yuanhan Liu
2017-04-07 8:12 ` [dpdk-stable] patch 'net/vmxnet3: fix queue size changes' " Yuanhan Liu
2017-04-07 8:12 ` [dpdk-stable] patch 'net/virtio-user: fix overflow' " Yuanhan Liu
2017-04-07 8:12 ` [dpdk-stable] patch 'net/virtio: disable LSC interrupt if MSIX not enabled' " Yuanhan Liu
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=1491552724-3034-7-git-send-email-yuanhan.liu@linux.intel.com \
--to=yuanhan.liu@linux.intel.com \
--cc=fangfangx.wei@intel.com \
--cc=konstantin.ananyev@intel.com \
--cc=stable@dpdk.org \
--cc=wei.dai@intel.com \
/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).