net: qualcomm: rmnet: Updates 2018-05-14
Subsystems (3)
cover net: qualcomm: rmnet: Updates 2018-05-14
This series contains some minor updates for rmnet driver.
Patch 1 adds tx_drops counter to more places.
Patch 2 adds ethtool private stats support to make it easy to debug the checksum offload path.
Patch 3 is a cleanup in command packet processing path.
Subash Abhinov Kasiviswanathan (3):
net: qualcomm: rmnet: Capture all drops in transmit path
net: qualcomm: rmnet: Add support for ethtool private stats
net: qualcomm: rmnet: Remove redundant command check
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h | 13 +++++ .../net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 21 ++++---- .../ethernet/qualcomm/rmnet/rmnet_map_command.c | 14 ++--- .../net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 59 +++++++++++++++++----- drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 51 +++++++++++++++++++ 5 files changed, 122 insertions(+), 36 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/3 net: qualcomm: rmnet: Capture all drops in transmit path
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.
--- .../net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c +10 -11
@@ -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); }
Signature · 1 line
1.9.1
PATCH 2/3 net: qualcomm: rmnet: Add support for ethtool private stats
In reply to Subash Abhinov KasiviswanathanAdd ethtool private stats handler to debug the handling of packets with checksum offload header / trailer. This allows to keep track of the number of packets for which hardware computes the checksum and counts and reasons where checksum computation was skipped in hardware and was done in the network stack.
--- drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h | 13 +++++ .../net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 59 +++++++++++++++++----- drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 51 +++++++++++++++++++ 3 files changed, 109 insertions(+), 14 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.h +13 -0
@@ -54,11 +54,24 @@ struct rmnet_pcpu_stats {struct u64_stats_sync syncp; }; +struct rmnet_priv_stats { +u64 csum_ok; +u64 csum_valid_unset; +u64 csum_validation_failed; +u64 csum_err_bad_buffer; +u64 csum_err_invalid_ip_version; +u64 csum_err_invalid_transport; +u64 csum_fragmented_pkt; +u64 csum_skipped; +u64 csum_sw; +}; +struct rmnet_priv {u8 mux_id;struct net_device *real_dev;struct rmnet_pcpu_stats __percpu *pcpu_stats;struct gro_cells gro_cells; +struct rmnet_priv_stats stats; };struct rmnet_port *rmnet_get_port (struct net_device *real_dev);
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c +45 -14
147 lines not on this page · raw message
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +51 -0
63 lines not on this page · raw message
Signature · 1 line
1.9.1
kbuild test robot
build botRe: [PATCH net-next 2/3] net: qualcomm: rmnet: Add support for ethtool private stats
Thank you for the patch! Perhaps something to improve:
Hi Subash,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Subash-Abhinov-Kasiviswanathan/net-qualcomm-rmnet-Updates-2018-05-14/20180515-115355
config: i386-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All warnings (new ones prefixed by >>):
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c: In function 'rmnet_map_checksum_downlink_packet':
>> drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:382:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
else
^~~~
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:384:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
return -EPROTONOSUPPORT;
^~~~~~vim +/else +382 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
349
350 /* Validates packet checksums. Function takes a pointer to
351 * the beginning of a buffer which contains the IP payload +
352 * padding + checksum trailer.
353 * Only IPv4 and IPv6 are supported along with TCP & UDP.
354 * Fragmented or tunneled packets are not supported.
355 */
356 int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)
357 {
358 struct rmnet_priv *priv = netdev_priv(skb->dev);
359 struct rmnet_map_dl_csum_trailer *csum_trailer;
360
361 if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
362 priv->stats.csum_sw++;
363 return -EOPNOTSUPP;
364 }
365
366 csum_trailer = (struct rmnet_map_dl_csum_trailer *)(skb->data + len);
367
368 if (!csum_trailer->valid) {
369 priv->stats.csum_valid_unset++;
370 return -EINVAL;
371 }
372
373 if (skb->protocol == htons(ETH_P_IP))
374 return rmnet_map_ipv4_dl_csum_trailer(skb, csum_trailer, priv);
375 else if (skb->protocol == htons(ETH_P_IPV6))
376 #if IS_ENABLED(CONFIG_IPV6)
377 return rmnet_map_ipv6_dl_csum_trailer(skb, csum_trailer, priv);
378 #else
379 priv->stats.csum_err_invalid_ip_version++;
380 return -EPROTONOSUPPORT;
381 #endif
> 382 else
383 priv->stats.csum_err_invalid_ip_version++;
384 return -EPROTONOSUPPORT;
385
386 return 0;
387 }
388
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build bot[RFC PATCH] net: qualcomm: rmnet: rmnet_ethtool_ops can be static
In reply to Subash Abhinov KasiviswanathanFixes: f85908d4636e ("net: qualcomm: rmnet: Add support for ethtool private stats")
--- rmnet_vnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +1 -1
@@ -196,7 +196,7 @@ static void rmnet_get_ethtool_stats(struct net_device *dev,memcpy (data, st,ARRAY_SIZE (rmnet_gstrings_stats) *sizeof (u64)); } -const struct ethtool_ops rmnet_ethtool_ops = { +static const struct ethtool_ops rmnet_ethtool_ops = { .get_ethtool_stats = rmnet_get_ethtool_stats, .get_strings = rmnet_get_strings, .get_sset_count = rmnet_get_sset_count,
kbuild test robot
build botRe: [PATCH net-next 2/3] net: qualcomm: rmnet: Add support for ethtool private stats
In reply to Subash Abhinov KasiviswanathanThank you for the patch! Perhaps something to improve:
Hi Subash,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Subash-Abhinov-Kasiviswanathan/net-qualcomm-rmnet-Updates-2018-05-14/20180515-115355
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:199:26: sparse: symbol 'rmnet_ethtool_ops' was not declared. Should it be static?
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH net-next 2/3] net: qualcomm: rmnet: Add support for ethtool private stats
Quoted 16 lines · kbuild test robot
Hi Subash,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url:
https://github.com/0day-ci/linux/commits/Subash-Abhinov-Kasiviswanathan/net-qualcomm-rmnet-Updates-2018-05-14/20180515-115355
reproduce:# apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
Quoted 7 lines
Quoted 1 line
Quoted 1 line
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:199:26: sparse: symbol 'rmnet_ethtool_ops' was not declared. Should it be static?Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Thanks Fengguang. I will fix both issues in v2
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
kbuild test robot
build botRe: [PATCH net-next 2/3] net: qualcomm: rmnet: Add support for ethtool private stats
In reply to Subash Abhinov KasiviswanathanThank you for the patch! Yet something to improve:
Hi Subash,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Subash-Abhinov-Kasiviswanathan/net-qualcomm-rmnet-Updates-2018-05-14/20180515-115355
config: x86_64-randconfig-s4-05160610 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 All error/warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:10:0,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from include/linux/netdevice.h:28,
from drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:16:
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c: In function 'rmnet_map_checksum_downlink_packet':
include/linux/compiler.h:58:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^
include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
^~~~~~~~~~
>> drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:375:7: note: in expansion of macro 'if'
else if (skb->protocol == htons(ETH_P_IPV6))
^~
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:380:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
return -EPROTONOSUPPORT;
^~~~~~
>> drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c:382:2: error: 'else' without a previous 'if'
else
^~~~vim +382 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
349
350 /* Validates packet checksums. Function takes a pointer to
351 * the beginning of a buffer which contains the IP payload +
352 * padding + checksum trailer.
353 * Only IPv4 and IPv6 are supported along with TCP & UDP.
354 * Fragmented or tunneled packets are not supported.
355 */
356 int rmnet_map_checksum_downlink_packet(struct sk_buff *skb, u16 len)
357 {
358 struct rmnet_priv *priv = netdev_priv(skb->dev);
359 struct rmnet_map_dl_csum_trailer *csum_trailer;
360
361 if (unlikely(!(skb->dev->features & NETIF_F_RXCSUM))) {
362 priv->stats.csum_sw++;
363 return -EOPNOTSUPP;
364 }
365
366 csum_trailer = (struct rmnet_map_dl_csum_trailer *)(skb->data + len);
367
368 if (!csum_trailer->valid) {
369 priv->stats.csum_valid_unset++;
370 return -EINVAL;
371 }
372
373 if (skb->protocol == htons(ETH_P_IP))
374 return rmnet_map_ipv4_dl_csum_trailer(skb, csum_trailer, priv);
> 375 else if (skb->protocol == htons(ETH_P_IPV6)) 376 #if IS_ENABLED(CONFIG_IPV6) 377 return rmnet_map_ipv6_dl_csum_trailer(skb, csum_trailer, priv); 378 #else 379 priv->stats.csum_err_invalid_ip_version++; 380 return -EPROTONOSUPPORT; 381 #endif > 382 else
383 priv->stats.csum_err_invalid_ip_version++;
384 return -EPROTONOSUPPORT;
385
386 return 0;
387 }
388
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 3/3 net: qualcomm: rmnet: Remove redundant command check
In reply to Subash Abhinov KasiviswanathanThe command packet size is already checked once in rmnet_map_deaggregate() for the header, packet and trailer size, so this additional check is not needed.
--- drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_map_command.c +3 -11
@@ -69,17 +69,9 @@ static void rmnet_map_send_ack(struct sk_buff *skb,struct rmnet_map_control_command *cmd;int xmit_status; -if (port->data_format &RMNET_FLAGS_INGRESS_MAP_CKSUMV4 ) { -if (skb->len <sizeof (struct rmnet_map_header ) + -RMNET_MAP_GET_LENGTH (skb) + -sizeof (struct rmnet_map_dl_csum_trailer )) { -kfree_skb (skb); -return ; - } - -skb_trim (skb, skb->len - -sizeof (struct rmnet_map_dl_csum_trailer )); - } +if (port->data_format &RMNET_FLAGS_INGRESS_MAP_CKSUMV4 ) +skb_trim (skb, + skb->len -sizeof (struct rmnet_map_dl_csum_trailer )); skb->protocol =htons (ETH_P_MAP );
Signature · 1 line
1.9.1