[dpdk-dev] Can the empty struct rte_eth_txmode be enhanced?

lxu lxu4net at qq.com
Wed Jun 12 14:23:54 CEST 2013


Great! Thanks for the quick feedback.




------------------ Original ------------------
From:  "Olivier MATZ"<olivier.matz at 6wind.com>;
Date:  Wed, Jun 12, 2013 05:17 PM
To:  "dev"<dev at dpdk.org>; 
Cc:  "lxu"<lxu4net at qq.com>; 
Subject:  Re: [dpdk-dev] Can the empty struct rte_eth_txmode be enhanced?



Hello,

> Can we change the struct rte_eth_txmode ?
>
> Such as :
>
> struct rte_eth_txmode { int reserve[]; };   /* sizeof(struct rte_eth_txmode) == 0 in gcc and g++ */

I agree with your solution. Do you approve the following patch ?

From: lxu <lxu4net at qq.com>
Date: Wed, 12 Jun 2013 09:32:30 +0200
Subject: [PATCH] ethdev: force the size of struct rte_eth_txmode to be 0

The size of an empty structure is 0 when compiling with gcc, and 1 when
compiling with g++. Adding an empty table forces the size fo be 0, in C
or C++.

Acked-by: Olivier Matz <olivier.matz at 6wind.com>
Signed-off-by: lxu <lxu4net at qq.com>
---
  lib/librte_ether/rte_ethdev.h |    1 +
  1 file changed, 1 insertion(+)

diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 5985496..e0a1ccf 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -320,6 +320,7 @@ struct rte_eth_vmdq_dcb_conf {
   * For future extensions.
   */
  struct rte_eth_txmode {
+       int reserved[]; /* force the size of struct to be 0 */
  };

  /**
-- 
1.7.10.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dpdk.org/ml/archives/dev/attachments/20130612/cc28c4c3/attachment.html>


More information about the dev mailing list