net/mlx5: remove netlink dependency in shared code
This commit adds Linux implementation of routine mlx5_os_mac_addr_flush as wrapper to Netlink API to avoid direct calls under non-Linux operating systems. Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
This commit is contained in:
parent
f2e8b4556f
commit
f00f6562e1
@ -45,6 +45,7 @@
|
||||
#include "mlx5_flow.h"
|
||||
#include "rte_pmd_mlx5.h"
|
||||
#include "mlx5_verbs.h"
|
||||
#include "mlx5_nl.h"
|
||||
|
||||
#define MLX5_TAGS_HLIST_ARRAY_SIZE 8192
|
||||
|
||||
@ -2332,6 +2333,23 @@ mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)
|
||||
mlx5_ifindex(dev), !!enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush device MAC addresses
|
||||
*
|
||||
* @param dev
|
||||
* Pointer to Ethernet device structure.
|
||||
*
|
||||
*/
|
||||
void
|
||||
mlx5_os_mac_addr_flush(struct rte_eth_dev *dev)
|
||||
{
|
||||
struct mlx5_priv *priv = dev->data->dev_private;
|
||||
|
||||
mlx5_nl_mac_addr_flush(priv->nl_socket_route, mlx5_ifindex(dev),
|
||||
dev->data->mac_addrs,
|
||||
MLX5_MAX_MAC_ADDRESSES, priv->mac_own);
|
||||
}
|
||||
|
||||
const struct eth_dev_ops mlx5_os_dev_ops = {
|
||||
.dev_configure = mlx5_dev_configure,
|
||||
.dev_start = mlx5_dev_start,
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
#include <rte_malloc.h>
|
||||
#include <rte_ethdev_driver.h>
|
||||
@ -1406,9 +1405,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
|
||||
if (priv->reta_idx != NULL)
|
||||
mlx5_free(priv->reta_idx);
|
||||
if (priv->config.vf)
|
||||
mlx5_nl_mac_addr_flush(priv->nl_socket_route, mlx5_ifindex(dev),
|
||||
dev->data->mac_addrs,
|
||||
MLX5_MAX_MAC_ADDRESSES, priv->mac_own);
|
||||
mlx5_os_mac_addr_flush(dev);
|
||||
if (priv->nl_socket_route >= 0)
|
||||
close(priv->nl_socket_route);
|
||||
if (priv->nl_socket_rdma >= 0)
|
||||
@ -1446,7 +1443,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
|
||||
/*
|
||||
* Free the shared context in last turn, because the cleanup
|
||||
* routines above may use some shared fields, like
|
||||
* mlx5_nl_mac_addr_flush() uses ibdev_path for retrieveing
|
||||
* mlx5_os_mac_addr_flush() uses ibdev_path for retrieveing
|
||||
* ifindex if Netlink fails.
|
||||
*/
|
||||
mlx5_free_shared_dev_ctx(priv->sh);
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <mlx5_glue.h>
|
||||
#include <mlx5_devx_cmds.h>
|
||||
#include <mlx5_prm.h>
|
||||
#include <mlx5_nl.h>
|
||||
#include <mlx5_common_mp.h>
|
||||
#include <mlx5_common_mr.h>
|
||||
|
||||
@ -1018,6 +1017,7 @@ int mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv, unsigned int iface_idx,
|
||||
int mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable);
|
||||
int mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable);
|
||||
int mlx5_os_set_nonblock_channel_fd(int fd);
|
||||
void mlx5_os_mac_addr_flush(struct rte_eth_dev *dev);
|
||||
|
||||
/* mlx5_txpp.c */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user