@@ -31,6 +31,7 @@ dp_packet_init__(struct dp_packet *b, size_t allocated, enum dp_packet_source so
dp_packet_reset_offsets(b);
pkt_metadata_init(&b->md, 0);
dp_packet_rss_invalidate(b);
+ dp_packet_mbuf_init(b);
dp_packet_reset_cutlen(b);
/* By default assume the packet type to be Ethernet. */
b->packet_type = htonl(PT_ETH);
@@ -605,12 +605,30 @@ dp_packet_rss_valid(struct dp_packet *p)
}
static inline void
-dp_packet_rss_invalidate(struct dp_packet *p)
+dp_packet_rss_invalidate(struct dp_packet *p OVS_UNUSED)
+{
+#ifndef DPDK_NETDEV
+ p->rss_hash_valid = false;
+#endif
+}
+
+static inline void
+dp_packet_mbuf_rss_flag_reset(struct dp_packet *p OVS_UNUSED)
{
#ifdef DPDK_NETDEV
p->mbuf.ol_flags &= ~PKT_RX_RSS_HASH;
-#else
- p->rss_hash_valid = false;
+#endif
+}
+
+/* This initialization is needed for packets that do not come
+ * from DPDK interfaces, when vswitchd is built with --with-dpdk.
+ * The DPDK rte library will still otherwise manage the mbuf.
+ * We only need to initialize the mbuf ol_flags. */
+static inline void
+dp_packet_mbuf_init(struct dp_packet *p OVS_UNUSED)
+{
+#ifdef DPDK_NETDEV
+ p->mbuf.ol_flags = 0;
#endif
}
@@ -2916,7 +2916,7 @@ netdev_dpdk_ring_send(struct netdev *netdev, int qid,
* modified by the consumer of the ring and return into the datapath
* without recalculating the RSS hash. */
for (i = 0; i < batch->count; i++) {
- dp_packet_rss_invalidate(batch->packets[i]);
+ dp_packet_mbuf_rss_flag_reset(batch->packets[i]);
}
netdev_dpdk_send__(dev, qid, batch, may_steal, concurrent_txq);
Reset the DPDK hwol flags in dp_packet_init_. The new hwol bad checksum flag is uninitialized for non-dpdk ports and this is noticed as test failures using netdev-dummy ports, when built with the --with-dpdk flag set. Hence, in this case, packets may be falsely marked as having a bad checksum. The existing APIs are simplified at the same time by making them specific to either DPDK or otherwise; they also now manage a single field. Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2017-August/045081.html Fixes: 7451af618e0d ("dp-packet : Update DPDK rx checksum validation functions.") CC: Sugesh Chandran <sugesh.chandran@intel.com> Signed-off-by: Darrell Ball <dlu998@gmail.com> --- v5->v6: Refactor some existing apis and incorporate review comments. v3->v5: Update the commit message with more context. v2->v3: Use existed API to reset both the DPDK HWOL flags. v1->v2: Fix build failure for without --with-dpdk. lib/dp-packet.c | 1 + lib/dp-packet.h | 24 +++++++++++++++++++++--- lib/netdev-dpdk.c | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-)