[dpdk-dev] [PATCH v3 1/1] net/octeontx2: add Rx/Tx burst mode get callbacks

Jerin Jacob jerinjacobk at gmail.com
Fri Nov 8 18:28:51 CET 2019


On Wed, Nov 6, 2019 at 4:57 PM Sunil Kumar Kori <skori at marvell.com> wrote:
>
> Retrieve burst mode information according to the selected Rx/Tx mode and
> offloads.
>
> Signed-off-by: Sunil Kumar Kori <skori at marvell.com>
> ---
> v3:
>  - Rebased the patch over patches.dpdk.org/patch/62368/
> v2:
>  - Rebased the patch on latest commit.
>  - Update feature matrix for the support.
>
>  doc/guides/nics/features/octeontx2.ini  |  1 +
>  drivers/net/octeontx2/otx2_ethdev.c     |  2 +
>  drivers/net/octeontx2/otx2_ethdev.h     |  4 ++
>  drivers/net/octeontx2/otx2_ethdev_ops.c | 87 +++++++++++++++++++++++++
>  4 files changed, 94 insertions(+)
>

>
> +int
> +otx2_rx_burst_mode_get(struct rte_eth_dev *eth_dev,
> +                      __rte_unused uint16_t queue_id,
> +                      struct rte_eth_burst_mode *mode)
> +{
> +#define STRING_SIZE    1024

Use RTE_ETH_BURST_MODE_INFO_SIZE instead of hardcoded 1024

> +       struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
> +       char info[STRING_SIZE] = {'\0'};

No  need for intermediate "info", use rte_eth_burst_mode::info

> +       ssize_t bytes = 0;
> +
> +       if (dev->scalar_ena)
> +               bytes += rte_strscpy(info, "Scalar", 7);

Please avoid hardcoding of '7'.

        ssize_t sz = 0, rc;

        rc = rte_strscpy(mode->info + sz, "Scalar", STRING_SIZE - sz);
        if (rc < 0)
                goto done;
        sz += rc;

       rc = rte_strscpy(mode->info + sz, "Vector Neon", STRING_SIZE  - sz);
        if (rc < 0)
                goto done;
        sz += rc;


> +       else
> +               bytes += rte_strscpy(info, "Vector Neon", 12);
> +
> +       bytes += rte_strscpy(info + bytes, ", Rx Offloads:", 15);
> +
> +       if (dev->rx_offload_flags & NIX_RX_OFFLOAD_RSS_F)
> +               bytes += rte_strscpy(info + bytes, " RSS,", 6);
> +
> +       if (dev->rx_offload_flags & NIX_RX_OFFLOAD_PTYPE_F)
> +               bytes += rte_strscpy(info + bytes, " Ptype,", 8);


More information about the dev mailing list