2018-01-29 13:11:30 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright 2015 6WIND S.A.
|
2018-03-20 19:20:35 +00:00
|
|
|
* Copyright 2015 Mellanox Technologies, Ltd
|
2015-10-30 18:52:37 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
/* Verbs header. */
|
|
|
|
/* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */
|
|
|
|
#ifdef PEDANTIC
|
2016-09-19 14:36:54 +00:00
|
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
2015-10-30 18:52:37 +00:00
|
|
|
#endif
|
|
|
|
#include <infiniband/verbs.h>
|
|
|
|
#ifdef PEDANTIC
|
2016-09-19 14:36:54 +00:00
|
|
|
#pragma GCC diagnostic error "-Wpedantic"
|
2015-10-30 18:52:37 +00:00
|
|
|
#endif
|
|
|
|
|
2018-01-22 00:16:22 +00:00
|
|
|
#include <rte_ethdev_driver.h>
|
2015-10-30 18:52:37 +00:00
|
|
|
|
|
|
|
#include "mlx5.h"
|
|
|
|
#include "mlx5_rxtx.h"
|
|
|
|
#include "mlx5_utils.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DPDK callback to enable promiscuous mode.
|
|
|
|
*
|
|
|
|
* @param dev
|
|
|
|
* Pointer to Ethernet device structure.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
mlx5_promiscuous_enable(struct rte_eth_dev *dev)
|
|
|
|
{
|
2018-03-05 12:21:06 +00:00
|
|
|
int ret;
|
|
|
|
|
2017-10-09 14:44:53 +00:00
|
|
|
dev->data->promiscuous = 1;
|
2018-04-05 15:07:20 +00:00
|
|
|
if (((struct priv *)dev->data->dev_private)->config.vf)
|
|
|
|
mlx5_nl_promisc(dev, 1);
|
2018-03-05 12:21:06 +00:00
|
|
|
ret = mlx5_traffic_restart(dev);
|
|
|
|
if (ret)
|
2018-03-13 09:23:56 +00:00
|
|
|
DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
|
|
|
|
dev->data->port_id, strerror(rte_errno));
|
2015-10-30 18:52:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DPDK callback to disable promiscuous mode.
|
|
|
|
*
|
|
|
|
* @param dev
|
|
|
|
* Pointer to Ethernet device structure.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
mlx5_promiscuous_disable(struct rte_eth_dev *dev)
|
|
|
|
{
|
2018-03-05 12:21:06 +00:00
|
|
|
int ret;
|
|
|
|
|
2017-10-09 14:44:53 +00:00
|
|
|
dev->data->promiscuous = 0;
|
2018-04-05 15:07:20 +00:00
|
|
|
if (((struct priv *)dev->data->dev_private)->config.vf)
|
|
|
|
mlx5_nl_promisc(dev, 0);
|
2018-03-05 12:21:06 +00:00
|
|
|
ret = mlx5_traffic_restart(dev);
|
|
|
|
if (ret)
|
2018-03-13 09:23:56 +00:00
|
|
|
DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
|
|
|
|
dev->data->port_id, strerror(rte_errno));
|
2015-10-30 18:52:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DPDK callback to enable allmulti mode.
|
|
|
|
*
|
|
|
|
* @param dev
|
|
|
|
* Pointer to Ethernet device structure.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
mlx5_allmulticast_enable(struct rte_eth_dev *dev)
|
|
|
|
{
|
2018-03-05 12:21:06 +00:00
|
|
|
int ret;
|
|
|
|
|
2017-10-09 14:44:54 +00:00
|
|
|
dev->data->all_multicast = 1;
|
2018-04-05 15:07:20 +00:00
|
|
|
if (((struct priv *)dev->data->dev_private)->config.vf)
|
|
|
|
mlx5_nl_allmulti(dev, 1);
|
2018-03-05 12:21:06 +00:00
|
|
|
ret = mlx5_traffic_restart(dev);
|
|
|
|
if (ret)
|
2018-03-13 09:23:56 +00:00
|
|
|
DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s",
|
|
|
|
dev->data->port_id, strerror(rte_errno));
|
2015-10-30 18:52:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DPDK callback to disable allmulti mode.
|
|
|
|
*
|
|
|
|
* @param dev
|
|
|
|
* Pointer to Ethernet device structure.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
mlx5_allmulticast_disable(struct rte_eth_dev *dev)
|
|
|
|
{
|
2018-03-05 12:21:06 +00:00
|
|
|
int ret;
|
|
|
|
|
2017-10-09 14:44:54 +00:00
|
|
|
dev->data->all_multicast = 0;
|
2018-04-05 15:07:20 +00:00
|
|
|
if (((struct priv *)dev->data->dev_private)->config.vf)
|
|
|
|
mlx5_nl_allmulti(dev, 0);
|
2018-03-05 12:21:06 +00:00
|
|
|
ret = mlx5_traffic_restart(dev);
|
|
|
|
if (ret)
|
2018-03-13 09:23:56 +00:00
|
|
|
DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",
|
|
|
|
dev->data->port_id, strerror(rte_errno));
|
2015-10-30 18:52:37 +00:00
|
|
|
}
|