net/sfc: support Rx interrupts for efx datapath
[dpdk.git] / drivers / net / sfc / sfc_ethdev.c
index a007d45..be185d5 100644 (file)
@@ -93,7 +93,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 
        sfc_log_init(sa, "entry");
 
-       dev_info->min_mtu = ETHER_MIN_MTU;
+       dev_info->min_mtu = RTE_ETHER_MIN_MTU;
        dev_info->max_mtu = EFX_MAC_SDU_MAX;
 
        dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
@@ -941,7 +941,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
         * The driver does not use it, but other PMDs update jumbo frame
         * flag and max_rx_pkt_len when MTU is set.
         */
-       if (mtu > ETHER_MAX_LEN) {
+       if (mtu > RTE_ETHER_MAX_LEN) {
                struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
                rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
        }
@@ -969,12 +969,12 @@ fail_inval:
        return -rc;
 }
 static int
-sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
+sfc_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
 {
        struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
        const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
        struct sfc_port *port = &sa->port;
-       struct ether_addr *old_addr = &dev->data->mac_addrs[0];
+       struct rte_ether_addr *old_addr = &dev->data->mac_addrs[0];
        int rc = 0;
 
        sfc_adapter_lock(sa);
@@ -983,7 +983,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
         * Copy the address to the device private data so that
         * it could be recalled in the case of adapter restart.
         */
-       ether_addr_copy(mac_addr, &port->default_mac_addr);
+       rte_ether_addr_copy(mac_addr, &port->default_mac_addr);
 
        /*
         * Neither of the two following checks can return
@@ -1043,7 +1043,7 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
 
 unlock:
        if (rc != 0)
-               ether_addr_copy(old_addr, &port->default_mac_addr);
+               rte_ether_addr_copy(old_addr, &port->default_mac_addr);
 
        sfc_adapter_unlock(sa);
 
@@ -1053,8 +1053,8 @@ unlock:
 
 
 static int
-sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set,
-                    uint32_t nb_mc_addr)
+sfc_set_mc_addr_list(struct rte_eth_dev *dev,
+               struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr)
 {
        struct sfc_adapter *sa = sfc_adapter_by_eth_dev(dev);
        struct sfc_port *port = &sa->port;
@@ -1713,6 +1713,32 @@ sfc_pool_ops_supported(struct rte_eth_dev *dev, const char *pool)
        return sap->dp_rx->pool_ops_supported(pool);
 }
 
+static int
+sfc_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
+{
+       const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev);
+       struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
+       struct sfc_rxq_info *rxq_info;
+
+       SFC_ASSERT(queue_id < sas->rxq_count);
+       rxq_info = &sas->rxq_info[queue_id];
+
+       return sap->dp_rx->intr_enable(rxq_info->dp);
+}
+
+static int
+sfc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
+{
+       const struct sfc_adapter_priv *sap = sfc_adapter_priv_by_eth_dev(dev);
+       struct sfc_adapter_shared *sas = sfc_adapter_shared_by_eth_dev(dev);
+       struct sfc_rxq_info *rxq_info;
+
+       SFC_ASSERT(queue_id < sas->rxq_count);
+       rxq_info = &sas->rxq_info[queue_id];
+
+       return sap->dp_rx->intr_disable(rxq_info->dp);
+}
+
 static const struct eth_dev_ops sfc_eth_dev_ops = {
        .dev_configure                  = sfc_dev_configure,
        .dev_start                      = sfc_dev_start,
@@ -1743,6 +1769,8 @@ static const struct eth_dev_ops sfc_eth_dev_ops = {
        .rx_descriptor_done             = sfc_rx_descriptor_done,
        .rx_descriptor_status           = sfc_rx_descriptor_status,
        .tx_descriptor_status           = sfc_tx_descriptor_status,
+       .rx_queue_intr_enable           = sfc_rx_queue_intr_enable,
+       .rx_queue_intr_disable          = sfc_rx_queue_intr_disable,
        .tx_queue_setup                 = sfc_tx_queue_setup,
        .tx_queue_release               = sfc_tx_queue_release,
        .flow_ctrl_get                  = sfc_flow_ctrl_get,
@@ -2053,7 +2081,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
        struct sfc_adapter *sa;
        int rc;
        const efx_nic_cfg_t *encp;
-       const struct ether_addr *from;
+       const struct rte_ether_addr *from;
 
        sfc_register_dp();
 
@@ -2095,7 +2123,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
 
        sfc_log_init(sa, "entry");
 
-       dev->data->mac_addrs = rte_zmalloc("sfc", ETHER_ADDR_LEN, 0);
+       dev->data->mac_addrs = rte_zmalloc("sfc", RTE_ETHER_ADDR_LEN, 0);
        if (dev->data->mac_addrs == NULL) {
                rc = ENOMEM;
                goto fail_mac_addrs;
@@ -2125,8 +2153,8 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
         * The arguments are really reverse order in comparison to
         * Linux kernel. Copy from NIC config to Ethernet device data.
         */
-       from = (const struct ether_addr *)(encp->enc_mac_addr);
-       ether_addr_copy(from, &dev->data->mac_addrs[0]);
+       from = (const struct rte_ether_addr *)(encp->enc_mac_addr);
+       rte_ether_addr_copy(from, &dev->data->mac_addrs[0]);
 
        sfc_adapter_unlock(sa);