Commit 9571d987 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

nfp: add offset to all TLV parsing errors

When troubleshooting incorrect FW capabilities it's useful to know
where the faulty TLV is located.  Add offset to all errors messages.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: default avatarDirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 51a6588e
...@@ -41,8 +41,8 @@ int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem, ...@@ -41,8 +41,8 @@ int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem,
data += 4; data += 4;
if (length % NFP_NET_CFG_TLV_LENGTH_INC) { if (length % NFP_NET_CFG_TLV_LENGTH_INC) {
dev_err(dev, "TLV size not multiple of %u len:%u\n", dev_err(dev, "TLV size not multiple of %u offset:%u len:%u\n",
NFP_NET_CFG_TLV_LENGTH_INC, length); NFP_NET_CFG_TLV_LENGTH_INC, offset, length);
return -EINVAL; return -EINVAL;
} }
if (data + length > end) { if (data + length > end) {
...@@ -61,14 +61,14 @@ int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem, ...@@ -61,14 +61,14 @@ int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem,
if (!length) if (!length)
return 0; return 0;
dev_err(dev, "END TLV should be empty, has len:%d\n", dev_err(dev, "END TLV should be empty, has offset:%u len:%d\n",
length); offset, length);
return -EINVAL; return -EINVAL;
case NFP_NET_CFG_TLV_TYPE_ME_FREQ: case NFP_NET_CFG_TLV_TYPE_ME_FREQ:
if (length != 4) { if (length != 4) {
dev_err(dev, dev_err(dev,
"ME FREQ TLV should be 4B, is %dB\n", "ME FREQ TLV should be 4B, is %dB offset:%u\n",
length); length, offset);
return -EINVAL; return -EINVAL;
} }
...@@ -92,8 +92,8 @@ int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem, ...@@ -92,8 +92,8 @@ int nfp_net_tlv_caps_parse(struct device *dev, u8 __iomem *ctrl_mem,
break; break;
case NFP_NET_CFG_TLV_TYPE_REPR_CAP: case NFP_NET_CFG_TLV_TYPE_REPR_CAP:
if (length < 4) { if (length < 4) {
dev_err(dev, "REPR CAP TLV short %dB < 4B\n", dev_err(dev, "REPR CAP TLV short %dB < 4B offset:%u\n",
length); length, offset);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment