patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] net/ixgbe: fix MAC security private API
@ 2020-05-22  4:40 Guinan Sun
  2020-05-22  7:51 ` [dpdk-stable] [dpdk-dev] " Yang, Qiming
  0 siblings, 1 reply; 2+ messages in thread
From: Guinan Sun @ 2020-05-22  4:40 UTC (permalink / raw)
  To: dev; +Cc: Zhao1 Wei, Guinan Sun, stable

The driver type need to be checked in private API.
The patch fixes the issue.

Fixes: 50556c88104c ("net/ixgbe: fix MACsec setting")
Cc: stable@dpdk.org

Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c  | 14 ++++++++++++--
 drivers/net/ixgbe/ixgbe_ethdev.h  |  4 ++--
 drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 ++++++----
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f8a84c565..3e9c0f895 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -8988,7 +8988,7 @@ ixgbe_dev_macsec_setting_reset(struct rte_eth_dev *dev)
 	macsec->replayprotect_en = 0;
 }
 
-void
+int
 ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
 				struct ixgbe_macsec_setting *macsec_setting)
 {
@@ -8997,6 +8997,9 @@ ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
 	uint8_t en = macsec_setting->encrypt_en;
 	uint8_t rp = macsec_setting->replayprotect_en;
 
+	if (!is_ixgbe_supported(dev))
+		return -ENOTSUP;
+
 	/**
 	 * Workaround:
 	 * As no ixgbe_disable_sec_rx_path equivalent is
@@ -9057,14 +9060,19 @@ ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
 	 * just call the hand-written one directly for now.
 	 */
 	ixgbe_enable_sec_tx_path_generic(hw);
+
+	return 0;
 }
 
-void
+int
 ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t ctrl;
 
+	if (!is_ixgbe_supported(dev))
+		return -ENOTSUP;
+
 	/**
 	 * Workaround:
 	 * As no ixgbe_disable_sec_rx_path equivalent is
@@ -9106,6 +9114,8 @@ ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev)
 	 * just call the hand-written one directly for now.
 	 */
 	ixgbe_enable_sec_tx_path_generic(hw);
+
+	return 0;
 }
 
 RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 3d78b2ee2..c14cadab4 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -755,10 +755,10 @@ int ixgbe_action_rss_same(const struct rte_flow_action_rss *comp,
 int ixgbe_config_rss_filter(struct rte_eth_dev *dev,
 		struct ixgbe_rte_flow_rss_conf *conf, bool add);
 
-void ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
+int ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
 		struct ixgbe_macsec_setting *macsec_setting);
 
-void ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev);
+int ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev);
 
 void ixgbe_dev_macsec_setting_save(struct rte_eth_dev *dev,
 		struct ixgbe_macsec_setting *macsec_setting);
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
index 8bcaded6e..40cc7058f 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
@@ -517,6 +517,7 @@ rte_pmd_ixgbe_macsec_enable(uint16_t port, uint8_t en, uint8_t rp)
 {
 	struct rte_eth_dev *dev;
 	struct ixgbe_macsec_setting macsec_setting;
+	int ret = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
@@ -528,15 +529,16 @@ rte_pmd_ixgbe_macsec_enable(uint16_t port, uint8_t en, uint8_t rp)
 
 	ixgbe_dev_macsec_setting_save(dev, &macsec_setting);
 
-	ixgbe_dev_macsec_register_enable(dev, &macsec_setting);
+	ret = ixgbe_dev_macsec_register_enable(dev, &macsec_setting);
 
-	return 0;
+	return ret;
 }
 
 int
 rte_pmd_ixgbe_macsec_disable(uint16_t port)
 {
 	struct rte_eth_dev *dev;
+	int ret = 0;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
@@ -544,9 +546,9 @@ rte_pmd_ixgbe_macsec_disable(uint16_t port)
 
 	ixgbe_dev_macsec_setting_reset(dev);
 
-	ixgbe_dev_macsec_register_disable(dev);
+	ret = ixgbe_dev_macsec_register_disable(dev);
 
-	return 0;
+	return ret;
 }
 
 int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH] net/ixgbe: fix MAC security private API
  2020-05-22  4:40 [dpdk-stable] [PATCH] net/ixgbe: fix MAC security private API Guinan Sun
@ 2020-05-22  7:51 ` " Yang, Qiming
  0 siblings, 0 replies; 2+ messages in thread
From: Yang, Qiming @ 2020-05-22  7:51 UTC (permalink / raw)
  To: Sun, GuinanX, dev; +Cc: Zhao1, Wei, Sun, GuinanX, stable

Hi, 
Do you copy the commit log of the other patch? I think this patch don't touch any private API.

Qiming

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Guinan Sun
> Sent: Friday, May 22, 2020 12:40
> To: dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Sun, GuinanX
> <guinanx.sun@intel.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ixgbe: fix MAC security private API
> 
> The driver type need to be checked in private API.
> The patch fixes the issue.
> 
> Fixes: 50556c88104c ("net/ixgbe: fix MACsec setting")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c  | 14 ++++++++++++--
> drivers/net/ixgbe/ixgbe_ethdev.h  |  4 ++--
> drivers/net/ixgbe/rte_pmd_ixgbe.c | 10 ++++++----
>  3 files changed, 20 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index f8a84c565..3e9c0f895 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -8988,7 +8988,7 @@ ixgbe_dev_macsec_setting_reset(struct
> rte_eth_dev *dev)
>  	macsec->replayprotect_en = 0;
>  }
> 
> -void
> +int
>  ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
>  				struct ixgbe_macsec_setting
> *macsec_setting)  { @@ -8997,6 +8997,9 @@
> ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
>  	uint8_t en = macsec_setting->encrypt_en;
>  	uint8_t rp = macsec_setting->replayprotect_en;
> 
> +	if (!is_ixgbe_supported(dev))
> +		return -ENOTSUP;
> +
>  	/**
>  	 * Workaround:
>  	 * As no ixgbe_disable_sec_rx_path equivalent is @@ -9057,14
> +9060,19 @@ ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
>  	 * just call the hand-written one directly for now.
>  	 */
>  	ixgbe_enable_sec_tx_path_generic(hw);
> +
> +	return 0;
>  }
> 
> -void
> +int
>  ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev)  {
>  	struct ixgbe_hw *hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
>  	uint32_t ctrl;
> 
> +	if (!is_ixgbe_supported(dev))
> +		return -ENOTSUP;
> +
>  	/**
>  	 * Workaround:
>  	 * As no ixgbe_disable_sec_rx_path equivalent is @@ -9106,6
> +9114,8 @@ ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev)
>  	 * just call the hand-written one directly for now.
>  	 */
>  	ixgbe_enable_sec_tx_path_generic(hw);
> +
> +	return 0;
>  }
> 
>  RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd); diff --git
> a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
> index 3d78b2ee2..c14cadab4 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.h
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.h
> @@ -755,10 +755,10 @@ int ixgbe_action_rss_same(const struct
> rte_flow_action_rss *comp,  int ixgbe_config_rss_filter(struct rte_eth_dev
> *dev,
>  		struct ixgbe_rte_flow_rss_conf *conf, bool add);
> 
> -void ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
> +int ixgbe_dev_macsec_register_enable(struct rte_eth_dev *dev,
>  		struct ixgbe_macsec_setting *macsec_setting);
> 
> -void ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev);
> +int ixgbe_dev_macsec_register_disable(struct rte_eth_dev *dev);
> 
>  void ixgbe_dev_macsec_setting_save(struct rte_eth_dev *dev,
>  		struct ixgbe_macsec_setting *macsec_setting); diff --git
> a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c
> index 8bcaded6e..40cc7058f 100644
> --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c
> +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c
> @@ -517,6 +517,7 @@ rte_pmd_ixgbe_macsec_enable(uint16_t port,
> uint8_t en, uint8_t rp)  {
>  	struct rte_eth_dev *dev;
>  	struct ixgbe_macsec_setting macsec_setting;
> +	int ret = 0;
> 
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
> 
> @@ -528,15 +529,16 @@ rte_pmd_ixgbe_macsec_enable(uint16_t port,
> uint8_t en, uint8_t rp)
> 
>  	ixgbe_dev_macsec_setting_save(dev, &macsec_setting);
> 
> -	ixgbe_dev_macsec_register_enable(dev, &macsec_setting);
> +	ret = ixgbe_dev_macsec_register_enable(dev, &macsec_setting);
> 
> -	return 0;
> +	return ret;
>  }
> 
>  int
>  rte_pmd_ixgbe_macsec_disable(uint16_t port)  {
>  	struct rte_eth_dev *dev;
> +	int ret = 0;
> 
>  	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
> 
> @@ -544,9 +546,9 @@ rte_pmd_ixgbe_macsec_disable(uint16_t port)
> 
>  	ixgbe_dev_macsec_setting_reset(dev);
> 
> -	ixgbe_dev_macsec_register_disable(dev);
> +	ret = ixgbe_dev_macsec_register_disable(dev);
> 
> -	return 0;
> +	return ret;
>  }
> 
>  int
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  4:40 [dpdk-stable] [PATCH] net/ixgbe: fix MAC security private API Guinan Sun
2020-05-22  7:51 ` [dpdk-stable] [dpdk-dev] " Yang, Qiming

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox