net/octeontx2: support Tx
[dpdk.git] / lib / librte_ethdev / rte_ethdev.c
index 72bb338..6419173 100644 (file)
@@ -601,7 +601,7 @@ rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id)
        return port_id;
 }
 
-int __rte_experimental
+int
 rte_eth_dev_owner_new(uint64_t *owner_id)
 {
        rte_eth_dev_shared_data_prepare();
@@ -654,7 +654,7 @@ _rte_eth_dev_owner_set(const uint16_t port_id, const uint64_t old_owner_id,
        return 0;
 }
 
-int __rte_experimental
+int
 rte_eth_dev_owner_set(const uint16_t port_id,
                      const struct rte_eth_dev_owner *owner)
 {
@@ -670,7 +670,7 @@ rte_eth_dev_owner_set(const uint16_t port_id,
        return ret;
 }
 
-int __rte_experimental
+int
 rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id)
 {
        const struct rte_eth_dev_owner new_owner = (struct rte_eth_dev_owner)
@@ -687,7 +687,7 @@ rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id)
        return ret;
 }
 
-void __rte_experimental
+void
 rte_eth_dev_owner_delete(const uint64_t owner_id)
 {
        uint16_t port_id;
@@ -713,7 +713,7 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)
        rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock);
 }
 
-int __rte_experimental
+int
 rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner)
 {
        int ret = 0;
@@ -1535,7 +1535,7 @@ rte_eth_dev_reset(uint16_t port_id)
        return eth_err(port_id, ret);
 }
 
-int __rte_experimental
+int
 rte_eth_dev_is_removed(uint16_t port_id)
 {
        struct rte_eth_dev *dev;
@@ -1579,6 +1579,11 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id,
                return -EINVAL;
        }
 
+       if (mp == NULL) {
+               RTE_ETHDEV_LOG(ERR, "Invalid null mempool pointer\n");
+               return -EINVAL;
+       }
+
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_infos_get, -ENOTSUP);
        RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_setup, -ENOTSUP);
 
@@ -2543,6 +2548,8 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
                .nb_max = UINT16_MAX,
                .nb_min = 0,
                .nb_align = 1,
+               .nb_seg_max = UINT16_MAX,
+               .nb_mtu_seg_max = UINT16_MAX,
        };
 
        RTE_ETH_VALID_PORTID_OR_RET(port_id);
@@ -2726,53 +2733,56 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
        int mask = 0;
        int cur, org = 0;
        uint64_t orig_offloads;
+       uint64_t *dev_offloads;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
        dev = &rte_eth_devices[port_id];
 
        /* save original values in case of failure */
        orig_offloads = dev->data->dev_conf.rxmode.offloads;
+       dev_offloads = &dev->data->dev_conf.rxmode.offloads;
 
        /*check which option changed by application*/
        cur = !!(offload_mask & ETH_VLAN_STRIP_OFFLOAD);
-       org = !!(dev->data->dev_conf.rxmode.offloads &
-                DEV_RX_OFFLOAD_VLAN_STRIP);
+       org = !!(*dev_offloads & DEV_RX_OFFLOAD_VLAN_STRIP);
        if (cur != org) {
                if (cur)
-                       dev->data->dev_conf.rxmode.offloads |=
-                               DEV_RX_OFFLOAD_VLAN_STRIP;
+                       *dev_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
                else
-                       dev->data->dev_conf.rxmode.offloads &=
-                               ~DEV_RX_OFFLOAD_VLAN_STRIP;
+                       *dev_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
                mask |= ETH_VLAN_STRIP_MASK;
        }
 
        cur = !!(offload_mask & ETH_VLAN_FILTER_OFFLOAD);
-       org = !!(dev->data->dev_conf.rxmode.offloads &
-                DEV_RX_OFFLOAD_VLAN_FILTER);
+       org = !!(*dev_offloads & DEV_RX_OFFLOAD_VLAN_FILTER);
        if (cur != org) {
                if (cur)
-                       dev->data->dev_conf.rxmode.offloads |=
-                               DEV_RX_OFFLOAD_VLAN_FILTER;
+                       *dev_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
                else
-                       dev->data->dev_conf.rxmode.offloads &=
-                               ~DEV_RX_OFFLOAD_VLAN_FILTER;
+                       *dev_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
                mask |= ETH_VLAN_FILTER_MASK;
        }
 
        cur = !!(offload_mask & ETH_VLAN_EXTEND_OFFLOAD);
-       org = !!(dev->data->dev_conf.rxmode.offloads &
-                DEV_RX_OFFLOAD_VLAN_EXTEND);
+       org = !!(*dev_offloads & DEV_RX_OFFLOAD_VLAN_EXTEND);
        if (cur != org) {
                if (cur)
-                       dev->data->dev_conf.rxmode.offloads |=
-                               DEV_RX_OFFLOAD_VLAN_EXTEND;
+                       *dev_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
                else
-                       dev->data->dev_conf.rxmode.offloads &=
-                               ~DEV_RX_OFFLOAD_VLAN_EXTEND;
+                       *dev_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
                mask |= ETH_VLAN_EXTEND_MASK;
        }
 
+       cur = !!(offload_mask & ETH_QINQ_STRIP_OFFLOAD);
+       org = !!(*dev_offloads & DEV_RX_OFFLOAD_QINQ_STRIP);
+       if (cur != org) {
+               if (cur)
+                       *dev_offloads |= DEV_RX_OFFLOAD_QINQ_STRIP;
+               else
+                       *dev_offloads &= ~DEV_RX_OFFLOAD_QINQ_STRIP;
+               mask |= ETH_QINQ_STRIP_MASK;
+       }
+
        /*no change*/
        if (mask == 0)
                return ret;
@@ -2781,7 +2791,7 @@ rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
        ret = (*dev->dev_ops->vlan_offload_set)(dev, mask);
        if (ret) {
                /* hit an error restore  original values */
-               dev->data->dev_conf.rxmode.offloads = orig_offloads;
+               *dev_offloads = orig_offloads;
        }
 
        return eth_err(port_id, ret);
@@ -2791,23 +2801,25 @@ int
 rte_eth_dev_get_vlan_offload(uint16_t port_id)
 {
        struct rte_eth_dev *dev;
+       uint64_t *dev_offloads;
        int ret = 0;
 
        RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
        dev = &rte_eth_devices[port_id];
+       dev_offloads = &dev->data->dev_conf.rxmode.offloads;
 
-       if (dev->data->dev_conf.rxmode.offloads &
-           DEV_RX_OFFLOAD_VLAN_STRIP)
+       if (*dev_offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
                ret |= ETH_VLAN_STRIP_OFFLOAD;
 
-       if (dev->data->dev_conf.rxmode.offloads &
-           DEV_RX_OFFLOAD_VLAN_FILTER)
+       if (*dev_offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
                ret |= ETH_VLAN_FILTER_OFFLOAD;
 
-       if (dev->data->dev_conf.rxmode.offloads &
-           DEV_RX_OFFLOAD_VLAN_EXTEND)
+       if (*dev_offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
                ret |= ETH_VLAN_EXTEND_OFFLOAD;
 
+       if (*dev_offloads & DEV_RX_OFFLOAD_QINQ_STRIP)
+               ret |= DEV_RX_OFFLOAD_QINQ_STRIP;
+
        return ret;
 }
 
@@ -3585,7 +3597,7 @@ rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data)
        return 0;
 }
 
-int __rte_experimental
+int
 rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id)
 {
        struct rte_intr_handle *intr_handle;
@@ -3647,7 +3659,7 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
                        RTE_MEMZONE_IOVA_CONTIG, align);
 }
 
-int __rte_experimental
+int
 rte_eth_dev_create(struct rte_device *device, const char *name,
        size_t priv_data_size,
        ethdev_bus_specific_init ethdev_bus_specific_init,
@@ -3710,7 +3722,7 @@ probe_failed:
        return retval;
 }
 
-int  __rte_experimental
+int
 rte_eth_dev_destroy(struct rte_eth_dev *ethdev,
        ethdev_uninit_t ethdev_uninit)
 {
@@ -4171,6 +4183,18 @@ rte_eth_timesync_write_time(uint16_t port_id, const struct timespec *timestamp)
                                                                timestamp));
 }
 
+int
+rte_eth_read_clock(uint16_t port_id, uint64_t *clock)
+{
+       struct rte_eth_dev *dev;
+
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+       dev = &rte_eth_devices[port_id];
+
+       RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->read_clock, -ENOTSUP);
+       return eth_err(port_id, (*dev->dev_ops->read_clock)(dev, clock));
+}
+
 int
 rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
 {
@@ -4219,7 +4243,7 @@ rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info)
        return eth_err(port_id, (*dev->dev_ops->set_eeprom)(dev, info));
 }
 
-int __rte_experimental
+int
 rte_eth_dev_get_module_info(uint16_t port_id,
                            struct rte_eth_dev_module_info *modinfo)
 {
@@ -4232,7 +4256,7 @@ rte_eth_dev_get_module_info(uint16_t port_id,
        return (*dev->dev_ops->get_module_info)(dev, modinfo);
 }
 
-int __rte_experimental
+int
 rte_eth_dev_get_module_eeprom(uint16_t port_id,
                              struct rte_dev_eeprom_info *info)
 {
@@ -4388,7 +4412,7 @@ static struct rte_eth_dev_switch {
        enum rte_eth_switch_domain_state state;
 } rte_eth_switch_domains[RTE_MAX_ETHPORTS];
 
-int __rte_experimental
+int
 rte_eth_switch_domain_alloc(uint16_t *domain_id)
 {
        unsigned int i;
@@ -4409,7 +4433,7 @@ rte_eth_switch_domain_alloc(uint16_t *domain_id)
        return -ENOSPC;
 }
 
-int __rte_experimental
+int
 rte_eth_switch_domain_free(uint16_t domain_id)
 {
        if (domain_id == RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID ||
@@ -4489,7 +4513,7 @@ rte_eth_devargs_tokenise(struct rte_kvargs *arglist, const char *str_in)
        }
 }
 
-int __rte_experimental
+int
 rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)
 {
        struct rte_kvargs args;