net/enic: enable IOVA mode
[dpdk.git] / drivers / net / enic / enic_ethdev.c
index 117b362..65333c4 100644 (file)
 int enicpmd_logtype_init;
 int enicpmd_logtype_flow;
 
-#define PMD_INIT_LOG(level, fmt, args...) \
-       rte_log(RTE_LOG_ ## level, enicpmd_logtype_init, \
-               "%s" fmt "\n", __func__, ##args)
-
 #define ENICPMD_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
 
 /*
@@ -43,9 +39,7 @@ static const struct rte_pci_id pci_id_enic_map[] = {
 #define ENIC_DEVARG_DISABLE_OVERLAY "disable-overlay"
 #define ENIC_DEVARG_IG_VLAN_REWRITE "ig-vlan-rewrite"
 
-RTE_INIT(enicpmd_init_log);
-static void
-enicpmd_init_log(void)
+RTE_INIT(enicpmd_init_log)
 {
        enicpmd_logtype_init = rte_log_register("pmd.net.enic.init");
        if (enicpmd_logtype_init >= 0)
@@ -185,17 +179,21 @@ static int enicpmd_dev_tx_queue_setup(struct rte_eth_dev *eth_dev,
        uint16_t queue_idx,
        uint16_t nb_desc,
        unsigned int socket_id,
-       __rte_unused const struct rte_eth_txconf *tx_conf)
+       const struct rte_eth_txconf *tx_conf)
 {
        int ret;
        struct enic *enic = pmd_priv(eth_dev);
+       struct vnic_wq *wq;
 
        if (rte_eal_process_type() != RTE_PROC_PRIMARY)
                return -E_RTE_SECONDARY;
 
        ENICPMD_FUNC_TRACE();
        RTE_ASSERT(queue_idx < enic->conf_wq_count);
-       eth_dev->data->tx_queues[queue_idx] = (void *)&enic->wq[queue_idx];
+       wq = &enic->wq[queue_idx];
+       wq->offloads = tx_conf->offloads |
+               eth_dev->data->dev_conf.txmode.offloads;
+       eth_dev->data->tx_queues[queue_idx] = (void *)wq;
 
        ret = enic_alloc_wq(enic, queue_idx, socket_id, nb_desc);
        if (ret) {
@@ -477,6 +475,7 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
        device_info->max_mac_addrs = ENIC_MAX_MAC_ADDR;
        device_info->rx_offload_capa = enic->rx_offload_capa;
        device_info->tx_offload_capa = enic->tx_offload_capa;
+       device_info->tx_queue_offload_capa = enic->tx_queue_offload_capa;
        device_info->default_rxconf = (struct rte_eth_rxconf) {
                .rx_free_thresh = ENIC_DEFAULT_RX_FREE_THRESH
        };
@@ -523,7 +522,8 @@ static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
                RTE_PTYPE_UNKNOWN
        };
 
-       if (dev->rx_pkt_burst == enic_recv_pkts)
+       if (dev->rx_pkt_burst == enic_recv_pkts ||
+           dev->rx_pkt_burst == enic_noscatter_recv_pkts)
                return ptypes;
        return NULL;
 }
@@ -765,7 +765,7 @@ static void enicpmd_dev_txq_info_get(struct rte_eth_dev *dev,
        ENICPMD_FUNC_TRACE();
        qinfo->nb_desc = wq->ring.desc_count;
        memset(&qinfo->conf, 0, sizeof(qinfo->conf));
-       qinfo->conf.offloads = enic->tx_offload_capa;
+       qinfo->conf.offloads = wq->offloads;
        /* tx_thresh, and all the other fields are not applicable for enic */
 }
 
@@ -1044,7 +1044,8 @@ static int eth_enic_pci_remove(struct rte_pci_device *pci_dev)
 
 static struct rte_pci_driver rte_enic_pmd = {
        .id_table = pci_id_enic_map,
-       .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
+       .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC |
+                    RTE_PCI_DRV_IOVA_AS_VA,
        .probe = eth_enic_pci_probe,
        .remove = eth_enic_pci_remove,
 };