public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Subash Abhinov Kasiviswanathan <subashab@codeaurora•org>
To: davem@davemloft•net, netdev@vger•kernel.org
Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora•org>
Subject: [PATCH net-next 1/3] net: qualcomm: rmnet: Capture all drops in transmit path
Date: Mon, 14 May 2018 14:08:45 -0600	[thread overview]
Message-ID: <1526328527-20026-2-git-send-email-subashab@codeaurora.org> (raw)
In-Reply-To: <1526328527-20026-1-git-send-email-subashab@codeaurora.org>

Packets in transmit path could potentially be dropped if there were
errors while adding the MAP header or the checksum header.
Increment the tx_drops stats in these cases.

Additionally, refactor the code to free the packet and increment
the tx_drops stat under a single label.

Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora•org>
---
 .../net/ethernet/qualcomm/rmnet/rmnet_handlers.c    | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
index 6fcd586..7fd86d4 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
@@ -148,7 +148,7 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,
 
 	if (skb_headroom(skb) < required_headroom) {
 		if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL))
-			goto fail;
+			return -ENOMEM;
 	}
 
 	if (port->data_format & RMNET_FLAGS_EGRESS_MAP_CKSUMV4)
@@ -156,17 +156,13 @@ static int rmnet_map_egress_handler(struct sk_buff *skb,
 
 	map_header = rmnet_map_add_map_header(skb, additional_header_len, 0);
 	if (!map_header)
-		goto fail;
+		return -ENOMEM;
 
 	map_header->mux_id = mux_id;
 
 	skb->protocol = htons(ETH_P_MAP);
 
 	return 0;
-
-fail:
-	kfree_skb(skb);
-	return -ENOMEM;
 }
 
 static void
@@ -228,15 +224,18 @@ void rmnet_egress_handler(struct sk_buff *skb)
 	mux_id = priv->mux_id;
 
 	port = rmnet_get_port(skb->dev);
-	if (!port) {
-		kfree_skb(skb);
-		return;
-	}
+	if (!port)
+		goto drop;
 
 	if (rmnet_map_egress_handler(skb, port, mux_id, orig_dev))
-		return;
+		goto drop;
 
 	rmnet_vnd_tx_fixup(skb, orig_dev);
 
 	dev_queue_xmit(skb);
+	return;
+
+drop:
+	this_cpu_inc(priv->pcpu_stats->stats.tx_drops);
+	kfree_skb(skb);
 }
-- 
1.9.1

  reply	other threads:[~2018-05-14 20:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 20:08 [PATCH net-next 0/3] net: qualcomm: rmnet: Updates 2018-05-14 Subash Abhinov Kasiviswanathan
2018-05-14 20:08 ` Subash Abhinov Kasiviswanathan [this message]
2018-05-14 20:08 ` [PATCH net-next 2/3] net: qualcomm: rmnet: Add support for ethtool private stats Subash Abhinov Kasiviswanathan
2018-05-15  4:42   ` kbuild test robot
2018-05-15  8:41   ` [RFC PATCH] net: qualcomm: rmnet: rmnet_ethtool_ops can be static kbuild test robot
2018-05-15  8:41   ` [PATCH net-next 2/3] net: qualcomm: rmnet: Add support for ethtool private stats kbuild test robot
2018-05-15 18:09     ` Subash Abhinov Kasiviswanathan
2018-05-15 23:16   ` kbuild test robot
2018-05-14 20:08 ` [PATCH net-next 3/3] net: qualcomm: rmnet: Remove redundant command check Subash Abhinov Kasiviswanathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526328527-20026-2-git-send-email-subashab@codeaurora.org \
    --to=subashab@codeaurora$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox