net/liquidio: add API to add and remove VLAN port

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:56 +05:30 committed by Ferruh Yigit
parent a2186b91b9
commit e70d2ae598
3 changed files with 48 additions and 1 deletions

View File

@ -12,7 +12,9 @@ Allmulticast mode = Y
RSS hash = Y
RSS key update = Y
RSS reta update = Y
VLAN filter = Y
CRC offload = Y
VLAN offload = P
L3 checksum offload = Y
L4 checksum offload = Y
Inner L3 checksum = Y

View File

@ -137,6 +137,8 @@ enum octeon_tag_type {
#define LIO_CMD_SET_RSS 0xD
#define LIO_CMD_TNL_RX_CSUM_CTL 0x10
#define LIO_CMD_TNL_TX_CSUM_CTL 0x11
#define LIO_CMD_ADD_VLAN_FILTER 0x17
#define LIO_CMD_DEL_VLAN_FILTER 0x18
#define LIO_CMD_VXLAN_PORT_CONFIG 0x19
#define LIO_CMD_VXLAN_PORT_ADD 0x0

View File

@ -404,7 +404,8 @@ lio_dev_info_get(struct rte_eth_dev *eth_dev,
devinfo->rx_offload_capa = (DEV_RX_OFFLOAD_IPV4_CKSUM |
DEV_RX_OFFLOAD_UDP_CKSUM |
DEV_RX_OFFLOAD_TCP_CKSUM);
DEV_RX_OFFLOAD_TCP_CKSUM |
DEV_RX_OFFLOAD_VLAN_STRIP);
devinfo->tx_offload_capa = (DEV_TX_OFFLOAD_IPV4_CKSUM |
DEV_TX_OFFLOAD_UDP_CKSUM |
DEV_TX_OFFLOAD_TCP_CKSUM |
@ -825,6 +826,47 @@ lio_dev_udp_tunnel_del(struct rte_eth_dev *eth_dev,
return 0;
}
static int
lio_dev_vlan_filter_set(struct rte_eth_dev *eth_dev, uint16_t vlan_id, int on)
{
struct lio_device *lio_dev = LIO_DEV(eth_dev);
struct lio_dev_ctrl_cmd ctrl_cmd;
struct lio_ctrl_pkt ctrl_pkt;
if (lio_dev->linfo.vlan_is_admin_assigned)
return -EPERM;
/* 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;
ctrl_pkt.ncmd.s.cmd = on ?
LIO_CMD_ADD_VLAN_FILTER : LIO_CMD_DEL_VLAN_FILTER;
ctrl_pkt.ncmd.s.param1 = vlan_id;
ctrl_pkt.ctrl_cmd = &ctrl_cmd;
if (lio_send_ctrl_pkt(lio_dev, &ctrl_pkt)) {
lio_dev_err(lio_dev, "Failed to %s VLAN port\n",
on ? "add" : "remove");
return -1;
}
if (lio_wait_for_ctrl_cmd(lio_dev, &ctrl_cmd)) {
lio_dev_err(lio_dev, "Command to %s VLAN port timed out\n",
on ? "add" : "remove");
return -1;
}
return 0;
}
/**
* Atomically writes the link status information into global
* structure rte_eth_dev.
@ -1750,6 +1792,7 @@ static const struct eth_dev_ops liovf_eth_dev_ops = {
.stats_reset = lio_dev_stats_reset,
.xstats_reset = lio_dev_xstats_reset,
.dev_infos_get = lio_dev_info_get,
.vlan_filter_set = lio_dev_vlan_filter_set,
.rx_queue_setup = lio_dev_rx_queue_setup,
.rx_queue_release = lio_dev_rx_queue_release,
.tx_queue_setup = lio_dev_tx_queue_setup,