summaryrefslogtreecommitdiffstats
path: root/dpdk/dpdk-16.07_patches/0002-i40e-Enable-bad-checksum-flags-in-i40e-vPMD.patch
blob: 58256f191cf6e882fa1a84dd0d700f9fa3cc0cb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 5917bd1cf9857979a7cae89f362d2c885f09d034 Mon Sep 17 00:00:00 2001
From: Damjan Marion <damarion@cisco.com>
Date: Thu, 14 Jul 2016 09:59:02 -0700
Subject: [PATCH 2/2] i40e: Enable bad checksum flags in i40e vPMD

Decode the checksum flags from the rx descriptor, setting
the appropriate bit in the mbuf ol_flags field when the flag
indicates a bad checksum.

Signed-off-by: Damjan Marion <damarion@cisco.com>
Signed-off-by: Jeff Shaw <jeffrey.b.shaw@intel.com>
---
 drivers/net/i40e/i40e_rxtx_vec.c | 48 +++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c
index e78ac63..ace51df 100644
--- a/drivers/net/i40e/i40e_rxtx_vec.c
+++ b/drivers/net/i40e/i40e_rxtx_vec.c
@@ -138,19 +138,14 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq)
 static inline void
 desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 {
-	__m128i vlan0, vlan1, rss;
-	union {
-		uint16_t e[4];
-		uint64_t dword;
-	} vol;
+	__m128i vlan0, vlan1, rss, l3_l4e;
 
 	/* mask everything except RSS, flow director and VLAN flags
 	 * bit2 is for VLAN tag, bit11 for flow director indication
 	 * bit13:12 for RSS indication.
 	 */
-	const __m128i rss_vlan_msk = _mm_set_epi16(
-			0x0000, 0x0000, 0x0000, 0x0000,
-			0x3804, 0x3804, 0x3804, 0x3804);
+	const __m128i rss_vlan_msk = _mm_set_epi32(
+			0x1c03004, 0x1c03004, 0x1c03004, 0x1c03004);
 
 	/* map rss and vlan type to rss hash and vlan flag */
 	const __m128i vlan_flags = _mm_set_epi8(0, 0, 0, 0,
@@ -163,23 +158,36 @@ desc_to_olflags_v(__m128i descs[4], struct rte_mbuf **rx_pkts)
 			PKT_RX_RSS_HASH | PKT_RX_FDIR, PKT_RX_RSS_HASH, 0, 0,
 			0, 0, PKT_RX_FDIR, 0);
 
-	vlan0 = _mm_unpackhi_epi16(descs[0], descs[1]);
-	vlan1 = _mm_unpackhi_epi16(descs[2], descs[3]);
-	vlan0 = _mm_unpacklo_epi32(vlan0, vlan1);
+	const __m128i l3_l4e_flags = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0,
+			PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
+			PKT_RX_EIP_CKSUM_BAD | PKT_RX_L4_CKSUM_BAD,
+			PKT_RX_EIP_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
+			PKT_RX_EIP_CKSUM_BAD,
+			PKT_RX_L4_CKSUM_BAD | PKT_RX_IP_CKSUM_BAD,
+			PKT_RX_L4_CKSUM_BAD,
+			PKT_RX_IP_CKSUM_BAD,
+			0);
+
+	vlan0 = _mm_unpackhi_epi32(descs[0], descs[1]);
+	vlan1 = _mm_unpackhi_epi32(descs[2], descs[3]);
+	vlan0 = _mm_unpacklo_epi64(vlan0, vlan1);
 
 	vlan1 = _mm_and_si128(vlan0, rss_vlan_msk);
 	vlan0 = _mm_shuffle_epi8(vlan_flags, vlan1);
 
-	rss = _mm_srli_epi16(vlan1, 11);
+	rss = _mm_srli_epi32(vlan1, 12);
 	rss = _mm_shuffle_epi8(rss_flags, rss);
 
+	l3_l4e = _mm_srli_epi32(vlan1, 22);
+	l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e);
+
 	vlan0 = _mm_or_si128(vlan0, rss);
-	vol.dword = _mm_cvtsi128_si64(vlan0);
+	vlan0 = _mm_or_si128(vlan0, l3_l4e);
 
-	rx_pkts[0]->ol_flags = vol.e[0];
-	rx_pkts[1]->ol_flags = vol.e[1];
-	rx_pkts[2]->ol_flags = vol.e[2];
-	rx_pkts[3]->ol_flags = vol.e[3];
+	rx_pkts[0]->ol_flags = _mm_extract_epi16(vlan0, 0);
+	rx_pkts[1]->ol_flags = _mm_extract_epi16(vlan0, 2);
+	rx_pkts[2]->ol_flags = _mm_extract_epi16(vlan0, 4);
+	rx_pkts[3]->ol_flags = _mm_extract_epi16(vlan0, 6);
 }
 #else
 #define desc_to_olflags_v(desc, rx_pkts) do {} while (0)
@@ -754,7 +762,8 @@ i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 #ifndef RTE_LIBRTE_I40E_RX_OLFLAGS_ENABLE
 	/* whithout rx ol_flags, no VP flag report */
 	if (rxmode->hw_vlan_strip != 0 ||
-	    rxmode->hw_vlan_extend != 0)
+	    rxmode->hw_vlan_extend != 0 ||
+	    rxmode->hw_ip_checksum != 0)
 		return -1;
 #endif
 
@@ -765,8 +774,7 @@ i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev *dev)
 	 /* - no csum error report support
 	 * - no header split support
 	 */
-	if (rxmode->hw_ip_checksum == 1 ||
-	    rxmode->header_split == 1)
+	if (rxmode->header_split == 1)
 		return -1;
 
 	return 0;
-- 
2.7.4
n">next, dst); if (l) { old_distance = l->distance; l->distance = distance; l = graph_dir_get_link_to_node (&dst_node->prev, src); l->distance = distance; } else { uword li_next, li_prev; old_distance = ~0; li_next = graph_dir_add_link (&src_node->next, dst, distance); li_prev = graph_dir_add_link (&dst_node->prev, src, distance); l = vec_elt_at_index (src_node->next.links, li_next); l->link_to_self_index = li_prev; l = vec_elt_at_index (dst_node->prev.links, li_prev); l->link_to_self_index = li_next; } return old_distance; } void graph_del_link (graph_t * g, u32 src, u32 dst) { graph_node_t *src_node, *dst_node; src_node = pool_elt_at_index (g->nodes, src); dst_node = pool_elt_at_index (g->nodes, dst); graph_dir_del_link (&src_node->next, dst); graph_dir_del_link (&dst_node->next, src); } /* Delete source node and all links from other nodes from/to source. */ uword graph_del_node (graph_t * g, u32 src) { graph_node_t *src_node, *n; uword index; graph_link_t *l; src_node = pool_elt_at_index (g->nodes, src); vec_foreach (l, src_node->next.links) { n = pool_elt_at_index (g->nodes, l->node_index); graph_dir_del_link (&n->prev, src); } vec_foreach (l, src_node->prev.links) { n = pool_elt_at_index (g->nodes, l->node_index); graph_dir_del_link (&n->next, src); } graph_dir_free (&src_node->next); graph_dir_free (&src_node->prev); index = src_node - g->nodes; pool_put (g->nodes, src_node); memset (src_node, ~0, sizeof (src_node[0])); return index; } uword unformat_graph (unformat_input_t * input, va_list * args) { graph_t *g = va_arg (*args, graph_t *); typedef struct { u32 src, dst, distance; } T; T *links = 0, *l; uword result; while (1) { vec_add2 (links, l, 1); if (!unformat (input, "%d%d%d", &l->src, &l->dst, &l->distance)) break; } _vec_len (links) -= 1; result = vec_len (links) > 0; vec_foreach (l, links) { graph_set_link (g, l->src, l->dst, l->distance); graph_set_link (g, l->dst, l->src, l->distance); } vec_free (links); return result; } u8 * format_graph_node (u8 * s, va_list * args) { graph_t *g = va_arg (*args, graph_t *); u32 node_index = va_arg (*args, u32); if (g->format_node) s = format (s, "%U", g->format_node, g, node_index); else s = format (s, "%d", node_index); return s; } u8 * format_graph (u8 * s, va_list * args) { graph_t *g = va_arg (*args, graph_t *); graph_node_t *n; graph_link_t *l; u32 indent = format_get_indent (s); s = format (s, "graph %d nodes", pool_elts (g->nodes)); /* *INDENT-OFF* */ pool_foreach (n, g->nodes, ({ s = format (s, "\n%U", format_white_space, indent + 2); s = format (s, "%U -> ", format_graph_node, g, n - g->nodes); vec_foreach (l, n->next.links) s = format (s, "%U (%d), ", format_graph_node, g, l->node_index, l->distance); })); /* *INDENT-ON* */ return s; } /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */