On Fri, 31 Jul 2020 13:58:35 +0100 Edward Cree wrote:
> +     default:
> +             /* Host interface says "Drivers should ignore design parameters
> +              * that they do not recognise."
> +              */
> +             netif_info(efx, probe, efx->net_dev,
> +                        "Ignoring unrecognised design parameter %u\n",
> +                        reader->type);

Is this really important enough to spam the logs with?

> +             return 0;
> +     }
> +}
> +
> +static int ef100_check_design_params(struct efx_nic *efx)
> +{
> +     struct ef100_tlv_state reader = {};
> +     u32 total_len, offset = 0;
> +     efx_dword_t reg;
> +     int rc = 0, i;
> +     u32 data;
> +
> +     efx_readd(efx, &reg, ER_GZ_PARAMS_TLV_LEN);
> +     total_len = EFX_DWORD_FIELD(reg, EFX_DWORD_0);
> +     netif_dbg(efx, probe, efx->net_dev, "%u bytes of design parameters\n",
> +               total_len);
> +     while (offset < total_len) {
> +             efx_readd(efx, &reg, ER_GZ_PARAMS_TLV + offset);
> +             data = EFX_DWORD_FIELD(reg, EFX_DWORD_0);
> +             for (i = 0; i < sizeof(data); i++) {
> +                     rc = ef100_tlv_feed(&reader, data);
> +                     /* Got a complete value? */
> +                     if (!rc && reader.state == EF100_TLV_TYPE)
> +                             rc = ef100_process_design_param(efx, &reader);
> +                     if (rc)
> +                             goto out;
> +                     data >>= 8;
> +                     offset++;
> +             }
> +     }

Should you warn if the TLV stream ends half-way through an entry?

> +out:
> +     return rc;
> +}

Reply via email to