tile: fix build
[dpdk.git] / drivers / net / mpipe / mpipe_tilegx.c
index 1a77c7a..60d5f81 100644 (file)
 #include <unistd.h>
 
 #include <rte_eal.h>
-#include <rte_dev.h>
+#include <rte_vdev.h>
 #include <rte_eal_memconfig.h>
 #include <rte_ethdev.h>
 #include <rte_malloc.h>
 #include <rte_cycles.h>
 
-#include <arch/mpipe_xaui_def.h>
-#include <arch/mpipe_gbe_def.h>
-
 #include <gxio/mpipe.h>
 
+/* mPIPE GBE hardware register definitions. */
+#define MPIPE_GBE_NETWORK_CONFIGURATION 0x8008
+#define MPIPE_GBE_NETWORK_CONFIGURATION__COPY_ALL_SHIFT 4
+#define MPIPE_GBE_NETWORK_CONFIGURATION__MULTI_HASH_ENA_SHIFT 6
+#define MPIPE_GBE_NETWORK_CONFIGURATION__UNI_HASH_ENA_SHIFT 7
+
+/* mPIPE XAUI hardware register definitions. */
+#define MPIPE_XAUI_RECEIVE_CONFIGURATION 0x8020
+#define MPIPE_XAUI_RECEIVE_CONFIGURATION__COPY_ALL_SHIFT 0
+#define MPIPE_XAUI_RECEIVE_CONFIGURATION__ENA_HASH_MULTI_SHIFT 2
+#define MPIPE_XAUI_RECEIVE_CONFIGURATION__ENA_HASH_UNI_SHIFT 3
+
 #ifdef RTE_LIBRTE_MPIPE_PMD_DEBUG
 #define PMD_DEBUG_RX(...)      RTE_LOG(DEBUG, PMD, __VA_ARGS__)
 #define PMD_DEBUG_TX(...)      RTE_LOG(DEBUG, PMD, __VA_ARGS__)
@@ -87,7 +96,6 @@ struct mpipe_local {
 static __thread struct mpipe_local mpipe_local;
 static struct mpipe_context mpipe_contexts[GXIO_MPIPE_INSTANCE_MAX];
 static int mpipe_instances;
-static const char *drivername = "MPIPE PMD";
 
 /* Per queue statistics. */
 struct mpipe_queue_stats {
@@ -394,6 +402,8 @@ mpipe_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 
                speed = state & GXIO_MPIPE_LINK_SPEED_MASK;
 
+               new.link_autoneg = (dev->data->dev_conf.link_speeds &
+                               ETH_LINK_SPEED_AUTONEG);
                if (speed == GXIO_MPIPE_LINK_1G) {
                        new.link_speed = ETH_SPEED_NUM_1G;
                        new.link_duplex = ETH_LINK_FULL_DUPLEX;
@@ -514,7 +524,7 @@ mpipe_recv_fill_stack(struct mpipe_dev_priv *priv, int count)
        int i;
 
        for (i = 0; i < count; i++) {
-               mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
+               mbuf = rte_mbuf_raw_alloc(priv->rx_mpool);
                if (!mbuf)
                        break;
                mpipe_recv_push(priv, mbuf);
@@ -557,7 +567,7 @@ mpipe_register_segment(struct mpipe_dev_priv *priv, const struct rte_memseg *ms)
 {
        size_t size = ms->hugepage_sz;
        uint8_t *addr, *end;
-       int rc;
+       int rc = -EINVAL;
 
        for (addr = ms->addr, end = addr + ms->len; addr < end; addr += size) {
                rc = gxio_mpipe_register_page(priv->context, priv->stack, addr,
@@ -1450,7 +1460,7 @@ mpipe_do_recv(struct mpipe_rx_queue *rx_queue, struct rte_mbuf **rx_pkts,
                                        MPIPE_BUF_DEBT_THRESHOLD)
                                mpipe_local.mbuf_push_debt[in_port]++;
                        else {
-                               mbuf = __rte_mbuf_raw_alloc(priv->rx_mpool);
+                               mbuf = rte_mbuf_raw_alloc(priv->rx_mpool);
                                if (unlikely(!mbuf)) {
                                        nb_nomem++;
                                        gxio_mpipe_iqueue_drop(iqueue, idesc);
@@ -1547,7 +1557,7 @@ mpipe_link_mac(const char *ifname, uint8_t *mac)
 }
 
 static int
-rte_pmd_mpipe_devinit(const char *ifname,
+rte_pmd_mpipe_probe_common(struct rte_vdev_driver *drv, const char *ifname,
                      const char *params __rte_unused)
 {
        gxio_mpipe_context_t *context;
@@ -1585,7 +1595,7 @@ rte_pmd_mpipe_devinit(const char *ifname,
                return -ENODEV;
        }
 
-       eth_dev = rte_eth_dev_allocate(ifname, RTE_ETH_DEV_VIRTUAL);
+       eth_dev = rte_eth_dev_allocate(ifname);
        if (!eth_dev) {
                RTE_LOG(ERR, PMD, "%s: Failed to allocate device.\n", ifname);
                rte_free(priv);
@@ -1601,10 +1611,9 @@ rte_pmd_mpipe_devinit(const char *ifname,
        eth_dev->data->dev_private = priv;
        eth_dev->data->mac_addrs = &priv->mac_addr;
 
-       eth_dev->data->dev_flags = 0;
        eth_dev->data->kdrv = RTE_KDRV_NONE;
        eth_dev->driver = NULL;
-       eth_dev->data->drv_name = drivername;
+       eth_dev->data->drv_name = drv->driver.name;
        eth_dev->data->numa_node = instance;
 
        eth_dev->dev_ops      = &mpipe_dev_ops;
@@ -1621,20 +1630,33 @@ rte_pmd_mpipe_devinit(const char *ifname,
        return 0;
 }
 
-static struct rte_driver pmd_mpipe_xgbe_drv = {
-       .name = "xgbe",
-       .type = PMD_VDEV,
-       .init = rte_pmd_mpipe_devinit,
+static int rte_pmd_mpipe_xgbe_probe(const char *ifname, const char *params);
+static int rte_pmd_mpipe_gbe_probe(const char *ifname, const char *params);
+
+static struct rte_vdev_driver pmd_mpipe_xgbe_drv = {
+       .probe = rte_pmd_mpipe_xgbe_probe,
 };
 
-static struct rte_driver pmd_mpipe_gbe_drv = {
-       .name = "gbe",
-       .type = PMD_VDEV,
-       .init = rte_pmd_mpipe_devinit,
+static struct rte_vdev_driver pmd_mpipe_gbe_drv = {
+       .probe = rte_pmd_mpipe_gbe_probe,
 };
 
-PMD_REGISTER_DRIVER(pmd_mpipe_xgbe_drv);
-PMD_REGISTER_DRIVER(pmd_mpipe_gbe_drv);
+static int
+rte_pmd_mpipe_xgbe_probe(const char *ifname, const char *params __rte_unused)
+{
+       return rte_pmd_mpipe_probe_common(&pmd_mpipe_xgbe_drv, ifname, params);
+}
+
+static int
+rte_pmd_mpipe_gbe_probe(const char *ifname, const char *params __rte_unused)
+{
+       return rte_pmd_mpipe_probe_common(&pmd_mpipe_gbe_drv, ifname, params);
+}
+
+RTE_PMD_REGISTER_VDEV(net_mpipe_xgbe, pmd_mpipe_xgbe_drv);
+RTE_PMD_REGISTER_ALIAS(net_mpipe_xgbe, xgbe);
+RTE_PMD_REGISTER_VDEV(net_mpipe_gbe, pmd_mpipe_gbe_drv);
+RTE_PMD_REGISTER_ALIAS(net_mpipe_gbe, gbe);
 
 static void __attribute__((constructor, used))
 mpipe_init_contexts(void)