summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_ethdev.c
diff options
context:
space:
mode:
authorOri Kam <orika@mellanox.com>2019-04-18 13:16:02 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-04-19 14:51:55 +0200
commit2e4c987aad91b836bfaf8f23d281c04652d7ddad (patch)
tree286d8ae79f18420cecae2e26e0299ff530ae53ce /drivers/net/mlx5/mlx5_ethdev.c
parente2b4925ef7c11c4271b2c8fb46154d347cba26e2 (diff)
downloaddpdk-next-eventdev-2e4c987aad91b836bfaf8f23d281c04652d7ddad.zip
dpdk-next-eventdev-2e4c987aad91b836bfaf8f23d281c04652d7ddad.tar.gz
dpdk-next-eventdev-2e4c987aad91b836bfaf8f23d281c04652d7ddad.tar.xz
net/mlx5: validate Direct Rule E-Switch
Add validation logic for E-Switch using Direct Rules. Signed-off-by: Ori Kam <orika@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_ethdev.c')
-rw-r--r--drivers/net/mlx5/mlx5_ethdev.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 9c24462..57a6449 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1376,6 +1376,47 @@ mlx5_dev_to_port_id(const struct rte_device *dev, uint16_t *port_list,
}
/**
+ * Get the E-Switch domain id this port belongs to.
+ *
+ * @param[in] port
+ * Device port id.
+ * @param[out] es_domain_id
+ * E-Switch domain id.
+ * @param[out] es_port_id
+ * The port id of the port in the E-Switch.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+mlx5_port_to_eswitch_info(uint16_t port,
+ uint16_t *es_domain_id, uint16_t *es_port_id)
+{
+ struct rte_eth_dev *dev;
+ struct mlx5_priv *priv;
+
+ if (port >= RTE_MAX_ETHPORTS) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ if (!rte_eth_dev_is_valid_port(port)) {
+ rte_errno = ENODEV;
+ return -rte_errno;
+ }
+ dev = &rte_eth_devices[port];
+ priv = dev->data->dev_private;
+ if (!(priv->representor || priv->master)) {
+ rte_errno = EINVAL;
+ return -rte_errno;
+ }
+ if (es_domain_id)
+ *es_domain_id = priv->domain_id;
+ if (es_port_id)
+ *es_port_id = priv->vport_id;
+ return 0;
+}
+
+/**
* Get switch information associated with network interface.
*
* @param ifindex