[v2,WIP,3/7] linux-gen: pktio: introduce checksum settings

Message ID 1515830407-13301-4-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series
  • Validate checksums during packet parsing
Related show

Commit Message

Github ODP bot Jan. 13, 2018, 8 a.m.
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 389 (lumag:parse-checksums)
 ** https://github.com/Linaro/odp/pull/389
 ** Patch: https://github.com/Linaro/odp/pull/389.patch
 ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea
 ** Merge commit sha: 29d9c9fa8235c01897c72e823b57525e37f896d3
 **/
 platform/linux-generic/include/odp_packet_io_internal.h | 1 +
 platform/linux-generic/odp_packet_io.c                  | 6 ++++++
 2 files changed, 7 insertions(+)

Patch

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index 25e037182..851515810 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -151,6 +151,7 @@  struct pktio_entry {
 	odp_pktio_config_t config;	/**< Device configuration */
 	classifier_t cls;		/**< classifier linked with this pktio*/
 	odp_pktio_stats_t stats;	/**< statistic counters for pktio */
+	odp_proto_chksums_t in_chksums; /**< Checksums validation settings */
 	enum {
 		STATS_SYSFS = 0,
 		STATS_ETHTOOL,
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index ffbc73b26..1f1d46423 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -432,6 +432,12 @@  int odp_pktio_config(odp_pktio_t hdl, const odp_pktio_config_t *config)
 
 	entry->s.config = *config;
 
+	entry->s.in_chksums.all_chksum = 0;
+	entry->s.in_chksums.chksum.ipv4 = config->pktin.bit.ipv4_chksum;
+	entry->s.in_chksums.chksum.tcp = config->pktin.bit.tcp_chksum;
+	entry->s.in_chksums.chksum.udp = config->pktin.bit.udp_chksum;
+	entry->s.in_chksums.chksum.sctp = config->pktin.bit.sctp_chksum;
+
 	if (entry->s.ops->config)
 		res = entry->s.ops->config(entry, config);