net/fm10k/base: clean up the logic
Clean up the logic in fm10k_tlv_attr_parse, we should not reply on that FM10K_NOT_IMPLEMENTED is greater than zero, as this can easily cause confusion. The patch also correct a minor document error. Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
parent
0de9c88abb
commit
890fc30fbf
@ -520,7 +520,8 @@ STATIC s32 fm10k_tlv_attr_validate(u32 *attr,
|
||||
* up into an array of pointers stored in results. The function will
|
||||
* return FM10K_ERR_PARAM on any input or message error,
|
||||
* FM10K_NOT_IMPLEMENTED for any attribute that is outside of the array
|
||||
* and 0 on success.
|
||||
* and 0 on success. Any attributes not found in tlv_attr will be silently
|
||||
* ignored.
|
||||
**/
|
||||
static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
|
||||
const struct fm10k_tlv_attr *tlv_attr)
|
||||
@ -559,14 +560,15 @@ static s32 fm10k_tlv_attr_parse(u32 *attr, u32 **results,
|
||||
while (offset < len) {
|
||||
attr_id = *attr & FM10K_TLV_ID_MASK;
|
||||
|
||||
if (attr_id < FM10K_TLV_RESULTS_MAX)
|
||||
err = fm10k_tlv_attr_validate(attr, tlv_attr);
|
||||
else
|
||||
err = FM10K_NOT_IMPLEMENTED;
|
||||
if (attr_id >= FM10K_TLV_RESULTS_MAX)
|
||||
return FM10K_NOT_IMPLEMENTED;
|
||||
|
||||
if (err < 0)
|
||||
err = fm10k_tlv_attr_validate(attr, tlv_attr);
|
||||
if (err == FM10K_NOT_IMPLEMENTED)
|
||||
; /* silently ignore non-implemented attributes */
|
||||
else if (err)
|
||||
return err;
|
||||
if (!err)
|
||||
else
|
||||
results[attr_id] = attr;
|
||||
|
||||
/* update offset */
|
||||
|
Loading…
Reference in New Issue
Block a user