DPDK patches and discussions
 help / color / mirror / Atom feed
From: Helin Zhang <helin.zhang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH RFC 4/7] ethdev: fix of calculating the size of flow type mask array
Date: Fri, 19 Dec 2014 15:26:42 +0800	[thread overview]
Message-ID: <1418974005-15536-5-git-send-email-helin.zhang@intel.com> (raw)
In-Reply-To: <1418974005-15536-1-git-send-email-helin.zhang@intel.com>

It wrongly calculates the size of the flow type mask array. The fix
is to align the flow type maximum index ID with the number of
element bit width, and then divide the number of element bit width.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 lib/librte_ether/rte_eth_ctrl.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 4308eae..1c15ed0 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -398,6 +398,10 @@ enum rte_fdir_mode {
 	RTE_FDIR_MODE_PERFECT,       /**< Enable FDIR perfect filter mode. */
 };
 
+#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
+#define RTE_FLOW_TYPE_MASK_ARRAY_SIZE \
+	(RTE_ALIGN(RTE_ETH_FLOW_TYPE_MAX, UINT32_BIT)/UINT32_BIT)
+
 /**
  * A structure used to get the information of flow director filter.
  * It supports RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_INFO operation.
@@ -412,7 +416,7 @@ struct rte_eth_fdir_info {
 	uint32_t guarant_spc; /**< Guaranteed spaces.*/
 	uint32_t best_spc; /**< Best effort spaces.*/
 	/** Bit mask for every supported flow type. */
-	uint32_t flow_types_mask[RTE_ETH_FLOW_TYPE_MAX / sizeof(uint32_t)];
+	uint32_t flow_types_mask[RTE_FLOW_TYPE_MASK_ARRAY_SIZE];
 	uint32_t max_flexpayload; /**< Total flex payload in bytes. */
 	/** Flexible payload unit in bytes. Size and alignments of all flex
 	    payload segments should be multiplies of this value. */
-- 
1.9.3

  parent reply	other threads:[~2014-12-19  7:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19  7:26 [dpdk-dev] [PATCH RFC 0/7] unification of flow types and RSS offload types Helin Zhang
2014-12-19  7:26 ` [dpdk-dev] [PATCH RFC 1/7] app/test-pmd: code style fix Helin Zhang
2014-12-19  7:26 ` [dpdk-dev] [PATCH RFC 2/7] ethdev: " Helin Zhang
2014-12-19  7:26 ` [dpdk-dev] [PATCH RFC 3/7] i40e: " Helin Zhang
2014-12-19  7:26 ` Helin Zhang [this message]
2014-12-19  7:26 ` [dpdk-dev] [PATCH RFC 5/7] ethdev: unification of flow types Helin Zhang
2014-12-19 14:59   ` Ananyev, Konstantin
2014-12-22  2:33     ` Zhang, Helin
2014-12-19  7:26 ` [dpdk-dev] [PATCH RFC 6/7] ethdev: unification of RSS offload types Helin Zhang
2014-12-19  7:26 ` [dpdk-dev] [PATCH RFC 7/7] app/testpmd: support new rss offloads Helin Zhang
2015-01-12  6:17 ` [dpdk-dev] [PATCH RFC 0/7] unification of flow types and RSS offload types Zhang, Helin

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=1418974005-15536-5-git-send-email-helin.zhang@intel.com \
    --to=helin.zhang@intel.com \
    --cc=dev@dpdk.org \
    /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).