X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fliquidio%2Flio_ethdev.c;h=436d25b0b61d9a1139c28334201b09fcfe412c3c;hb=54402696f420b23a3521a53ddae28a1364cac084;hp=60dfa6194e8da6ed87ea4b4843fe0e0713bcad12;hpb=a2186b91b9f426bff966cccee24186a21e2c9bd5;p=dpdk.git diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 60dfa6194e..436d25b0b6 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -32,6 +32,7 @@ */ #include +#include #include #include #include @@ -404,7 +405,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 +827,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. @@ -894,6 +937,9 @@ lio_dev_link_update(struct rte_eth_dev *eth_dev, case LIO_LINK_SPEED_10000: link.link_speed = ETH_SPEED_NUM_10G; break; + case LIO_LINK_SPEED_25000: + link.link_speed = ETH_SPEED_NUM_25G; + break; default: link.link_speed = ETH_SPEED_NUM_NONE; link.link_duplex = ETH_LINK_HALF_DUPLEX; @@ -1113,14 +1159,13 @@ void lio_dev_rx_queue_release(void *rxq) { struct lio_droq *droq = rxq; - struct lio_device *lio_dev = droq->lio_dev; int oq_no; - /* Run time queue deletion not supported */ - if (lio_dev->port_configured) - return; + if (droq) { + /* Run time queue deletion not supported */ + if (droq->lio_dev->port_configured) + return; - if (droq != NULL) { oq_no = droq->q_no; lio_delete_droq_queue(droq->lio_dev, oq_no); } @@ -1208,14 +1253,14 @@ void lio_dev_tx_queue_release(void *txq) { struct lio_instr_queue *tq = txq; - struct lio_device *lio_dev = tq->lio_dev; uint32_t fw_mapped_iq_no; - /* Run time queue deletion not supported */ - if (lio_dev->port_configured) - return; - if (tq != NULL) { + if (tq) { + /* Run time queue deletion not supported */ + if (tq->lio_dev->port_configured) + return; + /* Free sg_list */ lio_delete_sglist(tq); @@ -1750,6 +1795,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, @@ -1968,24 +2014,45 @@ lio_eth_dev_init(struct rte_eth_dev *eth_dev) return 0; } +static int +lio_eth_dev_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, + struct rte_pci_device *pci_dev) +{ + struct rte_eth_dev *eth_dev; + int ret; + + eth_dev = rte_eth_dev_pci_allocate(pci_dev, + sizeof(struct lio_device)); + if (eth_dev == NULL) + return -ENOMEM; + + ret = lio_eth_dev_init(eth_dev); + if (ret) + rte_eth_dev_pci_release(eth_dev); + + return ret; +} + +static int +lio_eth_dev_pci_remove(struct rte_pci_device *pci_dev) +{ + return rte_eth_dev_pci_generic_remove(pci_dev, + lio_eth_dev_uninit); +} + /* Set of PCI devices this driver supports */ static const struct rte_pci_id pci_id_liovf_map[] = { { RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, LIO_CN23XX_VF_VID) }, { .vendor_id = 0, /* sentinel */ } }; -static struct eth_driver rte_liovf_pmd = { - .pci_drv = { - .id_table = pci_id_liovf_map, - .drv_flags = RTE_PCI_DRV_NEED_MAPPING, - .probe = rte_eth_dev_pci_probe, - .remove = rte_eth_dev_pci_remove, - }, - .eth_dev_init = lio_eth_dev_init, - .eth_dev_uninit = lio_eth_dev_uninit, - .dev_private_size = sizeof(struct lio_device), +static struct rte_pci_driver rte_liovf_pmd = { + .id_table = pci_id_liovf_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = lio_eth_dev_pci_probe, + .remove = lio_eth_dev_pci_remove, }; -RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd.pci_drv); +RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map); RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio");