[dpdk-dev,1/5] ixgbe: make txq_ops const

Message ID 1425695004-29605-2-git-send-email-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Headers

Commit Message

Stephen Hemminger March 7, 2015, 2:23 a.m. UTC
  All virtual function tables should be const so they are put
in text segment rather than data.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c     | 2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx.h     | 2 +-
 lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Bruce Richardson March 9, 2015, 1:31 p.m. UTC | #1
On Fri, Mar 06, 2015 at 06:23:20PM -0800, Stephen Hemminger wrote:
> All virtual function tables should be const so they are put
> in text segment rather than data.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

> ---
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c     | 2 +-
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.h     | 2 +-
>  lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> index 9ecf3e5..e6aec8f 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
> @@ -1754,7 +1754,7 @@ ixgbe_reset_tx_queue(struct igb_tx_queue *txq)
>  		IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
>  }
>  
> -static struct ixgbe_txq_ops def_txq_ops = {
> +static const struct ixgbe_txq_ops def_txq_ops = {
>  	.release_mbufs = ixgbe_tx_queue_release_mbufs,
>  	.free_swring = ixgbe_tx_free_swring,
>  	.reset = ixgbe_reset_tx_queue,
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
> index 329007c..a85839e 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
> @@ -211,7 +211,7 @@ struct igb_tx_queue {
>  	uint32_t            ctx_curr;      /**< Hardware context states. */
>  	/** Hardware context0 history. */
>  	struct ixgbe_advctx_info ctx_cache[IXGBE_CTX_NUM];
> -	struct ixgbe_txq_ops *ops;          /**< txq ops */
> +	const struct ixgbe_txq_ops *ops;       /**< txq ops */
>  	uint8_t             tx_deferred_start; /**< not in global dev start. */
>  };
>  
> diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
> index 1f46f0f..11e9f12 100644
> --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
> +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
> @@ -723,7 +723,7 @@ ixgbe_reset_tx_queue(struct igb_tx_queue *txq)
>  		IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
>  }
>  
> -static struct ixgbe_txq_ops vec_txq_ops = {
> +static const struct ixgbe_txq_ops vec_txq_ops = {
>  	.release_mbufs = ixgbe_tx_queue_release_mbufs,
>  	.free_swring = ixgbe_tx_free_swring,
>  	.reset = ixgbe_reset_tx_queue,
> -- 
> 2.1.4
>
  
Ouyang Changchun March 10, 2015, 4:40 a.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen
> Hemminger
> Sent: Saturday, March 7, 2015 10:23 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/5] ixgbe: make txq_ops const
> 
> All virtual function tables should be const so they are put in text segment
> rather than data.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
  

Patch

diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
index 9ecf3e5..e6aec8f 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c
@@ -1754,7 +1754,7 @@  ixgbe_reset_tx_queue(struct igb_tx_queue *txq)
 		IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
 }
 
-static struct ixgbe_txq_ops def_txq_ops = {
+static const struct ixgbe_txq_ops def_txq_ops = {
 	.release_mbufs = ixgbe_tx_queue_release_mbufs,
 	.free_swring = ixgbe_tx_free_swring,
 	.reset = ixgbe_reset_tx_queue,
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
index 329007c..a85839e 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.h
@@ -211,7 +211,7 @@  struct igb_tx_queue {
 	uint32_t            ctx_curr;      /**< Hardware context states. */
 	/** Hardware context0 history. */
 	struct ixgbe_advctx_info ctx_cache[IXGBE_CTX_NUM];
-	struct ixgbe_txq_ops *ops;          /**< txq ops */
+	const struct ixgbe_txq_ops *ops;       /**< txq ops */
 	uint8_t             tx_deferred_start; /**< not in global dev start. */
 };
 
diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
index 1f46f0f..11e9f12 100644
--- a/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
+++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c
@@ -723,7 +723,7 @@  ixgbe_reset_tx_queue(struct igb_tx_queue *txq)
 		IXGBE_CTX_NUM * sizeof(struct ixgbe_advctx_info));
 }
 
-static struct ixgbe_txq_ops vec_txq_ops = {
+static const struct ixgbe_txq_ops vec_txq_ops = {
 	.release_mbufs = ixgbe_tx_queue_release_mbufs,
 	.free_swring = ixgbe_tx_free_swring,
 	.reset = ixgbe_reset_tx_queue,