diff mbox series

[net,v2] net: wwan: Fix missing net device name for error message print

Message ID 20240426092444.825735-1-slark_xiao@163.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] net: wwan: Fix missing net device name for error message print | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 926 this patch: 926
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 48 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Slark Xiao April 26, 2024, 9:24 a.m. UTC
In my local, I got an error print in dmesg like below:
"sequence number glitch prev=487 curr=0"
After checking, it belongs to mhi_wwan_mbim.c. Refer to the usage
of this net_err_ratelimited() API in other files, I think we
should add net device name print before message context.

Fixes: aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")
Signed-off-by: Slark Xiao <slark_xiao@163.com>
Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
---
 drivers/net/wwan/mhi_wwan_mbim.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Jiri Pirko April 26, 2024, 11:33 a.m. UTC | #1
Fri, Apr 26, 2024 at 11:24:44AM CEST, slark_xiao@163.com wrote:
>In my local, I got an error print in dmesg like below:
>"sequence number glitch prev=487 curr=0"
>After checking, it belongs to mhi_wwan_mbim.c. Refer to the usage
>of this net_err_ratelimited() API in other files, I think we
>should add net device name print before message context.

You don't add dev device name, but rather constant string.

>
>Fixes: aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")
>Signed-off-by: Slark Xiao <slark_xiao@163.com>
>Reviewed-by: Hariprasad Kelam <hkelam@marvell.com>
>---
> drivers/net/wwan/mhi_wwan_mbim.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/net/wwan/mhi_wwan_mbim.c b/drivers/net/wwan/mhi_wwan_mbim.c
>index 3f72ae943b29..6cefee25efc4 100644
>--- a/drivers/net/wwan/mhi_wwan_mbim.c
>+++ b/drivers/net/wwan/mhi_wwan_mbim.c
>@@ -186,14 +186,14 @@ static int mbim_rx_verify_nth16(struct mhi_mbim_context *mbim, struct sk_buff *s
> 
> 	if (skb->len < sizeof(struct usb_cdc_ncm_nth16) +
> 			sizeof(struct usb_cdc_ncm_ndp16)) {
>-		net_err_ratelimited("frame too short\n");
>+		net_err_ratelimited("mbim: frame too short\n");

Does not make any sense. If you have multiple instances of mbim, you are
still clueless. You can access netdevice, print out the name as other
net_err_ratelimited() instances do. Btw, it would be more correct to use
netdev_err(), but there is no "ratelimited" variant of that. Perhaps
better to introduce it.

pw-bot: cr


> 		return -EINVAL;
> 	}
> 
> 	nth16 = (struct usb_cdc_ncm_nth16 *)skb->data;
> 
> 	if (nth16->dwSignature != cpu_to_le32(USB_CDC_NCM_NTH16_SIGN)) {
>-		net_err_ratelimited("invalid NTH16 signature <%#010x>\n",
>+		net_err_ratelimited("mbim: invalid NTH16 signature <%#010x>\n",
> 				    le32_to_cpu(nth16->dwSignature));
> 		return -EINVAL;
> 	}
>@@ -201,7 +201,7 @@ static int mbim_rx_verify_nth16(struct mhi_mbim_context *mbim, struct sk_buff *s
> 	/* No limit on the block length, except the size of the data pkt */
> 	len = le16_to_cpu(nth16->wBlockLength);
> 	if (len > skb->len) {
>-		net_err_ratelimited("NTB does not fit into the skb %u/%u\n",
>+		net_err_ratelimited("mbim: NTB does not fit into the skb %u/%u\n",
> 				    len, skb->len);
> 		return -EINVAL;
> 	}
>@@ -209,7 +209,7 @@ static int mbim_rx_verify_nth16(struct mhi_mbim_context *mbim, struct sk_buff *s
> 	if (mbim->rx_seq + 1 != le16_to_cpu(nth16->wSequence) &&
> 	    (mbim->rx_seq || le16_to_cpu(nth16->wSequence)) &&
> 	    !(mbim->rx_seq == 0xffff && !le16_to_cpu(nth16->wSequence))) {
>-		net_err_ratelimited("sequence number glitch prev=%d curr=%d\n",
>+		net_err_ratelimited("mbim: sequence number glitch prev=%d curr=%d\n",
> 				    mbim->rx_seq, le16_to_cpu(nth16->wSequence));
> 	}
> 	mbim->rx_seq = le16_to_cpu(nth16->wSequence);
>@@ -222,7 +222,7 @@ static int mbim_rx_verify_ndp16(struct sk_buff *skb, struct usb_cdc_ncm_ndp16 *n
> 	int ret;
> 
> 	if (le16_to_cpu(ndp16->wLength) < USB_CDC_NCM_NDP16_LENGTH_MIN) {
>-		net_err_ratelimited("invalid DPT16 length <%u>\n",
>+		net_err_ratelimited("mbim: invalid DPT16 length <%u>\n",
> 				    le16_to_cpu(ndp16->wLength));
> 		return -EINVAL;
> 	}
>@@ -233,7 +233,7 @@ static int mbim_rx_verify_ndp16(struct sk_buff *skb, struct usb_cdc_ncm_ndp16 *n
> 
> 	if (sizeof(struct usb_cdc_ncm_ndp16) +
> 	     ret * sizeof(struct usb_cdc_ncm_dpe16) > skb->len) {
>-		net_err_ratelimited("Invalid nframes = %d\n", ret);
>+		net_err_ratelimited("mbim: Invalid nframes = %d\n", ret);
> 		return -EINVAL;
> 	}
> 
>-- 
>2.25.1
>
>
Loic Poulain April 26, 2024, 12:04 p.m. UTC | #2
Hello,

On Fri, 26 Apr 2024 at 11:25, Slark Xiao <slark_xiao@163.com> wrote:
>
> In my local, I got an error print in dmesg like below:
> "sequence number glitch prev=487 curr=0"
> After checking, it belongs to mhi_wwan_mbim.c. Refer to the usage
> of this net_err_ratelimited() API in other files, I think we
> should add net device name print before message context.
>
> Fixes: aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")

This is more a cosmetic change than a bugfix, you should target net-next IMO.
Also as said in another feedback, the commit message does not match the change,
since you're not printing the device name.
Slark Xiao April 27, 2024, 5:57 a.m. UTC | #3
At 2024-04-26 20:04:39, "Loic Poulain" <loic.poulain@linaro.org> wrote:
>Hello,
>
>On Fri, 26 Apr 2024 at 11:25, Slark Xiao <slark_xiao@163.com> wrote:
>>
>> In my local, I got an error print in dmesg like below:
>> "sequence number glitch prev=487 curr=0"
>> After checking, it belongs to mhi_wwan_mbim.c. Refer to the usage
>> of this net_err_ratelimited() API in other files, I think we
>> should add net device name print before message context.
>>
>> Fixes: aa730a9905b7 ("net: wwan: Add MHI MBIM network driver")
>
>This is more a cosmetic change than a bugfix, you should target net-next IMO.
>Also as said in another feedback, the commit message does not match the change,
>since you're not printing the device name.
Agree. But in some functions, we can't call the net device name directory from the
parameters of this function, such as mbim_rx_verify_ndp16(). There is no *mbim or
*ndev or *mhi_dev.
diff mbox series

Patch

diff --git a/drivers/net/wwan/mhi_wwan_mbim.c b/drivers/net/wwan/mhi_wwan_mbim.c
index 3f72ae943b29..6cefee25efc4 100644
--- a/drivers/net/wwan/mhi_wwan_mbim.c
+++ b/drivers/net/wwan/mhi_wwan_mbim.c
@@ -186,14 +186,14 @@  static int mbim_rx_verify_nth16(struct mhi_mbim_context *mbim, struct sk_buff *s
 
 	if (skb->len < sizeof(struct usb_cdc_ncm_nth16) +
 			sizeof(struct usb_cdc_ncm_ndp16)) {
-		net_err_ratelimited("frame too short\n");
+		net_err_ratelimited("mbim: frame too short\n");
 		return -EINVAL;
 	}
 
 	nth16 = (struct usb_cdc_ncm_nth16 *)skb->data;
 
 	if (nth16->dwSignature != cpu_to_le32(USB_CDC_NCM_NTH16_SIGN)) {
-		net_err_ratelimited("invalid NTH16 signature <%#010x>\n",
+		net_err_ratelimited("mbim: invalid NTH16 signature <%#010x>\n",
 				    le32_to_cpu(nth16->dwSignature));
 		return -EINVAL;
 	}
@@ -201,7 +201,7 @@  static int mbim_rx_verify_nth16(struct mhi_mbim_context *mbim, struct sk_buff *s
 	/* No limit on the block length, except the size of the data pkt */
 	len = le16_to_cpu(nth16->wBlockLength);
 	if (len > skb->len) {
-		net_err_ratelimited("NTB does not fit into the skb %u/%u\n",
+		net_err_ratelimited("mbim: NTB does not fit into the skb %u/%u\n",
 				    len, skb->len);
 		return -EINVAL;
 	}
@@ -209,7 +209,7 @@  static int mbim_rx_verify_nth16(struct mhi_mbim_context *mbim, struct sk_buff *s
 	if (mbim->rx_seq + 1 != le16_to_cpu(nth16->wSequence) &&
 	    (mbim->rx_seq || le16_to_cpu(nth16->wSequence)) &&
 	    !(mbim->rx_seq == 0xffff && !le16_to_cpu(nth16->wSequence))) {
-		net_err_ratelimited("sequence number glitch prev=%d curr=%d\n",
+		net_err_ratelimited("mbim: sequence number glitch prev=%d curr=%d\n",
 				    mbim->rx_seq, le16_to_cpu(nth16->wSequence));
 	}
 	mbim->rx_seq = le16_to_cpu(nth16->wSequence);
@@ -222,7 +222,7 @@  static int mbim_rx_verify_ndp16(struct sk_buff *skb, struct usb_cdc_ncm_ndp16 *n
 	int ret;
 
 	if (le16_to_cpu(ndp16->wLength) < USB_CDC_NCM_NDP16_LENGTH_MIN) {
-		net_err_ratelimited("invalid DPT16 length <%u>\n",
+		net_err_ratelimited("mbim: invalid DPT16 length <%u>\n",
 				    le16_to_cpu(ndp16->wLength));
 		return -EINVAL;
 	}
@@ -233,7 +233,7 @@  static int mbim_rx_verify_ndp16(struct sk_buff *skb, struct usb_cdc_ncm_ndp16 *n
 
 	if (sizeof(struct usb_cdc_ncm_ndp16) +
 	     ret * sizeof(struct usb_cdc_ncm_dpe16) > skb->len) {
-		net_err_ratelimited("Invalid nframes = %d\n", ret);
+		net_err_ratelimited("mbim: Invalid nframes = %d\n", ret);
 		return -EINVAL;
 	}