On Sun, 14 Jun 2026 17:23:07 +0800
[email protected] wrote:
> From: Jie Liu <[email protected]>
>
> Implement dev_supported_ptypes_get ethdev callback for sxe2 PMD.
> This allows applications to query the packet types the driver
> is capable of identifying, such as L2, L3 (IPv4/IPv6), and
> L4 (TCP/UDP/SCTP) layers.
>
> Signed-off-by: Jie Liu <[email protected]>
> ---
This patch has lots of other changes like link state.
> +static inline const uint32_t *
> +sxe2_dev_supported_ptypes_get(struct rte_eth_dev *dev, size_t
> *no_of_elements)
> +{
> + const uint32_t *ret = NULL;
> +
> + static const uint32_t ptypes[] = {
> + RTE_PTYPE_L2_ETHER,
> + RTE_PTYPE_L2_ETHER_TIMESYNC,
> + RTE_PTYPE_L2_ETHER_LLDP,
> + RTE_PTYPE_L2_ETHER_ARP,
> + RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
Why an inline for something in control path which then has to be a function
since it used as ethdev op.
> static inline void sxe2_init_ptype_list(uint32_t *ptype)
> +{
> + /* ptype[0] reserved */
> + ptype[1] = RTE_PTYPE_L2_ETHER;
> + ptype[2] = RTE_PTYPE_L2_ETHER_TIMESYNC;
> + /* ptype[3] - ptype[5] reserved */
> + ptype[6] = RTE_PTYPE_L2_ETHER_LLDP;
> + /* ECP */
> + ptype[7] = RTE_PTYPE_UNKNOWN;
> + /* ptype[8] - ptype[9] reserved */
> + /* EAPol */
> + ptype[10] = RTE_PTYPE_UNKNOWN;
> + ptype[11] = RTE_PTYPE_L2_ETHER_ARP;
> + /* ptype[12] - ptype[21] reserved */
> +
Why are you building the whole table at runtime? It could just be
one constant table setup at build time.
> +int32_t sxe2_mtu_set(struct rte_eth_dev *dev, uint16_t mtu __rte_unused)
> +{
> + int32_t ret = -1;
> + struct sxe2_adapter *adapter = SXE2_DEV_PRIVATE_TO_ADAPTER(dev);
> +
> + PMD_INIT_FUNC_TRACE();
> +
> + if (dev->data->dev_started != 0) {
> + PMD_DEV_LOG_ERR(adapter, DRV, "port %d must be stopped before
> configuration",
> + dev->data->port_id);
> + ret = -1;
> + goto l_end;
Just return and skip the variable ret and goto.
A good return code would be -EBUSY.
> + }
> +
> + ret = 0;
> +
> +l_end:
> + return ret;
> +}