diff mbox

[dpdk-dev,11/18] i40e: support of building both PF and VF driver together

Message ID 1429518150-28098-12-git-send-email-helin.zhang@intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Helin Zhang April 20, 2015, 8:22 a.m. UTC
Macros of PF_DRIVER, VF_DRIVER and INTEGRATED_VF were defined to
support building both PF and VF driver together. PF_DRIVER needs
to be defined if a build is for PF only, while VF_DRIVER for VF
only. PF_DRIVER, VF_DRIVER and INTEGRATED_VF are all needed for
building PF and VF driver together.

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
---
 lib/librte_pmd_i40e/Makefile              |  2 +-
 lib/librte_pmd_i40e/i40e/i40e_adminq.c    | 14 +++++++-------
 lib/librte_pmd_i40e/i40e/i40e_common.c    |  6 ++++--
 lib/librte_pmd_i40e/i40e/i40e_prototype.h |  4 ++--
 4 files changed, 14 insertions(+), 12 deletions(-)

Comments

Thomas Monjalon April 27, 2015, 5:25 p.m. UTC | #1
2015-04-20 16:22, Helin Zhang:
> Macros of PF_DRIVER, VF_DRIVER and INTEGRATED_VF were defined to
> support building both PF and VF driver together. PF_DRIVER needs
> to be defined if a build is for PF only, while VF_DRIVER for VF
> only. PF_DRIVER, VF_DRIVER and INTEGRATED_VF are all needed for
> building PF and VF driver together.
> 
> Signed-off-by: Helin Zhang <helin.zhang@intel.com>

As this patch is mostly reversing the logic #îfndef to #ifdef, it
seems the title is not accurate. Is it really adding a new support
or is it only changing the compilation logic?

About title, please use i40e/base: to distinguish patches on the base driver
from the specific PMD ones.

> ---
>  lib/librte_pmd_i40e/Makefile              |  2 +-
>  lib/librte_pmd_i40e/i40e/i40e_adminq.c    | 14 +++++++-------
>  lib/librte_pmd_i40e/i40e/i40e_common.c    |  6 ++++--
>  lib/librte_pmd_i40e/i40e/i40e_prototype.h |  4 ++--
>  4 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
> index a921bf1..22f0716 100644
> --- a/lib/librte_pmd_i40e/Makefile
> +++ b/lib/librte_pmd_i40e/Makefile
> @@ -37,7 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk
>  LIB = librte_pmd_i40e.a
>  
>  CFLAGS += -O3
> -CFLAGS += $(WERROR_FLAGS)
> +CFLAGS += $(WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER -DINTEGRATED_VF
>  
>  EXPORT_MAP := rte_pmd_i40e_version.map
>  
> diff --git a/lib/librte_pmd_i40e/i40e/i40e_adminq.c b/lib/librte_pmd_i40e/i40e/i40e_adminq.c
> index 91b3568..8f9e870 100644
> --- a/lib/librte_pmd_i40e/i40e/i40e_adminq.c
> +++ b/lib/librte_pmd_i40e/i40e/i40e_adminq.c
> @@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
>  #include "i40e_adminq.h"
>  #include "i40e_prototype.h"
>  
> -#ifndef VF_DRIVER
> +#ifdef PF_DRIVER
>  /**
>   * i40e_is_nvm_update_op - return true if this is an NVM update operation
>   * @desc: API request descriptor
> @@ -48,7 +48,7 @@ STATIC INLINE bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc)
>  		desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_update));
>  }
>  
> -#endif /* VF_DRIVER */
> +#endif /* PF_DRIVER */
>  /**
>   *  i40e_adminq_init_regs - Initialize AdminQ registers
>   *  @hw: pointer to the hardware structure
> @@ -559,7 +559,7 @@ enum i40e_status_code i40e_shutdown_arq(struct i40e_hw *hw)
>  enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
>  {
>  	enum i40e_status_code ret_code;
> -#ifndef VF_DRIVER
> +#ifdef PF_DRIVER
>  	u16 eetrack_lo, eetrack_hi;
>  	int retry = 0;
>  #endif
> @@ -592,7 +592,7 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
>  	if (ret_code != I40E_SUCCESS)
>  		goto init_adminq_free_asq;
>  
> -#ifndef VF_DRIVER
> +#ifdef PF_DRIVER
>  #ifdef INTEGRATED_VF
>  	/* VF has no need of firmware */
>  	if (i40e_is_vf(hw))
> @@ -640,13 +640,13 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
>  						    I40E_HMC_PROFILE_DEFAULT,
>  						    0,
>  						    NULL);
> +#endif /* PF_DRIVER */
>  	ret_code = I40E_SUCCESS;
>  
> -#endif /* VF_DRIVER */
>  	/* success! */
>  	goto init_adminq_exit;
>  
> -#ifndef VF_DRIVER
> +#ifdef PF_DRIVER
>  init_adminq_free_arq:
>  	i40e_shutdown_arq(hw);
>  #endif
> @@ -1044,7 +1044,7 @@ clean_arq_element_out:
>  		*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
>  	i40e_release_spinlock(&hw->aq.arq_spinlock);
>  
> -#ifndef VF_DRIVER
> +#ifdef PF_DRIVER
>  	if (i40e_is_nvm_update_op(&e->desc)) {
>  		if (hw->aq.nvm_release_on_done) {
>  			i40e_release_nvm(hw);
> diff --git a/lib/librte_pmd_i40e/i40e/i40e_common.c b/lib/librte_pmd_i40e/i40e/i40e_common.c
> index 3dd8f04..7a322f1 100644
> --- a/lib/librte_pmd_i40e/i40e/i40e_common.c
> +++ b/lib/librte_pmd_i40e/i40e/i40e_common.c
> @@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
>   * This function sets the mac type of the adapter based on the
>   * vendor ID and device ID stored in the hw structure.
>   **/
> -#ifdef VF_DRIVER
> +#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
>  enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
>  #else
>  STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
> @@ -564,7 +564,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
>  	I40E_PTT_UNUSED_ENTRY(255)
>  };
>  
> -#ifndef VF_DRIVER
> +#ifdef PF_DRIVER
>  
>  /**
>   * i40e_init_shared_code - Initialize the shared code
> @@ -4771,6 +4771,8 @@ enum i40e_status_code i40e_aq_configure_partition_bw(struct i40e_hw *hw,
>  
>  	return status;
>  }
> +#endif /* PF_DRIVER */
> +#ifdef VF_DRIVER
>  
>  /**
>   * i40e_aq_send_msg_to_pf
> diff --git a/lib/librte_pmd_i40e/i40e/i40e_prototype.h b/lib/librte_pmd_i40e/i40e/i40e_prototype.h
> index 79f4e38..d143183 100644
> --- a/lib/librte_pmd_i40e/i40e/i40e_prototype.h
> +++ b/lib/librte_pmd_i40e/i40e/i40e_prototype.h
> @@ -77,7 +77,7 @@ void i40e_resume_aq(struct i40e_hw *hw);
>  bool i40e_check_asq_alive(struct i40e_hw *hw);
>  enum i40e_status_code i40e_aq_queue_shutdown(struct i40e_hw *hw, bool unloading);
>  
> -#ifndef VF_DRIVER
> +#ifdef PF_DRIVER
>  
>  u32 i40e_led_get(struct i40e_hw *hw);
>  void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink);
> @@ -401,7 +401,7 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
>  					  struct i40e_nvm_access *cmd,
>  					  u8 *bytes, int *);
>  void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
> -#endif /* VF_DRIVER */
> +#endif /* PF_DRIVER */
>  
>  #if defined(I40E_QV) || defined(VF_DRIVER)
>  enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);
>
Helin Zhang April 28, 2015, 2:33 a.m. UTC | #2
Hi Thomas

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> Sent: Tuesday, April 28, 2015 1:25 AM
> To: Zhang, Helin
> Cc: dev@dpdk.org; Kenguva, Monica; Murray, Steven J; Shih, Chiu-Pi
> Subject: Re: [dpdk-dev] [PATCH 11/18] i40e: support of building both PF and VF
> driver together
> 
> 2015-04-20 16:22, Helin Zhang:
> > Macros of PF_DRIVER, VF_DRIVER and INTEGRATED_VF were defined to
> > support building both PF and VF driver together. PF_DRIVER needs to be
> > defined if a build is for PF only, while VF_DRIVER for VF only.
> > PF_DRIVER, VF_DRIVER and INTEGRATED_VF are all needed for building PF
> > and VF driver together.
> >
> > Signed-off-by: Helin Zhang <helin.zhang@intel.com>
> 
> As this patch is mostly reversing the logic #îfndef to #ifdef, it seems the title is
> not accurate. Is it really adding a new support or is it only changing the
> compilation logic?
It does have VF_DRIVER only before. Currently it will have both PF_DRIVER and VF_DRIVER
which is used to select the source code to be compiled for PF or VF or both.
Yes, I need to think more accurate description.

> 
> About title, please use i40e/base: to distinguish patches on the base driver
> from the specific PMD ones.
So i40e and i40e/base should be used respectively?

Regards,
Helin

> 
> > ---
> >  lib/librte_pmd_i40e/Makefile              |  2 +-
> >  lib/librte_pmd_i40e/i40e/i40e_adminq.c    | 14 +++++++-------
> >  lib/librte_pmd_i40e/i40e/i40e_common.c    |  6 ++++--
> >  lib/librte_pmd_i40e/i40e/i40e_prototype.h |  4 ++--
> >  4 files changed, 14 insertions(+), 12 deletions(-)
> >
> > diff --git a/lib/librte_pmd_i40e/Makefile
> > b/lib/librte_pmd_i40e/Makefile index a921bf1..22f0716 100644
> > --- a/lib/librte_pmd_i40e/Makefile
> > +++ b/lib/librte_pmd_i40e/Makefile
> > @@ -37,7 +37,7 @@ include $(RTE_SDK)/mk/rte.vars.mk  LIB =
> > librte_pmd_i40e.a
> >
> >  CFLAGS += -O3
> > -CFLAGS += $(WERROR_FLAGS)
> > +CFLAGS += $(WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER
> -DINTEGRATED_VF
> >
> >  EXPORT_MAP := rte_pmd_i40e_version.map
> >
> > diff --git a/lib/librte_pmd_i40e/i40e/i40e_adminq.c
> > b/lib/librte_pmd_i40e/i40e/i40e_adminq.c
> > index 91b3568..8f9e870 100644
> > --- a/lib/librte_pmd_i40e/i40e/i40e_adminq.c
> > +++ b/lib/librte_pmd_i40e/i40e/i40e_adminq.c
> > @@ -37,7 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
> >  #include "i40e_adminq.h"
> >  #include "i40e_prototype.h"
> >
> > -#ifndef VF_DRIVER
> > +#ifdef PF_DRIVER
> >  /**
> >   * i40e_is_nvm_update_op - return true if this is an NVM update operation
> >   * @desc: API request descriptor
> > @@ -48,7 +48,7 @@ STATIC INLINE bool i40e_is_nvm_update_op(struct
> i40e_aq_desc *desc)
> >  		desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_update));
> >  }
> >
> > -#endif /* VF_DRIVER */
> > +#endif /* PF_DRIVER */
> >  /**
> >   *  i40e_adminq_init_regs - Initialize AdminQ registers
> >   *  @hw: pointer to the hardware structure @@ -559,7 +559,7 @@
> enum
> > i40e_status_code i40e_shutdown_arq(struct i40e_hw *hw)  enum
> > i40e_status_code i40e_init_adminq(struct i40e_hw *hw)  {
> >  	enum i40e_status_code ret_code;
> > -#ifndef VF_DRIVER
> > +#ifdef PF_DRIVER
> >  	u16 eetrack_lo, eetrack_hi;
> >  	int retry = 0;
> >  #endif
> > @@ -592,7 +592,7 @@ enum i40e_status_code i40e_init_adminq(struct
> i40e_hw *hw)
> >  	if (ret_code != I40E_SUCCESS)
> >  		goto init_adminq_free_asq;
> >
> > -#ifndef VF_DRIVER
> > +#ifdef PF_DRIVER
> >  #ifdef INTEGRATED_VF
> >  	/* VF has no need of firmware */
> >  	if (i40e_is_vf(hw))
> > @@ -640,13 +640,13 @@ enum i40e_status_code i40e_init_adminq(struct
> i40e_hw *hw)
> >  						    I40E_HMC_PROFILE_DEFAULT,
> >  						    0,
> >  						    NULL);
> > +#endif /* PF_DRIVER */
> >  	ret_code = I40E_SUCCESS;
> >
> > -#endif /* VF_DRIVER */
> >  	/* success! */
> >  	goto init_adminq_exit;
> >
> > -#ifndef VF_DRIVER
> > +#ifdef PF_DRIVER
> >  init_adminq_free_arq:
> >  	i40e_shutdown_arq(hw);
> >  #endif
> > @@ -1044,7 +1044,7 @@ clean_arq_element_out:
> >  		*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
> >  	i40e_release_spinlock(&hw->aq.arq_spinlock);
> >
> > -#ifndef VF_DRIVER
> > +#ifdef PF_DRIVER
> >  	if (i40e_is_nvm_update_op(&e->desc)) {
> >  		if (hw->aq.nvm_release_on_done) {
> >  			i40e_release_nvm(hw);
> > diff --git a/lib/librte_pmd_i40e/i40e/i40e_common.c
> > b/lib/librte_pmd_i40e/i40e/i40e_common.c
> > index 3dd8f04..7a322f1 100644
> > --- a/lib/librte_pmd_i40e/i40e/i40e_common.c
> > +++ b/lib/librte_pmd_i40e/i40e/i40e_common.c
> > @@ -44,7 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
> >   * This function sets the mac type of the adapter based on the
> >   * vendor ID and device ID stored in the hw structure.
> >   **/
> > -#ifdef VF_DRIVER
> > +#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
> >  enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)  #else
> > STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
> @@
> > -564,7 +564,7 @@ struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
> >  	I40E_PTT_UNUSED_ENTRY(255)
> >  };
> >
> > -#ifndef VF_DRIVER
> > +#ifdef PF_DRIVER
> >
> >  /**
> >   * i40e_init_shared_code - Initialize the shared code @@ -4771,6
> > +4771,8 @@ enum i40e_status_code
> i40e_aq_configure_partition_bw(struct
> > i40e_hw *hw,
> >
> >  	return status;
> >  }
> > +#endif /* PF_DRIVER */
> > +#ifdef VF_DRIVER
> >
> >  /**
> >   * i40e_aq_send_msg_to_pf
> > diff --git a/lib/librte_pmd_i40e/i40e/i40e_prototype.h
> > b/lib/librte_pmd_i40e/i40e/i40e_prototype.h
> > index 79f4e38..d143183 100644
> > --- a/lib/librte_pmd_i40e/i40e/i40e_prototype.h
> > +++ b/lib/librte_pmd_i40e/i40e/i40e_prototype.h
> > @@ -77,7 +77,7 @@ void i40e_resume_aq(struct i40e_hw *hw);  bool
> > i40e_check_asq_alive(struct i40e_hw *hw);  enum i40e_status_code
> > i40e_aq_queue_shutdown(struct i40e_hw *hw, bool unloading);
> >
> > -#ifndef VF_DRIVER
> > +#ifdef PF_DRIVER
> >
> >  u32 i40e_led_get(struct i40e_hw *hw);  void i40e_led_set(struct
> > i40e_hw *hw, u32 mode, bool blink); @@ -401,7 +401,7 @@ enum
> > i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
> >  					  struct i40e_nvm_access *cmd,
> >  					  u8 *bytes, int *);
> >  void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
> > -#endif /* VF_DRIVER */
> > +#endif /* PF_DRIVER */
> >
> >  #if defined(I40E_QV) || defined(VF_DRIVER)  enum i40e_status_code
> > i40e_set_mac_type(struct i40e_hw *hw);
> >
>
diff mbox

Patch

diff --git a/lib/librte_pmd_i40e/Makefile b/lib/librte_pmd_i40e/Makefile
index a921bf1..22f0716 100644
--- a/lib/librte_pmd_i40e/Makefile
+++ b/lib/librte_pmd_i40e/Makefile
@@ -37,7 +37,7 @@  include $(RTE_SDK)/mk/rte.vars.mk
 LIB = librte_pmd_i40e.a
 
 CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS)
+CFLAGS += $(WERROR_FLAGS) -DPF_DRIVER -DVF_DRIVER -DINTEGRATED_VF
 
 EXPORT_MAP := rte_pmd_i40e_version.map
 
diff --git a/lib/librte_pmd_i40e/i40e/i40e_adminq.c b/lib/librte_pmd_i40e/i40e/i40e_adminq.c
index 91b3568..8f9e870 100644
--- a/lib/librte_pmd_i40e/i40e/i40e_adminq.c
+++ b/lib/librte_pmd_i40e/i40e/i40e_adminq.c
@@ -37,7 +37,7 @@  POSSIBILITY OF SUCH DAMAGE.
 #include "i40e_adminq.h"
 #include "i40e_prototype.h"
 
-#ifndef VF_DRIVER
+#ifdef PF_DRIVER
 /**
  * i40e_is_nvm_update_op - return true if this is an NVM update operation
  * @desc: API request descriptor
@@ -48,7 +48,7 @@  STATIC INLINE bool i40e_is_nvm_update_op(struct i40e_aq_desc *desc)
 		desc->opcode == CPU_TO_LE16(i40e_aqc_opc_nvm_update));
 }
 
-#endif /* VF_DRIVER */
+#endif /* PF_DRIVER */
 /**
  *  i40e_adminq_init_regs - Initialize AdminQ registers
  *  @hw: pointer to the hardware structure
@@ -559,7 +559,7 @@  enum i40e_status_code i40e_shutdown_arq(struct i40e_hw *hw)
 enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 {
 	enum i40e_status_code ret_code;
-#ifndef VF_DRIVER
+#ifdef PF_DRIVER
 	u16 eetrack_lo, eetrack_hi;
 	int retry = 0;
 #endif
@@ -592,7 +592,7 @@  enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 	if (ret_code != I40E_SUCCESS)
 		goto init_adminq_free_asq;
 
-#ifndef VF_DRIVER
+#ifdef PF_DRIVER
 #ifdef INTEGRATED_VF
 	/* VF has no need of firmware */
 	if (i40e_is_vf(hw))
@@ -640,13 +640,13 @@  enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw)
 						    I40E_HMC_PROFILE_DEFAULT,
 						    0,
 						    NULL);
+#endif /* PF_DRIVER */
 	ret_code = I40E_SUCCESS;
 
-#endif /* VF_DRIVER */
 	/* success! */
 	goto init_adminq_exit;
 
-#ifndef VF_DRIVER
+#ifdef PF_DRIVER
 init_adminq_free_arq:
 	i40e_shutdown_arq(hw);
 #endif
@@ -1044,7 +1044,7 @@  clean_arq_element_out:
 		*pending = (ntc > ntu ? hw->aq.arq.count : 0) + (ntu - ntc);
 	i40e_release_spinlock(&hw->aq.arq_spinlock);
 
-#ifndef VF_DRIVER
+#ifdef PF_DRIVER
 	if (i40e_is_nvm_update_op(&e->desc)) {
 		if (hw->aq.nvm_release_on_done) {
 			i40e_release_nvm(hw);
diff --git a/lib/librte_pmd_i40e/i40e/i40e_common.c b/lib/librte_pmd_i40e/i40e/i40e_common.c
index 3dd8f04..7a322f1 100644
--- a/lib/librte_pmd_i40e/i40e/i40e_common.c
+++ b/lib/librte_pmd_i40e/i40e/i40e_common.c
@@ -44,7 +44,7 @@  POSSIBILITY OF SUCH DAMAGE.
  * This function sets the mac type of the adapter based on the
  * vendor ID and device ID stored in the hw structure.
  **/
-#ifdef VF_DRIVER
+#if defined(INTEGRATED_VF) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
 #else
 STATIC enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw)
@@ -564,7 +564,7 @@  struct i40e_rx_ptype_decoded i40e_ptype_lookup[] = {
 	I40E_PTT_UNUSED_ENTRY(255)
 };
 
-#ifndef VF_DRIVER
+#ifdef PF_DRIVER
 
 /**
  * i40e_init_shared_code - Initialize the shared code
@@ -4771,6 +4771,8 @@  enum i40e_status_code i40e_aq_configure_partition_bw(struct i40e_hw *hw,
 
 	return status;
 }
+#endif /* PF_DRIVER */
+#ifdef VF_DRIVER
 
 /**
  * i40e_aq_send_msg_to_pf
diff --git a/lib/librte_pmd_i40e/i40e/i40e_prototype.h b/lib/librte_pmd_i40e/i40e/i40e_prototype.h
index 79f4e38..d143183 100644
--- a/lib/librte_pmd_i40e/i40e/i40e_prototype.h
+++ b/lib/librte_pmd_i40e/i40e/i40e_prototype.h
@@ -77,7 +77,7 @@  void i40e_resume_aq(struct i40e_hw *hw);
 bool i40e_check_asq_alive(struct i40e_hw *hw);
 enum i40e_status_code i40e_aq_queue_shutdown(struct i40e_hw *hw, bool unloading);
 
-#ifndef VF_DRIVER
+#ifdef PF_DRIVER
 
 u32 i40e_led_get(struct i40e_hw *hw);
 void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink);
@@ -401,7 +401,7 @@  enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 					  struct i40e_nvm_access *cmd,
 					  u8 *bytes, int *);
 void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
-#endif /* VF_DRIVER */
+#endif /* PF_DRIVER */
 
 #if defined(I40E_QV) || defined(VF_DRIVER)
 enum i40e_status_code i40e_set_mac_type(struct i40e_hw *hw);