From patchwork Sun Sep 14 15:37:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 389070 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 77A0C14009B for ; Mon, 15 Sep 2014 01:44:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752760AbaINPo1 (ORCPT ); Sun, 14 Sep 2014 11:44:27 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:49304 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752641AbaINPoZ (ORCPT ); Sun, 14 Sep 2014 11:44:25 -0400 Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1XTBs7-0007Z2-Fc; Sun, 14 Sep 2014 17:37:51 +0200 Date: Sun, 14 Sep 2014 17:37:51 +0200 From: Andrew Lunn To: f.fainelli@gmail.com Cc: seugene@marvell.com, Andrew Lunn , netdev@vger.kernel.org Subject: DSA and skb->protocol Message-ID: <20140914153751.GA28585@lunn.ch> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Florian I've been debugging a WARNING when using DSA with a D-Link DIR665. I've had reports of the same warning with another device. WARNING: CPU: 0 PID: 2014 at net/core/dev.c:2260 skb_warn_bad_offload+0xd0/0x104() mv643xx_eth_port: caps=(0x0000000400014803, 0x00000000001b482b) len=1722 data_len=16 gso_size=1448 gso_type=1 gso_segs 2 ip_summed=3 encapsulation 0 features 400014801 Modules linked in: CPU: 0 PID: 2014 Comm: sshd Tainted: G W 3.17.0-rc1-00007-g2f06b2c08099-dirty #228 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (warn_slowpath_common+0x6c/0x8c) [] (warn_slowpath_common) from [] (warn_slowpath_fmt+0x30/0x40) [] (warn_slowpath_fmt) from [] (skb_warn_bad_offload+0xd0/0x104) [] (skb_warn_bad_offload) from [] (skb_checksum_help+0x160/0x170) [] (skb_checksum_help) from [] (dev_hard_start_xmit+0x3f8/0x4c0) [] (dev_hard_start_xmit) from [] (sch_direct_xmit+0x148/0x250) [] (sch_direct_xmit) from [] (__dev_queue_xmit+0x278/0x5f4) [] (__dev_queue_xmit) from [] (edsa_xmit+0xf8/0x2c8) [] (edsa_xmit) from [] (dev_hard_start_xmit+0x2dc/0x4c0) [] (dev_hard_start_xmit) from [] (__dev_queue_xmit+0x3c4/0x5f4) [] (__dev_queue_xmit) from [] (ip_finish_output+0x64c/0x920) [] (ip_finish_output) from [] (ip_local_out_sk+0x34/0x38) [] (ip_local_out_sk) from [] (ip_queue_xmit+0x128/0x388) [] (ip_queue_xmit) from [] (tcp_transmit_skb+0x534/0x93c) [] (tcp_transmit_skb) from [] (tcp_write_xmit+0x148/0xbf8) [] (tcp_write_xmit) from [] (__tcp_push_pending_frames+0x30/0x9c) [] (__tcp_push_pending_frames) from [] (tcp_sendmsg+0xc0/0xcec) [] (tcp_sendmsg) from [] (inet_sendmsg+0x3c/0x70) [] (inet_sendmsg) from [] (sock_aio_write+0xcc/0xec) [] (sock_aio_write) from [] (do_sync_write+0x7c/0xa4) [] (do_sync_write) from [] (vfs_write+0x108/0x1b0) [] (vfs_write) from [] (SyS_write+0x40/0x94) [] (SyS_write) from [] (ret_fast_syscall+0x0/0x2c) ---[ end trace b1b02d15aba4766a ]--- I think i understand what is going on, and one of your recent patches may indicate you have seen something similar. int dev_hard_start_xmit() we have: 2607 2608 features = netif_skb_features(skb); ... 2637 /* If packet is not checksummed and device does not 2638 * support checksumming for this protocol, complete 2639 * checksumming here. 2640 */ 2641 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2642 if (skb->encapsulation) 2643 skb_set_inner_transport_header(skb, 2644 skb_checksum_start_offset(skb)); 2645 else 2646 skb_set_transport_header(skb, 2647 skb_checksum_start_offset(skb)); 2648 if (!(features & NETIF_F_ALL_CSUM) && 2649 skb_checksum_help(skb)) 2650 goto out_kfree_skb; 2651 } This packet is CHECKSUM_PARTIAL, but it is also a GSO packet, with two segments, so the skb_checksum_help() is throwing the warning. It is expected that the hardware with do the checksum when using GSO. The reason it is trying to do software checksums, not hardware, is because features does not indicate the protocol is supported by hardware checksumming. This i initially thought was odd, since this is a TCP/IP packet, as you can see from the stack trace. However, netif_skb_features(skb) calls harmonize_features() which calls can_checksum_protocol(): 3206 static inline bool can_checksum_protocol(netdev_features_t features, 3207 __be16 protocol) 3208 { 3209 return ((features & NETIF_F_GEN_CSUM) || 3210 ((features & NETIF_F_V4_CSUM) && 3211 protocol == htons(ETH_P_IP)) || 3212 ((features & NETIF_F_V6_CSUM) && 3213 protocol == htons(ETH_P_IPV6)) || 3214 ((features & NETIF_F_FCOE_CRC) && 3215 protocol == htons(ETH_P_FCOE))); 3216 } However looking in the skb, we see protocol is now ETH_P_EDSA, not ETH_P_IP. Hence the hardware does not support this protocol. This protocol value is because edsa_xmit() changes it in the slave device TX path. Your patch "net: dsa: change tag_protocol to an enum" has a hunk: making me think it is not actually needed to change skb->protocol. When i remove this from edsa_xmit(), the warning goes away and networking seems to work O.K. Is this the right fix? Should we remove this setting of skb->protocol in the other dsa xmit functions? Thanks Andrew --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c index e0b759ec209e..8fbc21c0de78 100644 --- a/net/dsa/tag_brcm.c +++ b/net/dsa/tag_brcm.c @@ -91,7 +91,6 @@ static netdev_tx_t brcm_tag_xmit(struct sk_buff *skb, struct net_device *dev) /* Queue the SKB for transmission on the parent interface, but * do not modify its EtherType */ - skb->protocol = htons(ETH_P_BRCMTAG); skb->dev = p->parent->dst->master_netdev; dev_queue_xmit(skb);