> A new ethernet device op is added to give application control over
> the IP reassembly configuration. This operation is an optional
> call from the application, default values are set by PMD and
> exposed via rte_eth_dev_info.
> Application should always first retreive the capabilities from
> rte_eth_dev_info and then set the fields accordingly.
>
> Signed-off-by: Akhil Goyal <gak...@marvell.com>
> ---
> lib/ethdev/ethdev_driver.h | 19 +++++++++++++++++++
> lib/ethdev/rte_ethdev.c | 30 ++++++++++++++++++++++++++++++
> lib/ethdev/rte_ethdev.h | 28 ++++++++++++++++++++++++++++
> lib/ethdev/version.map | 3 +++
> 4 files changed, 80 insertions(+)
>
> diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h
> index d95605a355..0ed53c14f3 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -990,6 +990,22 @@ typedef int (*eth_representor_info_get_t)(struct
> rte_eth_dev *dev,
> typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev,
> uint64_t *features);
>
> +/**
> + * @internal
> + * Set configuration parameters for enabling IP reassembly offload in
> hardware.
> + *
> + * @param dev
> + * Port (ethdev) handle
> + *
> + * @param[in] conf
> + * Configuration parameters for IP reassembly.
> + *
> + * @return
> + * Negative errno value on error, zero otherwise
> + */
> +typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev,
> + struct rte_eth_ip_reass_params *conf);
> +
> /**
> * @internal A structure containing the functions exported by an Ethernet
> driver.
> */
> @@ -1186,6 +1202,9 @@ struct eth_dev_ops {
> * kinds of metadata to the PMD
> */
> eth_rx_metadata_negotiate_t rx_metadata_negotiate;
> +
> + /** Set IP reassembly configuration */
> + eth_ip_reassembly_conf_set_t ip_reassembly_conf_set;
> };
>
> /**
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index d9a03f12f9..ecc6c1fe37 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -6473,6 +6473,36 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id,
> uint64_t *features)
> (*dev->dev_ops->rx_metadata_negotiate)(dev, features));
> }
>
> +int
> +rte_eth_ip_reassembly_conf_set(uint16_t port_id,
> + struct rte_eth_ip_reass_params *conf)
> +{
> + struct rte_eth_dev *dev;
> +
> + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
> + dev = &rte_eth_devices[port_id];
Should we check here that device is properly configured, but not started yet?
Another question - if we have reassembly_conf_set() would it make sense to
have also reassembly_conf_get?
So user can retrieve current ip_reassembly config values?
> +
> + if ((dev->data->dev_conf.rxmode.offloads &
> + RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY) == 0) {
> + RTE_ETHDEV_LOG(ERR,
> + "The port (ID=%"PRIu16") is not configured for IP
> reassembly\n",
> + port_id);
> + return -EINVAL;
> + }
> +
> +
> + if (conf == NULL) {
> + RTE_ETHDEV_LOG(ERR,
> + "Invalid IP reassembly configuration (NULL)\n");
> + return -EINVAL;
> + }
> +
> + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_set,
> + -ENOTSUP);
> + return eth_err(port_id,
> + (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf));
> +}
> +
> RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO);
>
> RTE_INIT(ethdev_init_telemetry)