net/nfp: move VF functions into its own file
[dpdk.git] / drivers / net / nfp / nfp_net.c
index de0de80..a46c4dd 100644 (file)
@@ -43,6 +43,7 @@
 #include "nfp_rxtx.h"
 #include "nfp_net_logs.h"
 #include "nfp_net_ctrl.h"
+#include "nfp_cpp_bridge.h"
 
 #include <sys/types.h>
 #include <sys/socket.h>
 
 /* Prototypes */
 static int nfp_net_close(struct rte_eth_dev *dev);
-static int nfp_net_configure(struct rte_eth_dev *dev);
-static void nfp_net_dev_interrupt_handler(void *param);
-static void nfp_net_dev_interrupt_delayed_handler(void *param);
-static int nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
-static int nfp_net_infos_get(struct rte_eth_dev *dev,
-                            struct rte_eth_dev_info *dev_info);
 static int nfp_net_init(struct rte_eth_dev *eth_dev);
 static int nfp_pf_init(struct rte_pci_device *pci_dev);
 static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev);
+static int nfp_net_pf_read_mac(struct nfp_pf_dev *pf_dev, int port);
 static int nfp_pci_uninit(struct rte_eth_dev *eth_dev);
 static int nfp_init_phyports(struct nfp_pf_dev *pf_dev);
-static int nfp_net_link_update(struct rte_eth_dev *dev, int wait_to_complete);
-static int nfp_net_promisc_enable(struct rte_eth_dev *dev);
-static int nfp_net_promisc_disable(struct rte_eth_dev *dev);
-static int nfp_net_start(struct rte_eth_dev *dev);
-static int nfp_net_stats_get(struct rte_eth_dev *dev,
-                             struct rte_eth_stats *stats);
-static int nfp_net_stats_reset(struct rte_eth_dev *dev);
 static int nfp_net_stop(struct rte_eth_dev *dev);
-static int nfp_net_rss_config_default(struct rte_eth_dev *dev);
-static int nfp_net_rss_hash_update(struct rte_eth_dev *dev,
-                                  struct rte_eth_rss_conf *rss_conf);
-static int nfp_net_rss_reta_write(struct rte_eth_dev *dev,
-                   struct rte_eth_rss_reta_entry64 *reta_conf,
-                   uint16_t reta_size);
-static int nfp_net_rss_hash_write(struct rte_eth_dev *dev,
-                       struct rte_eth_rss_conf *rss_conf);
-static int nfp_set_mac_addr(struct rte_eth_dev *dev,
-                            struct rte_ether_addr *mac_addr);
-static int32_t nfp_cpp_bridge_service_func(void *args);
-static void nfp_register_cpp_service(struct nfp_cpp *cpp);
 static int nfp_fw_setup(struct rte_pci_device *dev,
                        struct nfp_cpp *cpp,
                        struct nfp_eth_table *nfp_eth_table,
@@ -139,7 +116,7 @@ __nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t update)
  * Write the update word to the BAR and ping the reconfig queue. Then poll
  * until the firmware has acknowledged the update by zeroing the update word.
  */
-static int
+int
 nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update)
 {
        uint32_t err;
@@ -175,7 +152,7 @@ nfp_net_reconfig(struct nfp_net_hw *hw, uint32_t ctrl, uint32_t update)
  * before any other function in the Ethernet API. This function can
  * also be re-invoked when a device is in the stopped state.
  */
-static int
+int
 nfp_net_configure(struct rte_eth_dev *dev)
 {
        struct rte_eth_conf *dev_conf;
@@ -218,7 +195,7 @@ nfp_net_configure(struct rte_eth_dev *dev)
        return 0;
 }
 
-static void
+void
 nfp_net_enable_queues(struct rte_eth_dev *dev)
 {
        struct nfp_net_hw *hw;
@@ -242,7 +219,7 @@ nfp_net_enable_queues(struct rte_eth_dev *dev)
        nn_cfg_writeq(hw, NFP_NET_CFG_RXRS_ENABLE, enabled_queues);
 }
 
-static void
+void
 nfp_net_disable_queues(struct rte_eth_dev *dev)
 {
        struct nfp_net_hw *hw;
@@ -267,14 +244,14 @@ nfp_net_disable_queues(struct rte_eth_dev *dev)
        hw->ctrl = new_ctrl;
 }
 
-static void
+void
 nfp_net_params_setup(struct nfp_net_hw *hw)
 {
        nn_cfg_writel(hw, NFP_NET_CFG_MTU, hw->mtu);
        nn_cfg_writel(hw, NFP_NET_CFG_FLBUFSZ, hw->flbufsz);
 }
 
-static void
+void
 nfp_net_cfg_queue_setup(struct nfp_net_hw *hw)
 {
        hw->qcp_cfg = hw->tx_bar + NFP_QCP_QUEUE_ADDR_SZ;
@@ -282,7 +259,7 @@ nfp_net_cfg_queue_setup(struct nfp_net_hw *hw)
 
 #define ETH_ADDR_LEN   6
 
-static void
+void
 nfp_eth_copy_mac(uint8_t *dst, const uint8_t *src)
 {
        int i;
@@ -309,19 +286,7 @@ nfp_net_pf_read_mac(struct nfp_pf_dev *pf_dev, int port)
        return 0;
 }
 
-static void
-nfp_net_vf_read_mac(struct nfp_net_hw *hw)
-{
-       uint32_t tmp;
-
-       tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR));
-       memcpy(&hw->mac_addr[0], &tmp, 4);
-
-       tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR + 4));
-       memcpy(&hw->mac_addr[4], &tmp, 2);
-}
-
-static void
+void
 nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac)
 {
        uint32_t mac0 = *(uint32_t *)mac;
@@ -369,7 +334,7 @@ nfp_set_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)
        return 0;
 }
 
-static int
+int
 nfp_configure_rx_interrupt(struct rte_eth_dev *dev,
                           struct rte_intr_handle *intr_handle)
 {
@@ -413,7 +378,7 @@ nfp_configure_rx_interrupt(struct rte_eth_dev *dev,
        return 0;
 }
 
-static uint32_t
+uint32_t
 nfp_check_offloads(struct rte_eth_dev *dev)
 {
        struct nfp_net_hw *hw;
@@ -749,7 +714,7 @@ nfp_net_close(struct rte_eth_dev *dev)
        return 0;
 }
 
-static int
+int
 nfp_net_promisc_enable(struct rte_eth_dev *dev)
 {
        uint32_t new_ctrl, update = 0;
@@ -786,7 +751,7 @@ nfp_net_promisc_enable(struct rte_eth_dev *dev)
        return 0;
 }
 
-static int
+int
 nfp_net_promisc_disable(struct rte_eth_dev *dev)
 {
        uint32_t new_ctrl, update = 0;
@@ -822,7 +787,7 @@ nfp_net_promisc_disable(struct rte_eth_dev *dev)
  * Wait to complete is needed as it can take up to 9 seconds to get the Link
  * status.
  */
-static int
+int
 nfp_net_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
 {
        struct nfp_net_hw *hw;
@@ -872,7 +837,7 @@ nfp_net_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
        return ret;
 }
 
-static int
+int
 nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
        int i;
@@ -967,7 +932,7 @@ nfp_net_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        return -EINVAL;
 }
 
-static int
+int
 nfp_net_stats_reset(struct rte_eth_dev *dev)
 {
        int i;
@@ -1032,7 +997,7 @@ nfp_net_stats_reset(struct rte_eth_dev *dev)
        return 0;
 }
 
-static int
+int
 nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct nfp_net_hw *hw;
@@ -1126,7 +1091,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        return 0;
 }
 
-static const uint32_t *
+const uint32_t *
 nfp_net_supported_ptypes_get(struct rte_eth_dev *dev)
 {
        static const uint32_t ptypes[] = {
@@ -1143,7 +1108,7 @@ nfp_net_supported_ptypes_get(struct rte_eth_dev *dev)
        return NULL;
 }
 
-static int
+int
 nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
        struct rte_pci_device *pci_dev;
@@ -1163,7 +1128,7 @@ nfp_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
        return 0;
 }
 
-static int
+int
 nfp_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
 {
        struct rte_pci_device *pci_dev;
@@ -1232,7 +1197,32 @@ nfp_net_irq_unmask(struct rte_eth_dev *dev)
        }
 }
 
+/*
+ * Interrupt handler which shall be registered for alarm callback for delayed
+ * handling specific interrupt to wait for the stable nic state. As the NIC
+ * interrupt state is not stable for nfp after link is just down, it needs
+ * to wait 4 seconds to get the stable status.
+ *
+ * @param handle   Pointer to interrupt handle.
+ * @param param    The address of parameter (struct rte_eth_dev *)
+ *
+ * @return  void
+ */
 static void
+nfp_net_dev_interrupt_delayed_handler(void *param)
+{
+       struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
+
+       nfp_net_link_update(dev, 0);
+       rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
+
+       nfp_net_dev_link_status_print(dev);
+
+       /* Unmasking */
+       nfp_net_irq_unmask(dev);
+}
+
+void
 nfp_net_dev_interrupt_handler(void *param)
 {
        int64_t timeout;
@@ -1264,32 +1254,7 @@ nfp_net_dev_interrupt_handler(void *param)
        }
 }
 
-/*
- * Interrupt handler which shall be registered for alarm callback for delayed
- * handling specific interrupt to wait for the stable nic state. As the NIC
- * interrupt state is not stable for nfp after link is just down, it needs
- * to wait 4 seconds to get the stable status.
- *
- * @param handle   Pointer to interrupt handle.
- * @param param    The address of parameter (struct rte_eth_dev *)
- *
- * @return  void
- */
-static void
-nfp_net_dev_interrupt_delayed_handler(void *param)
-{
-       struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
-
-       nfp_net_link_update(dev, 0);
-       rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
-
-       nfp_net_dev_link_status_print(dev);
-
-       /* Unmasking */
-       nfp_net_irq_unmask(dev);
-}
-
-static int
+int
 nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
        struct nfp_net_hw *hw;
@@ -1324,7 +1289,7 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
        return 0;
 }
 
-static int
+int
 nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 {
        uint32_t new_ctrl, update;
@@ -1407,7 +1372,7 @@ nfp_net_rss_reta_write(struct rte_eth_dev *dev,
 }
 
 /* Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device */
-static int
+int
 nfp_net_reta_update(struct rte_eth_dev *dev,
                    struct rte_eth_rss_reta_entry64 *reta_conf,
                    uint16_t reta_size)
@@ -1433,7 +1398,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev,
 }
 
  /* Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device. */
-static int
+int
 nfp_net_reta_query(struct rte_eth_dev *dev,
                   struct rte_eth_rss_reta_entry64 *reta_conf,
                   uint16_t reta_size)
@@ -1530,7 +1495,7 @@ nfp_net_rss_hash_write(struct rte_eth_dev *dev,
        return 0;
 }
 
-static int
+int
 nfp_net_rss_hash_update(struct rte_eth_dev *dev,
                        struct rte_eth_rss_conf *rss_conf)
 {
@@ -1566,7 +1531,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev,
        return 0;
 }
 
-static int
+int
 nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
                          struct rte_eth_rss_conf *rss_conf)
 {
@@ -1617,7 +1582,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev,
        return 0;
 }
 
-static int
+int
 nfp_net_rss_config_default(struct rte_eth_dev *dev)
 {
        struct rte_eth_conf *dev_conf;
@@ -1878,8 +1843,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
        if (hw->is_phyport) {
                nfp_net_pf_read_mac(pf_dev, port);
                nfp_net_write_mac(hw, (uint8_t *)&hw->mac_addr);
-       } else {
-               nfp_net_vf_read_mac(hw);
        }
 
        if (!rte_is_valid_assigned_ether_addr(
@@ -1928,353 +1891,6 @@ dev_err_ctrl_map:
        return err;
 }
 
-#define NFP_CPP_MEMIO_BOUNDARY         (1 << 20)
-
-/*
- * Serving a write request to NFP from host programs. The request
- * sends the write size and the CPP target. The bridge makes use
- * of CPP interface handler configured by the PMD setup.
- */
-static int
-nfp_cpp_bridge_serve_write(int sockfd, struct nfp_cpp *cpp)
-{
-       struct nfp_cpp_area *area;
-       off_t offset, nfp_offset;
-       uint32_t cpp_id, pos, len;
-       uint32_t tmpbuf[16];
-       size_t count, curlen, totlen = 0;
-       int err = 0;
-
-       PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__,
-               sizeof(off_t), sizeof(size_t));
-
-       /* Reading the count param */
-       err = recv(sockfd, &count, sizeof(off_t), 0);
-       if (err != sizeof(off_t))
-               return -EINVAL;
-
-       curlen = count;
-
-       /* Reading the offset param */
-       err = recv(sockfd, &offset, sizeof(off_t), 0);
-       if (err != sizeof(off_t))
-               return -EINVAL;
-
-       /* Obtain target's CPP ID and offset in target */
-       cpp_id = (offset >> 40) << 8;
-       nfp_offset = offset & ((1ull << 40) - 1);
-
-       PMD_CPP_LOG(DEBUG, "%s: count %zu and offset %jd\n", __func__, count,
-               offset);
-       PMD_CPP_LOG(DEBUG, "%s: cpp_id %08x and nfp_offset %jd\n", __func__,
-               cpp_id, nfp_offset);
-
-       /* Adjust length if not aligned */
-       if (((nfp_offset + (off_t)count - 1) & ~(NFP_CPP_MEMIO_BOUNDARY - 1)) !=
-           (nfp_offset & ~(NFP_CPP_MEMIO_BOUNDARY - 1))) {
-               curlen = NFP_CPP_MEMIO_BOUNDARY -
-                       (nfp_offset & (NFP_CPP_MEMIO_BOUNDARY - 1));
-       }
-
-       while (count > 0) {
-               /* configure a CPP PCIe2CPP BAR for mapping the CPP target */
-               area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
-                                                   nfp_offset, curlen);
-               if (!area) {
-                       RTE_LOG(ERR, PMD, "%s: area alloc fail\n", __func__);
-                       return -EIO;
-               }
-
-               /* mapping the target */
-               err = nfp_cpp_area_acquire(area);
-               if (err < 0) {
-                       RTE_LOG(ERR, PMD, "area acquire failed\n");
-                       nfp_cpp_area_free(area);
-                       return -EIO;
-               }
-
-               for (pos = 0; pos < curlen; pos += len) {
-                       len = curlen - pos;
-                       if (len > sizeof(tmpbuf))
-                               len = sizeof(tmpbuf);
-
-                       PMD_CPP_LOG(DEBUG, "%s: Receive %u of %zu\n", __func__,
-                                          len, count);
-                       err = recv(sockfd, tmpbuf, len, MSG_WAITALL);
-                       if (err != (int)len) {
-                               RTE_LOG(ERR, PMD,
-                                       "%s: error when receiving, %d of %zu\n",
-                                       __func__, err, count);
-                               nfp_cpp_area_release(area);
-                               nfp_cpp_area_free(area);
-                               return -EIO;
-                       }
-                       err = nfp_cpp_area_write(area, pos, tmpbuf, len);
-                       if (err < 0) {
-                               RTE_LOG(ERR, PMD, "nfp_cpp_area_write error\n");
-                               nfp_cpp_area_release(area);
-                               nfp_cpp_area_free(area);
-                               return -EIO;
-                       }
-               }
-
-               nfp_offset += pos;
-               totlen += pos;
-               nfp_cpp_area_release(area);
-               nfp_cpp_area_free(area);
-
-               count -= pos;
-               curlen = (count > NFP_CPP_MEMIO_BOUNDARY) ?
-                        NFP_CPP_MEMIO_BOUNDARY : count;
-       }
-
-       return 0;
-}
-
-/*
- * Serving a read request to NFP from host programs. The request
- * sends the read size and the CPP target. The bridge makes use
- * of CPP interface handler configured by the PMD setup. The read
- * data is sent to the requester using the same socket.
- */
-static int
-nfp_cpp_bridge_serve_read(int sockfd, struct nfp_cpp *cpp)
-{
-       struct nfp_cpp_area *area;
-       off_t offset, nfp_offset;
-       uint32_t cpp_id, pos, len;
-       uint32_t tmpbuf[16];
-       size_t count, curlen, totlen = 0;
-       int err = 0;
-
-       PMD_CPP_LOG(DEBUG, "%s: offset size %zu, count_size: %zu\n", __func__,
-               sizeof(off_t), sizeof(size_t));
-
-       /* Reading the count param */
-       err = recv(sockfd, &count, sizeof(off_t), 0);
-       if (err != sizeof(off_t))
-               return -EINVAL;
-
-       curlen = count;
-
-       /* Reading the offset param */
-       err = recv(sockfd, &offset, sizeof(off_t), 0);
-       if (err != sizeof(off_t))
-               return -EINVAL;
-
-       /* Obtain target's CPP ID and offset in target */
-       cpp_id = (offset >> 40) << 8;
-       nfp_offset = offset & ((1ull << 40) - 1);
-
-       PMD_CPP_LOG(DEBUG, "%s: count %zu and offset %jd\n", __func__, count,
-                          offset);
-       PMD_CPP_LOG(DEBUG, "%s: cpp_id %08x and nfp_offset %jd\n", __func__,
-                          cpp_id, nfp_offset);
-
-       /* Adjust length if not aligned */
-       if (((nfp_offset + (off_t)count - 1) & ~(NFP_CPP_MEMIO_BOUNDARY - 1)) !=
-           (nfp_offset & ~(NFP_CPP_MEMIO_BOUNDARY - 1))) {
-               curlen = NFP_CPP_MEMIO_BOUNDARY -
-                       (nfp_offset & (NFP_CPP_MEMIO_BOUNDARY - 1));
-       }
-
-       while (count > 0) {
-               area = nfp_cpp_area_alloc_with_name(cpp, cpp_id, "nfp.cdev",
-                                                   nfp_offset, curlen);
-               if (!area) {
-                       RTE_LOG(ERR, PMD, "%s: area alloc failed\n", __func__);
-                       return -EIO;
-               }
-
-               err = nfp_cpp_area_acquire(area);
-               if (err < 0) {
-                       RTE_LOG(ERR, PMD, "area acquire failed\n");
-                       nfp_cpp_area_free(area);
-                       return -EIO;
-               }
-
-               for (pos = 0; pos < curlen; pos += len) {
-                       len = curlen - pos;
-                       if (len > sizeof(tmpbuf))
-                               len = sizeof(tmpbuf);
-
-                       err = nfp_cpp_area_read(area, pos, tmpbuf, len);
-                       if (err < 0) {
-                               RTE_LOG(ERR, PMD, "nfp_cpp_area_read error\n");
-                               nfp_cpp_area_release(area);
-                               nfp_cpp_area_free(area);
-                               return -EIO;
-                       }
-                       PMD_CPP_LOG(DEBUG, "%s: sending %u of %zu\n", __func__,
-                                          len, count);
-
-                       err = send(sockfd, tmpbuf, len, 0);
-                       if (err != (int)len) {
-                               RTE_LOG(ERR, PMD,
-                                       "%s: error when sending: %d of %zu\n",
-                                       __func__, err, count);
-                               nfp_cpp_area_release(area);
-                               nfp_cpp_area_free(area);
-                               return -EIO;
-                       }
-               }
-
-               nfp_offset += pos;
-               totlen += pos;
-               nfp_cpp_area_release(area);
-               nfp_cpp_area_free(area);
-
-               count -= pos;
-               curlen = (count > NFP_CPP_MEMIO_BOUNDARY) ?
-                       NFP_CPP_MEMIO_BOUNDARY : count;
-       }
-       return 0;
-}
-
-#define NFP_IOCTL 'n'
-#define NFP_IOCTL_CPP_IDENTIFICATION _IOW(NFP_IOCTL, 0x8f, uint32_t)
-/*
- * Serving a ioctl command from host NFP tools. This usually goes to
- * a kernel driver char driver but it is not available when the PF is
- * bound to the PMD. Currently just one ioctl command is served and it
- * does not require any CPP access at all.
- */
-static int
-nfp_cpp_bridge_serve_ioctl(int sockfd, struct nfp_cpp *cpp)
-{
-       uint32_t cmd, ident_size, tmp;
-       int err;
-
-       /* Reading now the IOCTL command */
-       err = recv(sockfd, &cmd, 4, 0);
-       if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
-               return -EIO;
-       }
-
-       /* Only supporting NFP_IOCTL_CPP_IDENTIFICATION */
-       if (cmd != NFP_IOCTL_CPP_IDENTIFICATION) {
-               RTE_LOG(ERR, PMD, "%s: unknown cmd %d\n", __func__, cmd);
-               return -EINVAL;
-       }
-
-       err = recv(sockfd, &ident_size, 4, 0);
-       if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: read error from socket\n", __func__);
-               return -EIO;
-       }
-
-       tmp = nfp_cpp_model(cpp);
-
-       PMD_CPP_LOG(DEBUG, "%s: sending NFP model %08x\n", __func__, tmp);
-
-       err = send(sockfd, &tmp, 4, 0);
-       if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
-               return -EIO;
-       }
-
-       tmp = cpp->interface;
-
-       PMD_CPP_LOG(DEBUG, "%s: sending NFP interface %08x\n", __func__, tmp);
-
-       err = send(sockfd, &tmp, 4, 0);
-       if (err != 4) {
-               RTE_LOG(ERR, PMD, "%s: error writing to socket\n", __func__);
-               return -EIO;
-       }
-
-       return 0;
-}
-
-#define NFP_BRIDGE_OP_READ     20
-#define NFP_BRIDGE_OP_WRITE    30
-#define NFP_BRIDGE_OP_IOCTL    40
-
-/*
- * This is the code to be executed by a service core. The CPP bridge interface
- * is based on a unix socket and requests usually received by a kernel char
- * driver, read, write and ioctl, are handled by the CPP bridge. NFP host tools
- * can be executed with a wrapper library and LD_LIBRARY being completely
- * unaware of the CPP bridge performing the NFP kernel char driver for CPP
- * accesses.
- */
-static int32_t
-nfp_cpp_bridge_service_func(void *args)
-{
-       struct sockaddr address;
-       struct nfp_cpp *cpp = args;
-       int sockfd, datafd, op, ret;
-
-       unlink("/tmp/nfp_cpp");
-       sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
-       if (sockfd < 0) {
-               RTE_LOG(ERR, PMD, "%s: socket creation error. Service failed\n",
-                       __func__);
-               return -EIO;
-       }
-
-       memset(&address, 0, sizeof(struct sockaddr));
-
-       address.sa_family = AF_UNIX;
-       strcpy(address.sa_data, "/tmp/nfp_cpp");
-
-       ret = bind(sockfd, (const struct sockaddr *)&address,
-                  sizeof(struct sockaddr));
-       if (ret < 0) {
-               RTE_LOG(ERR, PMD, "%s: bind error (%d). Service failed\n",
-                                 __func__, errno);
-               close(sockfd);
-               return ret;
-       }
-
-       ret = listen(sockfd, 20);
-       if (ret < 0) {
-               RTE_LOG(ERR, PMD, "%s: listen error(%d). Service failed\n",
-                                 __func__, errno);
-               close(sockfd);
-               return ret;
-       }
-
-       for (;;) {
-               datafd = accept(sockfd, NULL, NULL);
-               if (datafd < 0) {
-                       RTE_LOG(ERR, PMD, "%s: accept call error (%d)\n",
-                                         __func__, errno);
-                       RTE_LOG(ERR, PMD, "%s: service failed\n", __func__);
-                       close(sockfd);
-                       return -EIO;
-               }
-
-               while (1) {
-                       ret = recv(datafd, &op, 4, 0);
-                       if (ret <= 0) {
-                               PMD_CPP_LOG(DEBUG, "%s: socket close\n",
-                                                  __func__);
-                               break;
-                       }
-
-                       PMD_CPP_LOG(DEBUG, "%s: getting op %u\n", __func__, op);
-
-                       if (op == NFP_BRIDGE_OP_READ)
-                               nfp_cpp_bridge_serve_read(datafd, cpp);
-
-                       if (op == NFP_BRIDGE_OP_WRITE)
-                               nfp_cpp_bridge_serve_write(datafd, cpp);
-
-                       if (op == NFP_BRIDGE_OP_IOCTL)
-                               nfp_cpp_bridge_serve_ioctl(datafd, cpp);
-
-                       if (op == 0)
-                               break;
-               }
-               close(datafd);
-       }
-       close(sockfd);
-
-       return 0;
-}
-
 #define DEFAULT_FW_PATH       "/lib/firmware/netronome"
 
 static int
@@ -2459,23 +2075,6 @@ error:
        return ret;
 }
 
-static void nfp_register_cpp_service(struct nfp_cpp *cpp)
-{
-       uint32_t *cpp_service_id = NULL;
-       struct rte_service_spec service;
-
-       memset(&service, 0, sizeof(struct rte_service_spec));
-       snprintf(service.name, sizeof(service.name), "nfp_cpp_service");
-       service.callback = nfp_cpp_bridge_service_func;
-       service.callback_userdata = (void *)cpp;
-
-       if (rte_service_component_register(&service,
-                                          cpp_service_id))
-               RTE_LOG(WARNING, PMD, "NFP CPP bridge service register() failed");
-       else
-               RTE_LOG(DEBUG, PMD, "NFP CPP bridge service registered");
-}
-
 static int nfp_pf_init(struct rte_pci_device *pci_dev)
 {
        struct nfp_pf_dev *pf_dev = NULL;
@@ -2725,16 +2324,6 @@ static const struct rte_pci_id pci_id_nfp_pf_net_map[] = {
        },
 };
 
-static const struct rte_pci_id pci_id_nfp_vf_net_map[] = {
-       {
-               RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,
-                              PCI_DEVICE_ID_NFP6000_VF_NIC)
-       },
-       {
-               .vendor_id = 0,
-       },
-};
-
 static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)
 {
        struct rte_pci_device *pci_dev;
@@ -2758,13 +2347,6 @@ static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)
        return nfp_net_close(eth_dev);
 }
 
-static int eth_nfp_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
-       struct rte_pci_device *pci_dev)
-{
-       return rte_eth_dev_pci_generic_probe(pci_dev,
-               sizeof(struct nfp_net_adapter), nfp_net_init);
-}
-
 static int eth_nfp_pci_remove(struct rte_pci_device *pci_dev)
 {
        return rte_eth_dev_pci_generic_remove(pci_dev, nfp_pci_uninit);
@@ -2777,19 +2359,9 @@ static struct rte_pci_driver rte_nfp_net_pf_pmd = {
        .remove = eth_nfp_pci_remove,
 };
 
-static struct rte_pci_driver rte_nfp_net_vf_pmd = {
-       .id_table = pci_id_nfp_vf_net_map,
-       .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
-       .probe = eth_nfp_pci_probe,
-       .remove = eth_nfp_pci_remove,
-};
-
 RTE_PMD_REGISTER_PCI(net_nfp_pf, rte_nfp_net_pf_pmd);
-RTE_PMD_REGISTER_PCI(net_nfp_vf, rte_nfp_net_vf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_nfp_pf, pci_id_nfp_pf_net_map);
-RTE_PMD_REGISTER_PCI_TABLE(net_nfp_vf, pci_id_nfp_vf_net_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_nfp_pf, "* igb_uio | uio_pci_generic | vfio");
-RTE_PMD_REGISTER_KMOD_DEP(net_nfp_vf, "* igb_uio | uio_pci_generic | vfio");
 RTE_LOG_REGISTER_SUFFIX(nfp_logtype_init, init, NOTICE);
 RTE_LOG_REGISTER_SUFFIX(nfp_logtype_driver, driver, NOTICE);
 /*