DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] fix API parameter checking for ixgbe
@ 2017-01-24  9:00 Tiwei Bie
  2017-01-24  9:00 ` [dpdk-dev] [PATCH v1] net/ixgbe: fix API parameter checking Tiwei Bie
  0 siblings, 1 reply; 3+ messages in thread
From: Tiwei Bie @ 2017-01-24  9:00 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

When MACsec patch was merged. The helper function is_ixgbe_pmd() was
just raised and merged in another git tree. Now, both of them have
been merged in the same git tree. So do the same fix for MACsec.

Tiwei Bie (1):
  net/ixgbe: fix API parameter checking

 drivers/net/ixgbe/ixgbe_ethdev.c  | 30 ++++++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h |  4 ++++
 2 files changed, 34 insertions(+)

-- 
2.7.4

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

* [dpdk-dev] [PATCH v1] net/ixgbe: fix API parameter checking
  2017-01-24  9:00 [dpdk-dev] [PATCH v1] fix API parameter checking for ixgbe Tiwei Bie
@ 2017-01-24  9:00 ` Tiwei Bie
  2017-01-24 15:56   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Tiwei Bie @ 2017-01-24  9:00 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Add checks to rte_pmd_ixgbe_macsec_* APIs to ensure that the
port is an ixgbe port.

Fixes: b35d309710fe ("net/ixgbe: add MACsec offload")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c  | 30 ++++++++++++++++++++++++++++++
 drivers/net/ixgbe/rte_pmd_ixgbe.h |  4 ++++
 2 files changed, 34 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ad63e5a..58a4a2e 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -8222,10 +8222,15 @@ rte_pmd_ixgbe_macsec_enable(uint8_t port, uint8_t en, uint8_t rp)
 {
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
 	uint32_t ctrl;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
+	rte_eth_dev_info_get(port, &dev_info);
+	if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+		return -ENOTSUP;
+
 	dev = &rte_eth_devices[port];
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -8301,10 +8306,15 @@ rte_pmd_ixgbe_macsec_disable(uint8_t port)
 {
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
 	uint32_t ctrl;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
+	rte_eth_dev_info_get(port, &dev_info);
+	if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+		return -ENOTSUP;
+
 	dev = &rte_eth_devices[port];
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -8361,10 +8371,15 @@ rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac)
 {
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
 	uint32_t ctrl;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
+	rte_eth_dev_info_get(port, &dev_info);
+	if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+		return -ENOTSUP;
+
 	dev = &rte_eth_devices[port];
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -8382,10 +8397,15 @@ rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi)
 {
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
 	uint32_t ctrl;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
+	rte_eth_dev_info_get(port, &dev_info);
+	if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+		return -ENOTSUP;
+
 	dev = &rte_eth_devices[port];
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -8405,10 +8425,15 @@ rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
 {
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
 	uint32_t ctrl, i;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
+	rte_eth_dev_info_get(port, &dev_info);
+	if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+		return -ENOTSUP;
+
 	dev = &rte_eth_devices[port];
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
@@ -8457,10 +8482,15 @@ rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
 {
 	struct ixgbe_hw *hw;
 	struct rte_eth_dev *dev;
+	struct rte_eth_dev_info dev_info;
 	uint32_t ctrl, i;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
 
+	rte_eth_dev_info_get(port, &dev_info);
+	if (is_ixgbe_pmd(dev_info.driver_name) != 0)
+		return -ENOTSUP;
+
 	dev = &rte_eth_devices[port];
 	hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.h b/drivers/net/ixgbe/rte_pmd_ixgbe.h
index dade57a..d4efe07 100644
--- a/drivers/net/ixgbe/rte_pmd_ixgbe.h
+++ b/drivers/net/ixgbe/rte_pmd_ixgbe.h
@@ -222,6 +222,7 @@ int rte_pmd_ixgbe_macsec_disable(uint8_t port);
  * @return
  *   - (0) if successful.
  *   - (-ENODEV) if *port* invalid.
+ *   - (-ENOTSUP) if hardware doesn't support this feature.
  */
 int rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac);
 
@@ -237,6 +238,7 @@ int rte_pmd_ixgbe_macsec_config_txsc(uint8_t port, uint8_t *mac);
  * @return
  *   - (0) if successful.
  *   - (-ENODEV) if *port* invalid.
+ *   - (-ENOTSUP) if hardware doesn't support this feature.
  */
 int rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi);
 
@@ -256,6 +258,7 @@ int rte_pmd_ixgbe_macsec_config_rxsc(uint8_t port, uint8_t *mac, uint16_t pi);
  * @return
  *   - (0) if successful.
  *   - (-ENODEV) if *port* invalid.
+ *   - (-ENOTSUP) if hardware doesn't support this feature.
  *   - (-EINVAL) if bad parameter.
  */
 int rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
@@ -277,6 +280,7 @@ int rte_pmd_ixgbe_macsec_select_txsa(uint8_t port, uint8_t idx, uint8_t an,
  * @return
  *   - (0) if successful.
  *   - (-ENODEV) if *port* invalid.
+ *   - (-ENOTSUP) if hardware doesn't support this feature.
  *   - (-EINVAL) if bad parameter.
  */
 int rte_pmd_ixgbe_macsec_select_rxsa(uint8_t port, uint8_t idx, uint8_t an,
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v1] net/ixgbe: fix API parameter checking
  2017-01-24  9:00 ` [dpdk-dev] [PATCH v1] net/ixgbe: fix API parameter checking Tiwei Bie
@ 2017-01-24 15:56   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-01-24 15:56 UTC (permalink / raw)
  To: Tiwei Bie, dev

On 1/24/2017 9:00 AM, Tiwei Bie wrote:
> Add checks to rte_pmd_ixgbe_macsec_* APIs to ensure that the
> port is an ixgbe port.
> 
> Fixes: b35d309710fe ("net/ixgbe: add MACsec offload")
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2017-01-24 15:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24  9:00 [dpdk-dev] [PATCH v1] fix API parameter checking for ixgbe Tiwei Bie
2017-01-24  9:00 ` [dpdk-dev] [PATCH v1] net/ixgbe: fix API parameter checking Tiwei Bie
2017-01-24 15:56   ` Ferruh Yigit

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).