net/ice: support auxiliary IP offset Rx descriptor
[dpdk.git] / lib / librte_ethdev / rte_ethdev.c
index 5ff5204..f8d63c7 100644 (file)
@@ -160,6 +160,7 @@ static const struct {
        RTE_TX_OFFLOAD_BIT2STR(UDP_TNL_TSO),
        RTE_TX_OFFLOAD_BIT2STR(IP_TNL_TSO),
        RTE_TX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM),
+       RTE_TX_OFFLOAD_BIT2STR(SEND_ON_TIMESTAMP),
 };
 
 #undef RTE_TX_OFFLOAD_BIT2STR
@@ -4200,6 +4201,14 @@ rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id)
        return fd;
 }
 
+static inline int
+eth_dma_mzone_name(char *name, size_t len, uint16_t port_id, uint16_t queue_id,
+               const char *ring_name)
+{
+       return snprintf(name, len, "eth_p%d_q%d_%s",
+                       port_id, queue_id, ring_name);
+}
+
 const struct rte_memzone *
 rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
                         uint16_t queue_id, size_t size, unsigned align,
@@ -4209,8 +4218,8 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
        const struct rte_memzone *mz;
        int rc;
 
-       rc = snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s",
-                     dev->data->port_id, queue_id, ring_name);
+       rc = eth_dma_mzone_name(z_name, sizeof(z_name), dev->data->port_id,
+                       queue_id, ring_name);
        if (rc >= RTE_MEMZONE_NAMESIZE) {
                RTE_ETHDEV_LOG(ERR, "ring name too long\n");
                rte_errno = ENAMETOOLONG;
@@ -4235,6 +4244,30 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
                        RTE_MEMZONE_IOVA_CONTIG, align);
 }
 
+int
+rte_eth_dma_zone_free(const struct rte_eth_dev *dev, const char *ring_name,
+               uint16_t queue_id)
+{
+       char z_name[RTE_MEMZONE_NAMESIZE];
+       const struct rte_memzone *mz;
+       int rc = 0;
+
+       rc = eth_dma_mzone_name(z_name, sizeof(z_name), dev->data->port_id,
+                       queue_id, ring_name);
+       if (rc >= RTE_MEMZONE_NAMESIZE) {
+               RTE_ETHDEV_LOG(ERR, "ring name too long\n");
+               return -ENAMETOOLONG;
+       }
+
+       mz = rte_memzone_lookup(z_name);
+       if (mz)
+               rc = rte_memzone_free(mz);
+       else
+               rc = -ENOENT;
+
+       return rc;
+}
+
 int
 rte_eth_dev_create(struct rte_device *device, const char *name,
        size_t priv_data_size,
@@ -4637,6 +4670,14 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id,
                return -EINVAL;
        }
 
+       if (dev->data->rx_queues[queue_id] == NULL) {
+               RTE_ETHDEV_LOG(ERR,
+                              "Rx queue %"PRIu16" of device with port_id=%"
+                              PRIu16" has not been setup\n",
+                              queue_id, port_id);
+               return -EINVAL;
+       }
+
        if (rte_eth_dev_is_rx_hairpin_queue(dev, queue_id)) {
                RTE_ETHDEV_LOG(INFO,
                        "Can't get hairpin Rx queue %"PRIu16" info of device with port_id=%"PRIu16"\n",
@@ -4668,6 +4709,14 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id,
                return -EINVAL;
        }
 
+       if (dev->data->tx_queues[queue_id] == NULL) {
+               RTE_ETHDEV_LOG(ERR,
+                              "Tx queue %"PRIu16" of device with port_id=%"
+                              PRIu16" has not been setup\n",
+                              queue_id, port_id);
+               return -EINVAL;
+       }
+
        if (rte_eth_dev_is_tx_hairpin_queue(dev, queue_id)) {
                RTE_ETHDEV_LOG(INFO,
                        "Can't get hairpin Tx queue %"PRIu16" info of device with port_id=%"PRIu16"\n",