net/dpaa: report error on using deferred start
[dpdk.git] / drivers / net / dpaa / dpaa_ethdev.c
index 3f805b2..ea178f4 100644 (file)
@@ -457,6 +457,73 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev,
        return 0;
 }
 
+static int
+dpaa_dev_rx_burst_mode_get(struct rte_eth_dev *dev,
+                       __rte_unused uint16_t queue_id,
+                       struct rte_eth_burst_mode *mode)
+{
+       struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
+       int ret = -EINVAL;
+       unsigned int i;
+       const struct burst_info {
+               uint64_t flags;
+               const char *output;
+       } rx_offload_map[] = {
+                       {DEV_RX_OFFLOAD_JUMBO_FRAME, " Jumbo frame,"},
+                       {DEV_RX_OFFLOAD_SCATTER, " Scattered,"},
+                       {DEV_RX_OFFLOAD_IPV4_CKSUM, " IPV4 csum,"},
+                       {DEV_RX_OFFLOAD_UDP_CKSUM, " UDP csum,"},
+                       {DEV_RX_OFFLOAD_TCP_CKSUM, " TCP csum,"},
+                       {DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM, " Outer IPV4 csum,"},
+                       {DEV_RX_OFFLOAD_RSS_HASH, " RSS,"}
+       };
+
+       /* Update Rx offload info */
+       for (i = 0; i < RTE_DIM(rx_offload_map); i++) {
+               if (eth_conf->rxmode.offloads & rx_offload_map[i].flags) {
+                       snprintf(mode->info, sizeof(mode->info), "%s",
+                               rx_offload_map[i].output);
+                       ret = 0;
+                       break;
+               }
+       }
+       return ret;
+}
+
+static int
+dpaa_dev_tx_burst_mode_get(struct rte_eth_dev *dev,
+                       __rte_unused uint16_t queue_id,
+                       struct rte_eth_burst_mode *mode)
+{
+       struct rte_eth_conf *eth_conf = &dev->data->dev_conf;
+       int ret = -EINVAL;
+       unsigned int i;
+       const struct burst_info {
+               uint64_t flags;
+               const char *output;
+       } tx_offload_map[] = {
+                       {DEV_TX_OFFLOAD_MT_LOCKFREE, " MT lockfree,"},
+                       {DEV_TX_OFFLOAD_MBUF_FAST_FREE, " MBUF free disable,"},
+                       {DEV_TX_OFFLOAD_IPV4_CKSUM, " IPV4 csum,"},
+                       {DEV_TX_OFFLOAD_UDP_CKSUM, " UDP csum,"},
+                       {DEV_TX_OFFLOAD_TCP_CKSUM, " TCP csum,"},
+                       {DEV_TX_OFFLOAD_SCTP_CKSUM, " SCTP csum,"},
+                       {DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, " Outer IPV4 csum,"},
+                       {DEV_TX_OFFLOAD_MULTI_SEGS, " Scattered,"}
+       };
+
+       /* Update Tx offload info */
+       for (i = 0; i < RTE_DIM(tx_offload_map); i++) {
+               if (eth_conf->txmode.offloads & tx_offload_map[i].flags) {
+                       snprintf(mode->info, sizeof(mode->info), "%s",
+                               tx_offload_map[i].output);
+                       ret = 0;
+                       break;
+               }
+       }
+       return ret;
+}
+
 static int dpaa_eth_link_update(struct rte_eth_dev *dev,
                                int wait_to_complete __rte_unused)
 {
@@ -478,18 +545,15 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev,
                DPAA_PMD_ERR("invalid link_speed: %s, %d",
                             dpaa_intf->name, fif->mac_type);
 
-       ret = dpaa_get_link_status(__fif->node_name);
-       if (ret < 0) {
-               if (ret == -EINVAL) {
-                       DPAA_PMD_DEBUG("Using default link status-No Support");
-                       ret = 1;
-               } else {
-                       DPAA_PMD_ERR("rte_dpaa_get_link_status %d", ret);
+       if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
+               ret = dpaa_get_link_status(__fif->node_name);
+               if (ret < 0)
                        return ret;
-               }
+               link->link_status = ret;
+       } else {
+               link->link_status = dpaa_intf->valid;
        }
 
-       link->link_status = ret;
        link->link_duplex = ETH_LINK_FULL_DUPLEX;
        link->link_autoneg = ETH_LINK_AUTONEG;
 
@@ -659,7 +723,7 @@ static
 int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                            uint16_t nb_desc,
                            unsigned int socket_id __rte_unused,
-                           const struct rte_eth_rxconf *rx_conf __rte_unused,
+                           const struct rte_eth_rxconf *rx_conf,
                            struct rte_mempool *mp)
 {
        struct dpaa_if *dpaa_intf = dev->data->dev_private;
@@ -679,6 +743,12 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                return -rte_errno;
        }
 
+       /* Rx deferred start is not supported */
+       if (rx_conf->rx_deferred_start) {
+               DPAA_PMD_ERR("%p:Rx deferred start not supported", (void *)dev);
+               return -EINVAL;
+       }
+
        DPAA_PMD_INFO("Rx queue setup for queue index: %d fq_id (0x%x)",
                        queue_idx, rxq->fqid);
 
@@ -942,12 +1012,17 @@ static
 int dpaa_eth_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                            uint16_t nb_desc __rte_unused,
                unsigned int socket_id __rte_unused,
-               const struct rte_eth_txconf *tx_conf __rte_unused)
+               const struct rte_eth_txconf *tx_conf)
 {
        struct dpaa_if *dpaa_intf = dev->data->dev_private;
 
        PMD_INIT_FUNC_TRACE();
 
+       /* Tx deferred start is not supported */
+       if (tx_conf->tx_deferred_start) {
+               DPAA_PMD_ERR("%p:Tx deferred start not supported", (void *)dev);
+               return -EINVAL;
+       }
        if (queue_idx >= dev->data->nb_tx_queues) {
                rte_errno = EOVERFLOW;
                DPAA_PMD_ERR("%p: queue index out of range (%u >= %u)",
@@ -985,17 +1060,33 @@ dpaa_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 
 static int dpaa_link_down(struct rte_eth_dev *dev)
 {
+       struct fman_if *fif = dev->process_private;
+       struct __fman_if *__fif;
+
        PMD_INIT_FUNC_TRACE();
 
-       dpaa_eth_dev_stop(dev);
+       __fif = container_of(fif, struct __fman_if, __if);
+
+       if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
+               dpaa_update_link_status(__fif->node_name, ETH_LINK_DOWN);
+       else
+               dpaa_eth_dev_stop(dev);
        return 0;
 }
 
 static int dpaa_link_up(struct rte_eth_dev *dev)
 {
+       struct fman_if *fif = dev->process_private;
+       struct __fman_if *__fif;
+
        PMD_INIT_FUNC_TRACE();
 
-       dpaa_eth_dev_start(dev);
+       __fif = container_of(fif, struct __fman_if, __if);
+
+       if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC)
+               dpaa_update_link_status(__fif->node_name, ETH_LINK_UP);
+       else
+               dpaa_eth_dev_start(dev);
        return 0;
 }
 
@@ -1169,7 +1260,8 @@ static struct eth_dev_ops dpaa_devops = {
        .rx_queue_release         = dpaa_eth_rx_queue_release,
        .tx_queue_release         = dpaa_eth_tx_queue_release,
        .rx_queue_count           = dpaa_dev_rx_queue_count,
-
+       .rx_burst_mode_get        = dpaa_dev_rx_burst_mode_get,
+       .tx_burst_mode_get        = dpaa_dev_tx_burst_mode_get,
        .flow_ctrl_get            = dpaa_flow_ctrl_get,
        .flow_ctrl_set            = dpaa_flow_ctrl_set,