On Mon, 29 Jun 2020 02:34:18 -0400 Michael Chan wrote:
> +     bp->rss_indir_tbl_entries = entries;
> +     bp->rss_indir_tbl = kcalloc(entries, sizeof(*bp->rss_indir_tbl),
> +                                 GFP_KERNEL);

nit: kmalloc_array() ? I think you init all elements below.

> +     if (!bp->rss_indir_tbl)
> +             return -ENOMEM;
> +     return 0;
> +}
> +
> +static void bnxt_set_dflt_rss_indir_tbl(struct bnxt *bp)
> +{
> +     u16 max_rings, max_entries, pad, i;
> +
> +     if (!bp->rx_nr_rings)
> +             return;
> +
> +     if (BNXT_CHIP_TYPE_NITRO_A0(bp))
> +             max_rings = bp->rx_nr_rings - 1;
> +     else
> +             max_rings = bp->rx_nr_rings;
> +
> +     if (bp->flags & BNXT_FLAG_CHIP_P5)
> +             max_entries = (max_rings + BNXT_RSS_TABLE_ENTRIES_P5 - 1) &
> +                           ~(BNXT_RSS_TABLE_ENTRIES_P5 - 1);
> +     else
> +             max_entries = HW_HASH_INDEX_SIZE;
> +
> +     for (i = 0; i < max_entries; i++)
> +             bp->rss_indir_tbl[i] = i % max_rings;

nit: ethtool_rxfh_indir_default()

> +     pad = bp->rss_indir_tbl_entries - max_entries;
> +     if (pad)
> +             memset(&bp->rss_indir_tbl[i], 0, pad * sizeof(u16));

Reply via email to