net/liquidio: add APIs to enable and disable multicast

Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com>
Signed-off-by: Venkat Koppula <venkat.koppula@caviumnetworks.com>
Signed-off-by: Srisivasubramanian S <ssrinivasan@caviumnetworks.com>
Signed-off-by: Mallesham Jatharakonda <mjatharakonda@oneconvergence.com>
This commit is contained in:
Shijith Thotton 2017-03-25 11:54:48 +05:30 committed by Ferruh Yigit
parent 605164c8e7
commit 59a71cf7ec
3 changed files with 71 additions and 0 deletions

View File

@ -8,6 +8,7 @@ Link status = Y
Link status event = Y Link status event = Y
Jumbo frame = Y Jumbo frame = Y
Scattered Rx = Y Scattered Rx = Y
Allmulticast mode = Y
RSS hash = Y RSS hash = Y
RSS key update = Y RSS key update = Y
RSS reta update = Y RSS reta update = Y

View File

@ -130,6 +130,7 @@ enum octeon_tag_type {
#define LIO_MAX_RX_PKTLEN (64 * 1024) #define LIO_MAX_RX_PKTLEN (64 * 1024)
/* NIC Command types */ /* NIC Command types */
#define LIO_CMD_CHANGE_DEVFLAGS 0x3
#define LIO_CMD_RX_CTL 0x4 #define LIO_CMD_RX_CTL 0x4
#define LIO_CMD_SET_RSS 0xD #define LIO_CMD_SET_RSS 0xD
@ -165,6 +166,7 @@ enum octeon_tag_type {
/* Interface flags communicated between host driver and core app. */ /* Interface flags communicated between host driver and core app. */
enum lio_ifflags { enum lio_ifflags {
LIO_IFFLAG_ALLMULTI = 0x02,
LIO_IFFLAG_UNICAST = 0x10 LIO_IFFLAG_UNICAST = 0x10
}; };

View File

@ -522,6 +522,72 @@ lio_dev_link_update(struct rte_eth_dev *eth_dev,
return 0; return 0;
} }
/**
* \brief Net device enable, disable allmulticast
* @param eth_dev Pointer to the structure rte_eth_dev
*/
static void
lio_change_dev_flag(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
struct lio_dev_ctrl_cmd ctrl_cmd;
struct lio_ctrl_pkt ctrl_pkt;
/* flush added to prevent cmd failure
* incase the queue is full
*/
lio_flush_iq(lio_dev, lio_dev->instr_queue[0]);
memset(&ctrl_pkt, 0, sizeof(struct lio_ctrl_pkt));
memset(&ctrl_cmd, 0, sizeof(struct lio_dev_ctrl_cmd));
ctrl_cmd.eth_dev = eth_dev;
ctrl_cmd.cond = 0;
/* Create a ctrl pkt command to be sent to core app. */
ctrl_pkt.ncmd.s.cmd = LIO_CMD_CHANGE_DEVFLAGS;
ctrl_pkt.ncmd.s.param1 = lio_dev->ifflags;
ctrl_pkt.ctrl_cmd = &ctrl_cmd;
if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
lio_dev_err(lio_dev, "Failed to send change flag message\n");
return;
}
if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd))
lio_dev_err(lio_dev, "Change dev flag command timed out\n");
}
static void
lio_dev_allmulticast_enable(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
if (!lio_dev->intf_open) {
lio_dev_err(lio_dev, "Port %d down, can't enable multicast\n",
lio_dev->port_id);
return;
}
lio_dev->ifflags |= LIO_IFFLAG_ALLMULTI;
lio_change_dev_flag(eth_dev);
}
static void
lio_dev_allmulticast_disable(struct rte_eth_dev *eth_dev)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
if (!lio_dev->intf_open) {
lio_dev_err(lio_dev, "Port %d down, can't disable multicast\n",
lio_dev->port_id);
return;
}
lio_dev->ifflags &= ~LIO_IFFLAG_ALLMULTI;
lio_change_dev_flag(eth_dev);
}
static void static void
lio_dev_rss_configure(struct rte_eth_dev *eth_dev) lio_dev_rss_configure(struct rte_eth_dev *eth_dev)
{ {
@ -1078,6 +1144,8 @@ static int lio_dev_configure(struct rte_eth_dev *eth_dev)
static const struct eth_dev_ops liovf_eth_dev_ops = { static const struct eth_dev_ops liovf_eth_dev_ops = {
.dev_configure = lio_dev_configure, .dev_configure = lio_dev_configure,
.dev_start = lio_dev_start, .dev_start = lio_dev_start,
.allmulticast_enable = lio_dev_allmulticast_enable,
.allmulticast_disable = lio_dev_allmulticast_disable,
.link_update = lio_dev_link_update, .link_update = lio_dev_link_update,
.dev_infos_get = lio_dev_info_get, .dev_infos_get = lio_dev_info_get,
.rx_queue_setup = lio_dev_rx_queue_setup, .rx_queue_setup = lio_dev_rx_queue_setup,