From patchwork Thu Apr 3 09:11:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Yanjun X-Patchwork-Id: 336554 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 C7B71140180 for ; Thu, 3 Apr 2014 20:13:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751926AbaDCJNC (ORCPT ); Thu, 3 Apr 2014 05:13:02 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:57596 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbaDCJM5 (ORCPT ); Thu, 3 Apr 2014 05:12:57 -0400 Received: by mail-pd0-f174.google.com with SMTP id y13so1510450pdi.33 for ; Thu, 03 Apr 2014 02:12:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=KBpfYmTKum7pvSVyMRGcoPf5JZXDPT0nGbdszNvLupg=; b=0HG0xzjIap39CfzZW4cJ5mn17sNWEPJYInQ8TswGWVr6Bgl+XzlcKtrPFDiGh8fcHA MPjEojiaFfaFl5jTGdv8JTXv6A7CFG0a2hoGPMTOGLP6/rNjDIAA4XiWqzp/6ix4iNJD h69ev6SF+JkLU3uHnInv9V3sNcnCP9dH7dZGr8Va+8MSDhGRBakQsBjIBOjpAmX4SyX5 rXws1lpz3/wqpEn9Te/t+AfbPULfaQrVnpzjAzbB15FpmkLZ5b0zJJeF/T/yvvdxEMjD c1EZL6XOl+bh0JkipE1FvuFMw3NR5eZwns2KKsB0iSbZia8AC7Jq2n8nH1pvRu1xWff3 4Xyg== X-Received: by 10.66.124.232 with SMTP id ml8mr6043286pab.38.1396516376459; Thu, 03 Apr 2014 02:12:56 -0700 (PDT) Received: from [128.224.162.224] ([1.202.252.122]) by mx.google.com with ESMTPSA id hr5sm22402434pac.18.2014.04.03.02.12.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Apr 2014 02:12:55 -0700 (PDT) Message-ID: <533D25D4.4000607@gmail.com> Date: Thu, 03 Apr 2014 17:11:48 +0800 From: zhuyj User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: sandeep.kumar@freescale.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Tao, Yue" , "Yang, Zhangle (Eric)" , guang.yang@windriver.com, joe@perches.com, festevam@gmail.com, linuxppc-dev@lists.ozlabs.org, richardcochran@gmail.com, clarocq@gmail.com, yongjun_wei@trendmicro.com.cn, Claudiu Manoil , w@1wt.eu, zhuyj Subject: Re: on kernel 2.6.34.15, vlan and raw packets can not be received with gfar-enet nic References: <53310F4E.4080104@gmail.com> In-Reply-To: <53310F4E.4080104@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, Claudiu Please help to review this patch. This patch is for kernel 2.6.x. Thanks a lot. Hi, Willy Please help to merge this patch to longterm: 2.6.32.61 since this problem also occurs on this kernel. Thanks a lot. Based on kernel 2.6.x, gianfar nic driver can not work well. The root cause is that tx vlan of gianfar can not handle VLAN tag 0. So on kernel 3.0+, this tx vlan feature is disabled. But on kernel 2.6.x, this feature is still enabled. This patch will disable this feature of gianfar nic driver. If this feature is enabled, gianfar nic can not support vlan packets and non-vlan packets at the same time. The following steps will reproduce this problem. The steps are as below. 1. boot two freescale-p2020 boards with linux kernel 2.6.x, then connected 2 gfar-enet nic cards with a direct network line; 2. On board 1, checked the driver of eth0 ethtool -i eth0 driver: gfar-enet version: 1.3 firmware-version: N/A bus-info: N/A On board 2, I checked the driver of eth1 ethtool -i eth1 driver: gfar-enet version: 1.3 firmware-version: N/A bus-info: N/A 3. Then configure the ip address on the above 2 nic cards. On board 1, ifconfig eth0 192.168.1.13/24 up On board 2, ifconfig eth1 192.168.1.196/24 up 4. We can access the other board on one board. For example, on board 1, we can ping board 2. root@p2020rdb:/root> ping 192.168.1.196 PING 192.168.1.196 (192.168.1.196) 56(84) bytes of data. 64 bytes from 192.168.1.196: icmp_req=1 ttl=64 time=2.92 ms 64 bytes from 192.168.1.196: icmp_req=2 ttl=64 time=0.096 ms 5. We configure vlan on these 2 boards. VLAN tag 0 On board 1, modprobe 8021q vconfig add eth0 4091 ifconfig eth0.4091 10.1.1.13/24 up On board 2, modprobe 8021q vconfig add eth1 4091 ifconfig eth1.4091 10.1.1.196/24 up 6. We can access the other board on one board through vlan. For example, on board 1, we can ping board 2 through vlan nic. root@p2020rdb:/root> ping 10.1.1.196 PING 10.1.1.196 (10.1.1.196) 56(84) bytes of data. 64 bytes from 10.1.1.196: icmp_req=1 ttl=64 time=2.92 ms 64 bytes from 10.1.1.196: icmp_req=2 ttl=64 time=0.096 ms But we can not access the other board on one board through raw nic. For example, on board, we can not ping board 2. root@p2020rdb:/root> ping 192.168.1.196 From 192.168.1.196 icmp_seq=1 Destination Host Unreachable From 192.168.1.196 icmp_seq=2 Destination Host Unreachable From 192.168.1.196 icmp_seq=3 Destination Host Unreachable Best Regards! Zhu Yanjun On 03/25/2014 01:08 PM, zhuyj wrote: > Hi, Sandeep Gopalpet > > I am a developer. Now I confronted an interesting phenomena. When I > used linux kernel 2.6.34.15 on freescale-p2020, I can not receive raw > and vlan packets on gfar-enet nic. But with e1000e nic, we can make > vlan and raw packets work well. I looked into the source code and find > that maybe it is related with hardware insert and remove vlan head. > But I have no the specifications of gfar-enet nic. Would you like to > give some document or some guides? > > Thanks a lot. > Zhu Yanjun > > The steps are as below. > > 1. I boot two freescale-p2020 boards with linux kernel 2.6.34.15, then > I connected 2 gfar-enet nic cards with a direct network line; > > 2. On board 1, I checked the driver of eth0 > > ethtool -i eth0 > > driver: gfar-enet > version: 1.3 > firmware-version: N/A > bus-info: N/A > > On board 2, I checked the driver of eth1 > > ethtool -i eth1 > > driver: gfar-enet > version: 1.3 > firmware-version: N/A > bus-info: N/A > > 3. Then I configure the ip address on the above 2 nic cards. > > On board 1, > > ifconfig eth0 192.168.1.13/24 up > > On board 2, > > ifconfig eth1 192.168.1.196/24 up > > 4. We can access the other board on one board. > For example, on board 1, we can ping board 2. > > root@p2020rdb:/root> ping 192.168.1.196 > PING 192.168.1.196 (192.168.1.196) 56(84) bytes of data. > 64 bytes from 192.168.1.196: icmp_req=1 ttl=64 time=2.92 ms > 64 bytes from 192.168.1.196: icmp_req=2 ttl=64 time=0.096 ms > > 5. We configure vlan on these 2 boards. VLAN tag 0 > On board 1, > > modprobe 8021q > vconfig add eth0 4091 > ifconfig eth0.4091 10.1.1.13/24 up > > On board 2, > > modprobe 8021q > vconfig add eth1 4091 > ifconfig eth1.4091 10.1.1.196/24 up > > 6. We can access the other board on one board through vlan. > For example, on board 1, we can ping board 2 through vlan nic. > > root@p2020rdb:/root> ping 10.1.1.196 > PING 10.1.1.196 (10.1.1.196) 56(84) bytes of data. > 64 bytes from 10.1.1.196: icmp_req=1 ttl=64 time=2.92 ms > 64 bytes from 10.1.1.196: icmp_req=2 ttl=64 time=0.096 ms > > But we can not access the other board on one board through raw nic. > For example, on board, we can not ping board 2. > > root@p2020rdb:/root> ping 192.168.1.196 > From 192.168.1.196 icmp_seq=1 Destination Host Unreachable > From 192.168.1.196 icmp_seq=2 Destination Host Unreachable > From 192.168.1.196 icmp_seq=3 Destination Host Unreachable > > From afd48fa3ad5b15d519adeb19b2a9c00051327c68 Mon Sep 17 00:00:00 2001 From: Zhu Yanjun Date: Thu, 3 Apr 2014 16:41:13 +0800 Subject: [PATCH 1/1] gianfar: disable TX vlan based on kernel 2.6.x Since there is something wrong with tx vlan of gianfar nic driver, on kernel(3.0+), tx vlan is disabled. But on kernel 2.6.x, tx vlan is still enabled. Thus,gianfar nic driver can not support vlan packets and non-vlan packets. Signed-off-by: Zhu Yanjun --- drivers/net/gianfar.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 934a28f..8aa2cf6 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c @@ -365,7 +365,7 @@ static int gfar_probe(struct of_device *ofdev, priv->vlgrp = NULL; if (priv->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) - dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; + dev->features |= NETIF_F_HW_VLAN_RX; if (priv->device_flags & FSL_GIANFAR_DEV_HAS_EXTENDED_HASH) { priv->extended_hash = 1; @@ -1451,12 +1451,6 @@ static void gfar_vlan_rx_register(struct net_device *dev, priv->vlgrp = grp; if (grp) { - /* Enable VLAN tag insertion */ - tempval = gfar_read(&priv->regs->tctrl); - tempval |= TCTRL_VLINS; - - gfar_write(&priv->regs->tctrl, tempval); - /* Enable VLAN tag extraction */ tempval = gfar_read(&priv->regs->rctrl); tempval |= (RCTRL_VLEX | RCTRL_PRSDEP_INIT); -- 1.7.9.5