* Re: [PATCH v2] net IPv6 : Fix broken IPv6 routing table after loopback down-up
From: Balakumaran Kannan @ 2013-04-01 11:59 UTC (permalink / raw)
To: David Miller
Cc: eric.dumazet, yoshfuji, kaber, kuznet, jmorris,
Balakumaran.Kannan, maruthi.thotad, netdev, jamshed.a,
amit.agarwal, takuzo.ohara, aaditya.kumar
In-Reply-To: <CAHPKR9+=fFPTpjdE+diyXDvjEdPcqcRXJvWP_rHWrqB7wMTEPA@mail.gmail.com>
IPv6 Routing table becomes broken once we do ifdown, ifup of the loopback(lo)
interface. After down-up, routes of other interface's IPv6 addresses through
'lo' are lost.
IPv6 addresses assigned to all interfaces are routed through 'lo' for internal
communication. Once 'lo' is down, those routing entries are removed from routing
table. But those removed entries are not being re-created properly when 'lo' is
brought up. So IPv6 addresses of other interfaces becomes unreachable from the
same machine. Also this breaks communication with other machines because of
NDISC packet processing failure.
This patch fixes this issue by reading all interface's IPv6 addresses and adding
them to IPv6 routing table while bringing up 'lo'.
Patch is prepared for Linux-3.9.rc4 kernel.
Signed-off-by: Balakumaran Kannan <Balakumaran.Kannan@ap.sony.com>
Signed-off-by: Maruthi Thotad <Maruthi.Thotad@ap.sony.com>
---
==Testing==
Before applying the patch:
$ route -A inet6
Kernel IPv6 routing table
Destination Next Hop Flag Met Ref Use If
2000::20/128 :: U 256 0 0 eth0
fe80::/64 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
::1/128 :: Un 0 1 0 lo
2000::20/128 :: Un 0 1 0 lo
fe80::xxxx:xxxx:xxxx:xxxx/128 :: Un 0 1 0 lo
ff00::/8 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
$ sudo ifdown lo
$ sudo ifup lo
$ route -A inet6
Kernel IPv6 routing table
Destination Next Hop Flag Met Ref Use If
2000::20/128 :: U 256 0 0 eth0
fe80::/64 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
::1/128 :: Un 0 1 0 lo
ff00::/8 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
$
After applying the patch:
$ route -A inet6
Kernel IPv6 routing
table
Destination Next Hop Flag Met Ref Use If
2000::20/128 :: U 256 0 0 eth0
fe80::/64 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
::1/128 :: Un 0 1 0 lo
2000::20/128 :: Un 0 1 0 lo
fe80::xxxx:xxxx:xxxx:xxxx/128 :: Un 0 1 0 lo
ff00::/8 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
$ sudo ifdown lo
$ sudo ifup lo
$ route -A inet6
Kernel IPv6 routing table
Destination Next Hop Flag Met Ref Use If
2000::20/128 :: U 256 0 0 eth0
fe80::/64 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
::1/128 :: Un 0 1 0 lo
2000::20/128 :: Un 0 1 0 lo
fe80::xxxx:xxxx:xxxx:xxxx/128 :: Un 0 1 0 lo
ff00::/8 :: U 256 0 0 eth0
::/0 :: !n -1 1 1 lo
$
---
--- linux-3.9-rc4/net/ipv6/addrconf.c.orig 2013-03-27 10:40:26.382569527 +0530
+++ linux-3.9-rc4/net/ipv6/addrconf.c 2013-03-28 20:33:59.908228232 +0530
@@ -2529,6 +2529,9 @@ static void sit_add_v4_addrs(struct inet static void init_loopback(struct net_device *dev) {
struct inet6_dev *idev;
+ struct net_device *sp_dev;
+ struct inet6_ifaddr *sp_ifa;
+ struct rt6_info *sp_rt;
/* ::1 */
@@ -2540,6 +2543,31 @@ static void init_loopback(struct net_dev
}
add_addr(idev, &in6addr_loopback, 128, IFA_HOST);
+
+ /* Add routes to other interface's IPv6 addresses */
+ for_each_netdev(dev_net(dev), sp_dev) {
+
+ if (!strcmp(sp_dev->name, dev->name))
+ continue;
+
+ idev = __in6_dev_get(sp_dev);
+ if (NULL == idev)
+ continue;
+
+ read_lock_bh(&idev->lock);
+ list_for_each_entry(sp_ifa, &idev->addr_list, if_list) {
+
+ if (sp_ifa->flags & (IFA_F_DADFAILED | IFA_F_TENTATIVE))
+ continue;
+
+ sp_rt = addrconf_dst_alloc(idev, &sp_ifa->addr, 0);
+
+ /* Failure cases are ignored */
+ if (!IS_ERR(sp_rt))
+ ip6_ins_rt(sp_rt);
+ }
+ read_unlock_bh(&idev->lock);
+ }
}
static void addrconf_add_linklocal(struct inet6_dev *idev, const struct in6_addr *addr)
^ permalink raw reply
* Re: [Suggestion] drivers/isdn/divert: break looping, or memory leak by calling kmalloc again
From: Chen Gang @ 2013-04-01 10:19 UTC (permalink / raw)
To: Tilman Schmidt; +Cc: isdn, Jiri Slaby, Jiri Kosina, David Miller, netdev
In-Reply-To: <51595C9A.1060608@imap.cc>
On 2013年04月01日 18:08, Tilman Schmidt wrote:
> Am 01.04.2013 04:11, schrieb Chen Gang:
>> > in drivers/isdn/divert/isdn_divert.c:
>> >
>> > in 'for' looping (line 395..515)
>> > the 'cs' may call kmalloc again (line 453).
>> >
>> > it seems need break looping, when get valid 'cs' value (line 509)
> I don't think so. If the kmalloc for cs succeeds, control flow will
> continue linearly up to the 'if' statement in line 503. Then it will
> either kfree(cs) and return, or reach the 'break' in line 514 which
> will end the 'for' loop.
oh, really it is, it is my fault !
(I did not see the break at line 514)
thanks.
:-)
--
Chen Gang
Asianux Corporation
^ permalink raw reply
* Re: [Suggestion] drivers/isdn/divert: break looping, or memory leak by calling kmalloc again
From: Tilman Schmidt @ 2013-04-01 10:08 UTC (permalink / raw)
To: Chen Gang; +Cc: isdn, Jiri Slaby, Jiri Kosina, David Miller, netdev
In-Reply-To: <5158ECBD.4050109@asianux.com>
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
Am 01.04.2013 04:11, schrieb Chen Gang:
> in drivers/isdn/divert/isdn_divert.c:
>
> in 'for' looping (line 395..515)
> the 'cs' may call kmalloc again (line 453).
>
> it seems need break looping, when get valid 'cs' value (line 509)
I don't think so. If the kmalloc for cs succeeds, control flow will
continue linearly up to the 'if' statement in line 503. Then it will
either kfree(cs) and return, or reach the 'break' in line 514 which
will end the 'for' loop.
HTH
Tilman
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]
^ permalink raw reply
* Re: RX/dropped counter values for tagged packets
From: Ani Sinha @ 2013-04-01 4:44 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Ani Sinha, netdev
In-Reply-To: <1364787794.5113.147.camel@edumazet-glaptop>
On Sun, Mar 31, 2013 at 8:43 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Sun, 2013-03-31 at 20:17 -0700, Ani Sinha wrote:
>
>> Correct. Now if you combine the two cases, we increment the rx count
>> for tagged packets in vlan_do_receive() and then in "another_round",
>> if pt_prev is null, we also increment the rx_dropped.
>>
>
> Thats the way its done in a NIC driver.
>
> We increment rx_{bytes|packets} counters before giving the packet to the
> upper stack.
>
> Then the stack might drop the packet and increment rx_dropped.
>
thanks for the clarification. So basically what this means is that
from the numbers reported by ifconfig for example, rx-dropped is the
true rx value.
^ permalink raw reply
* Re: RX/dropped counter values for tagged packets
From: Eric Dumazet @ 2013-04-01 3:43 UTC (permalink / raw)
To: Ani Sinha; +Cc: Ani Sinha, netdev
In-Reply-To: <CAOQZsUjbx9fHtjexmpfGCETRjVJU7QOBJcng6ndT1nFaZKmf5w@mail.gmail.com>
On Sun, 2013-03-31 at 20:17 -0700, Ani Sinha wrote:
> Correct. Now if you combine the two cases, we increment the rx count
> for tagged packets in vlan_do_receive() and then in "another_round",
> if pt_prev is null, we also increment the rx_dropped.
>
Thats the way its done in a NIC driver.
We increment rx_{bytes|packets} counters before giving the packet to the
upper stack.
Then the stack might drop the packet and increment rx_dropped.
^ permalink raw reply
* [GIT] Networking
From: David Miller @ 2013-04-01 3:33 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) sadb_msg prepared for IPSEC userspace forgets to initialize the
satype field, fix from Nicolas Dichtel.
2) Fix mac80211 synchronization during station removal, from Johannes
Berg.
3) Fix IPSEC sequence number notifications when they wrap, from
Steffen Klassert.
4) Fix cfg80211 wdev tracing crashes when add_virtual_intf() returns
an error pointer, from Johannes Berg.
5) In mac80211, don't call into the channel context code with the
interface list mutex held. From Johannes Berg.
6) In mac80211, if we don't actually associate, do not restart the STA
timer, otherwise we can crash. From Ben Greear.
7) Missing dma_mapping_error() check in e1000, ixgb, and e1000e. From
Christoph Paasch.
8) Fix sja1000 driver defines to not conflict with SH port, from
Marc Kleine-Budde.
9) Don't call il4965_rs_use_green with a NULL station, from Colin Ian
King.
10) Suspend/Resume in the FEC driver fail because the buffer descriptors
are not initialized at all the moments in which they should. Fix
from Frank Li.
11) cpsw and davinci_emac drivers both use the wrong interface to restart
a stopped TX queue. Use netif_wake_queue not netif_start_queue,
the latter is for initialization/bringup not active management of
the queue. From Mugunthan V N.
12) Fix regression in rate calculations done by psched_ratecfg_precompute(),
missing u64 type promotion. From Sergey Popovich.
13) Fix length overflow in tg3 VPD parsing, from Kees Cook.
14) AOE driver fails to allocate enough headroom, resulting in crashes.
Fix from Eric Dumazet.
15) RX overflow happens too quickly in sky2 driver because pause packet
thresholds are not programmed correctly. From Mirko Lindner.
16) Bonding driver manages arp_interval and miimon settings incorrectly,
disabling one unintentionally disables both. Fix from Nikolay
Aleksandrov.
17) smsc75xx drivers don't program the RX mac properly for jumbo frames.
Fix from Steve Glendinning.
18) Fix off-by-one in Codel packet scheduler. From Vijay Subramanian.
19) Fix packet corruption in atl1c by disabling MSI support, from
Hannes Frederic Sowa.
20) netdev_rx_handler_unregister() needs a synchronize_net() to fix crashes
in bonding driver unload stress tests. From Eric Dumazet.
21) rxlen field of ks8851 RX packet descriptors not interpreted
correctly (it is 12 bits not 16 bits, so needs to be masked after
shifting the 32-bit value down 16 bits). Fix from Max Nekludov.
22) Fix missed RX/TX enable in sh_eth driver due to mishandling of link
change indications. From Sergei Shtylyov.
23) Fix crashes during spurious ECI interrupts in sh_eth driver, also from
Sergei Shtylyov.
24) dm9000 driver initialization is done wrong for revision B devices
with DSP PHY, from Joseph CHANG.
Please pull, thanks a lot!
The following changes since commit a8c45289f215e137825bf9630d0abb41c1dc41ff:
Merge tag 'iommu-fixes-v3.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu (2013-03-27 09:25:11 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
for you to fetch changes up to 6741f40d198c6a5feb23653a1efd4ca47f93d83d:
DM9000B: driver initialization upgrade (2013-03-31 19:43:23 -0400)
----------------------------------------------------------------
Avinash Patil (1):
mwifiex: reset skb->data after processing PCIe sleep confirm cmd respose
Ben Greear (1):
mac80211: Don't restart sta-timer if not associated.
Christoph Paasch (3):
e1000: ethtool: Add missing dma_mapping_error-call in e1000_setup_desc_rings
ixgb: Add missing dma_mapping_error-call in ixgb_alloc_rx_buffers
e1000e: Add missing dma_mapping_error-call in e1000_alloc_jumbo_rx_buffers
Colin Ian King (1):
iwlegacy: 4965-rs: avoid null pointer dereference error
Dan Williams (1):
libertas: drop maintainership
David S. Miller (4):
Merge branch 'master' of git://git.kernel.org/.../klassert/ipsec
Merge branch 'master' of git://git.kernel.org/.../jkirsher/net
Merge branch 'fixes-for-3.9' of git://gitorious.org/linux-can/linux-can
Merge branch 'wireless'
Dmitry Kravkov (1):
line up comment for ndo_bridge_getlink
Emmanuel Grumbach (3):
iwlwifi: fix length check in multi-TB HCMD
iwlwifi: set rfkill in internal state of the transport
iwlwifi: dvm: don't send HCMD in restart flow
Eric Dumazet (2):
aoe: reserve enough headroom on skbs
net: add a synchronize_net() in netdev_rx_handler_unregister()
Frank Li (1):
enet: fec: fix fail resume from suspend state
Hannes Frederic Sowa (2):
ipv6: don't accept node local multicast traffic from the wire
atl1e: drop pci-msi support because of packet corruption
Iestyn C. Elfick (1):
b43: A fix for DMA transmission sequence errors
Johannes Berg (6):
mac80211: always synchronize_net() during station removal
cfg80211: fix potential BSS memory leak and update
mac80211: fix crash with P2P Device returning action frames
cfg80211: fix wdev tracing crash
mac80211: fix virtual monitor interface locking
cfg80211: always check for scan end on P2P device
John W. Linville (4):
Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
Revert "brcmsmac: support 4313iPA"
Merge branch 'for-john' of git://git.kernel.org/.../iwlwifi/iwlwifi-fixes
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Joseph CHANG (1):
DM9000B: driver initialization upgrade
Kees Cook (1):
tg3: fix length overflow in VPD firmware parsing
Li RongQing (1):
net: fix the use of this_cpu_ptr
Luis R. Rodriguez (1):
ath9k: avoid queueing hw check work when suspended
Manish Chopra (1):
MAINTAINERS: Update netxen_nic maintainers list
Marc Kleine-Budde (2):
can: sja1000: fix define conflict on SH
can: sja1000: limit PEAK PCAN-PC Card to HAS_IOPORT
Mathias Krause (1):
xfrm: Fix esn sequence number diff calculation in xfrm_replay_notify_esn()
Max.Nekludov@us.elster.com (1):
ks8851: Fix interpretation of rxlen field.
Mirko Lindner (2):
sky2: Receive Overflows not counted
sky2: Threshold for Pause Packet is set wrong
Mugunthan V N (2):
drivers: net: ethernet: cpsw: use netif_wake_queue() while restarting tx queue
drivers: net: ethernet: davinci_emac: use netif_wake_queue() while restarting tx queue
Nicolas Dichtel (1):
af_key: initialize satype in key_notify_policy_flush()
Rafał Miłecki (2):
b43: N-PHY: increase initial value of "mind" in RSSI calibration
b43: N-PHY: use more bits for offset in RSSI calibration
Rob Herring (2):
net: calxedaxgmac: fix rx ring handling when OOM
net: calxedaxgmac: Wake-on-LAN fixes
Sergei Shtylyov (3):
sh_eth: fix handling of no LINK signal
sh_eth: workaround for spurious ECI interrupt
sh_eth: make 'link' field of 'struct sh_eth_private' *int*
Sergey Popovich (1):
sch: add missing u64 in psched_ratecfg_precompute()
Shmulik Ladkani (1):
net: core: Remove redundant call to 'nf_reset' in 'dev_forward_skb'
Steffen Klassert (1):
xfrm: Fix replay notification for esn.
Steve Glendinning (1):
smsc75xx: fix jumbo frame support
Vijay Subramanian (1):
net: fq_codel: Fix off-by-one error
Vladimir Kondratiev (1):
cfg80211: fix inconsistency in trace for rdev_set_mac_acl
Wei Yongjun (1):
rtnetlink: fix error return code in rtnl_link_fill()
nikolay@redhat.com (1):
bonding: fix disabling of arp_interval and miimon
MAINTAINERS | 4 +-
drivers/block/aoe/aoecmd.c | 3 +-
drivers/net/bonding/bond_sysfs.c | 92 ++++++------
drivers/net/can/sja1000/Kconfig | 1 +
drivers/net/can/sja1000/plx_pci.c | 4 +-
drivers/net/can/sja1000/sja1000.c | 6 +-
drivers/net/can/sja1000/sja1000.h | 2 +-
drivers/net/ethernet/atheros/atl1e/atl1e.h | 1 -
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 19 +--
drivers/net/ethernet/broadcom/tg3.c | 7 +-
drivers/net/ethernet/calxeda/xgmac.c | 9 +-
drivers/net/ethernet/davicom/dm9000.c | 214 ++++++++++++++--------------
drivers/net/ethernet/davicom/dm9000.h | 11 +-
drivers/net/ethernet/freescale/fec.c | 82 ++++++-----
drivers/net/ethernet/intel/e1000/e1000_ethtool.c | 14 +-
drivers/net/ethernet/intel/e1000e/netdev.c | 7 +-
drivers/net/ethernet/intel/ixgb/ixgb_main.c | 7 +-
drivers/net/ethernet/marvell/sky2.c | 2 +-
drivers/net/ethernet/marvell/sky2.h | 2 +-
drivers/net/ethernet/micrel/ks8851.c | 2 +-
drivers/net/ethernet/renesas/sh_eth.c | 28 ++--
drivers/net/ethernet/renesas/sh_eth.h | 2 +-
drivers/net/ethernet/ti/cpsw.c | 2 +-
drivers/net/ethernet/ti/davinci_emac.c | 2 +-
drivers/net/usb/smsc75xx.c | 12 +-
drivers/net/wireless/ath/ath9k/link.c | 3 +-
drivers/net/wireless/b43/dma.c | 65 +++++++--
drivers/net/wireless/b43/phy_n.c | 8 +-
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 369 +++++++++++++++++--------------------------------
drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | 64 ++++-----
drivers/net/wireless/iwlegacy/4965-rs.c | 3 +-
drivers/net/wireless/iwlwifi/dvm/lib.c | 9 ++
drivers/net/wireless/iwlwifi/dvm/ucode.c | 4 +-
drivers/net/wireless/iwlwifi/pcie/trans.c | 13 ++
drivers/net/wireless/iwlwifi/pcie/tx.c | 2 +-
drivers/net/wireless/mwifiex/pcie.c | 1 +
include/linux/netdevice.h | 2 +-
net/core/dev.c | 7 +-
net/core/flow.c | 2 +-
net/core/rtnetlink.c | 4 +-
net/ipv6/ip6_input.c | 12 ++
net/key/af_key.c | 1 +
net/mac80211/iface.c | 35 ++---
net/mac80211/mesh.c | 3 +-
net/mac80211/mlme.c | 6 +-
net/mac80211/rx.c | 14 +-
net/mac80211/sta_info.c | 12 +-
net/sched/sch_fq_codel.c | 2 +-
net/sched/sch_generic.c | 2 +-
net/wireless/core.c | 64 ++++++---
net/wireless/core.h | 3 +
net/wireless/nl80211.c | 52 +++----
net/wireless/scan.c | 24 ++--
net/wireless/sme.c | 6 +-
net/wireless/trace.h | 5 +-
net/wireless/wext-sme.c | 6 +
net/xfrm/xfrm_replay.c | 66 ++++++++-
57 files changed, 793 insertions(+), 611 deletions(-)
^ permalink raw reply
* Re: RX/dropped counter values for tagged packets
From: Ani Sinha @ 2013-04-01 3:17 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Ani Sinha, netdev
In-Reply-To: <1364785789.5113.141.camel@edumazet-glaptop>
On Sun, Mar 31, 2013 at 8:09 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Sun, 2013-03-31 at 18:24 -0700, Ani Sinha wrote:
>
>> So in "another_round", if pt_prev is null at the end of the function
>> (not sure if this can actually happen in reality, but from the code it
>> looks like a possibility), the dropped counts will get incremented.
>>
>
> If packets are dropped, we increment rx_dropped.
>
> Nothing special with vlan, its the same with non tagged packets.
>
> So far so good.
>
Correct. Now if you combine the two cases, we increment the rx count
for tagged packets in vlan_do_receive() and then in "another_round",
if pt_prev is null, we also increment the rx_dropped.
Now I have no issue with that _except_ it seems that when we report
the counter values in /proc, we do so in a way that for a tagged
packet, it seems that there might be a case where we combine the two
numbers so that the same packet results in a single increment of
receive and dropped counters at the same time (see my very first
email).
Hence my confusion.
^ permalink raw reply
* Re: RX/dropped counter values for tagged packets
From: Eric Dumazet @ 2013-04-01 3:09 UTC (permalink / raw)
To: Ani Sinha; +Cc: Ani Sinha, netdev
In-Reply-To: <CAOQZsUj71vX-71S4WhJUmerh5VhtheacXVCkGKpyFEHTG9WBgA@mail.gmail.com>
On Sun, 2013-03-31 at 18:24 -0700, Ani Sinha wrote:
> So in "another_round", if pt_prev is null at the end of the function
> (not sure if this can actually happen in reality, but from the code it
> looks like a possibility), the dropped counts will get incremented.
>
If packets are dropped, we increment rx_dropped.
Nothing special with vlan, its the same with non tagged packets.
So far so good.
^ permalink raw reply
* [PATCH v2] r8169: fix auto speed down issue
From: Hayes Wang @ 2013-04-01 3:02 UTC (permalink / raw)
To: romieu; +Cc: netdev, linux-kernel, bowgotsai, Hayes Wang
In-Reply-To: <1364541062-9024-1-git-send-email-hayeswang@realtek.com>
It would cause no link after suspending or shutdowning when the
nic changes the speed to 10M and connects to a link partner which
forces the speed to 100M.
Check the link partner ability to determine which speed to set.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/ethernet/realtek/r8169.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 28fb50a..bdc03a9 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3818,6 +3818,30 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp)
}
}
+static void rtl_speed_down(struct rtl8169_private *tp)
+{
+ u32 adv;
+ int lpa;
+
+ rtl_writephy(tp, 0x1f, 0x0000);
+ lpa = rtl_readphy(tp, MII_LPA);
+
+ if (lpa & (LPA_10HALF | LPA_10FULL))
+ adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
+ else if (lpa & (LPA_100HALF | LPA_100FULL))
+ adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
+ ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
+ else
+ adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
+ ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
+ (tp->mii.supports_gmii ?
+ ADVERTISED_1000baseT_Half |
+ ADVERTISED_1000baseT_Full : 0);
+
+ rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL,
+ adv);
+}
+
static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
{
void __iomem *ioaddr = tp->mmio_addr;
@@ -3848,9 +3872,7 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp)
if (!(__rtl8169_get_wol(tp) & WAKE_ANY))
return false;
- rtl_writephy(tp, 0x1f, 0x0000);
- rtl_writephy(tp, MII_BMCR, 0x0000);
-
+ rtl_speed_down(tp);
rtl_wol_suspend_quirk(tp);
return true;
--
1.8.1
^ permalink raw reply related
* RE: Bug#565404: linux-image-2.6.26-2-amd64: atl1e: TSO is broken
From: Huang, Xiong @ 2013-04-01 2:51 UTC (permalink / raw)
To: Ben Hutchings
Cc: Anders Boström, netdev@vger.kernel.org,
565404@bugs.debian.org,
Hannes Frederic Sowa (hannes@stressinduktion.org)
In-Reply-To: <1364695805.3557.41.camel@deadeye.wl.decadent.org.uk>
> >
> > I checked windows driver, it does limit the max packet length for TSO
> > windows XP : 32*1024 bytes (include MAC header and all MAC payload). No
> support IP/TCP option.
> > Windows 7: 15, 000 bytes, support IP/TCP option.
>
> If TSO on these devices don't work properly with TCP options then you're
> just going to have to disable it - Linux requires it to support at least the
> timestamp option. I'm not sure about IP options (this really ought to be
> documented).
>
> If there's a length limit lower than 64K, you'll need to set the limit using
> netif_set_gso_max_size() before registering the net device.
>
Ben, thanks for your advice.
I have discussed with windows driver developer and hardware designer, the TSO limitation for win driver is just
For simplifying windows driver due to the buffer length limitation of TX descriptor. The hardware itself has no limitation on
TSO packet length.
BTW. Ip/tcp option is supported as well.
Thanks
Xiong
^ permalink raw reply
* [PATCH Resend] core: should call pskb_expand_head if skb header is cloned in skb_gso_segment in rx path
From: roy.qing.li @ 2013-04-01 2:37 UTC (permalink / raw)
To: netdev; +Cc: amwang
From: Li RongQing <roy.qing.li@gmail.com>
12b0004d1d1 (adjust skb_gso_segment() for calling in rx path) tries to kill warnings
by checking if ip_summed is CHECK_NONE or not in rx path, since if skb_gso_segment()
is called on rx path, and ->ip_summed has different meaning.
but this maybe break skb if skb header is cloned, and not expand the header, since when
step into skb_mac_gso_segment(), which will still check ip_summed with CHECKSUM_PARTIAL,
then do gso_send_check(). and after __skb_gso_segment() in queue_gso_packets() of
openvswitch, queue_userspace_packet() still checks ip_summed with CHECKSUM_PARTIAL,
and do checksum.
so I think it is enough to ignore the warning in rx path.
Cc: Cong Wang <amwang@redhat.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
net/core/dev.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index de930b7..bf0e586 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2269,17 +2269,6 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb,
}
EXPORT_SYMBOL(skb_mac_gso_segment);
-
-/* openvswitch calls this on rx path, so we need a different check.
- */
-static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
-{
- if (tx_path)
- return skb->ip_summed != CHECKSUM_PARTIAL;
- else
- return skb->ip_summed == CHECKSUM_NONE;
-}
-
/**
* __skb_gso_segment - Perform segmentation on skb.
* @skb: buffer to segment
@@ -2294,10 +2283,11 @@ static inline bool skb_needs_check(struct sk_buff *skb, bool tx_path)
struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
netdev_features_t features, bool tx_path)
{
- if (unlikely(skb_needs_check(skb, tx_path))) {
+ if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
int err;
- skb_warn_bad_offload(skb);
+ if (tx_path)
+ skb_warn_bad_offload(skb);
if (skb_header_cloned(skb) &&
(err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next] core: should call pskb_expand_head if skb header is cloned in skb_gso_segment in rx path
From: Cong Wang @ 2013-04-01 2:18 UTC (permalink / raw)
To: RongQing Li; +Cc: David Miller, netdev
In-Reply-To: <CAJFZqHxBWtoiDBP36vkaGJ-sHn5svFjcJ_g-BJcES+ebxFbsCw@mail.gmail.com>
On Mon, 2013-04-01 at 10:07 +0800, RongQing Li wrote:
> Hi Cong:
>
> Could you give some comments for this patch?
I don't see the original path, sorry.
^ permalink raw reply
* [Suggestion] drivers/isdn/divert: break looping, or memory leak by calling kmalloc again
From: Chen Gang @ 2013-04-01 2:11 UTC (permalink / raw)
To: isdn, Jiri Slaby, Jiri Kosina, tilman; +Cc: David Miller, netdev
Hello Maintainers:
in drivers/isdn/divert/isdn_divert.c:
in 'for' looping (line 395..515)
the 'cs' may call kmalloc again (line 453).
it seems need break looping, when get valid 'cs' value (line 509)
please help check, thanks.
gchen.
382 /*************************************************/
383 /* called from common module on an incoming call */
384 /*************************************************/
385 static int isdn_divert_icall(isdn_ctrl *ic)
386 {
387 int retval = 0;
388 unsigned long flags;
389 struct call_struc *cs = NULL;
390 struct deflect_struc *dv;
391 char *p, *p1;
392 u_char accept;
393
394 /* first check the internal deflection table */
395 for (dv = table_head; dv; dv = dv->next) {
396 /* scan table */
397 if (((dv->rule.callopt == 1) && (ic->command == ISDN_STAT_ICALLW)) ||
398 ((dv->rule.callopt == 2) && (ic->command == ISDN_STAT_ICALL)))
399 continue; /* call option check */
400 if (!(dv->rule.drvid & (1L << ic->driver)))
401 continue; /* driver not matching */
402 if ((dv->rule.si1) && (dv->rule.si1 != ic->parm.setup.si1))
403 continue; /* si1 not matching */
404 if ((dv->rule.si2) && (dv->rule.si2 != ic->parm.setup.si2))
405 continue; /* si2 not matching */
406
407 p = dv->rule.my_msn;
408 p1 = ic->parm.setup.eazmsn;
409 accept = 0;
410 while (*p) {
411 /* complete compare */
412 if (*p == '-') {
413 accept = 1; /* call accepted */
414 break;
415 }
416 if (*p++ != *p1++)
417 break; /* not accepted */
418 if ((!*p) && (!*p1))
419 accept = 1;
420 } /* complete compare */
421 if (!accept) continue; /* not accepted */
422
423 if ((strcmp(dv->rule.caller, "0")) ||
424 (ic->parm.setup.phone[0])) {
425 p = dv->rule.caller;
426 p1 = ic->parm.setup.phone;
427 accept = 0;
428 while (*p) {
429 /* complete compare */
430 if (*p == '-') {
431 accept = 1; /* call accepted */
432 break;
433 }
434 if (*p++ != *p1++)
435 break; /* not accepted */
436 if ((!*p) && (!*p1))
437 accept = 1;
438 } /* complete compare */
439 if (!accept) continue; /* not accepted */
440 }
441
442 switch (dv->rule.action) {
443 case DEFLECT_IGNORE:
444 return (0);
445
446 case DEFLECT_ALERT:
447 case DEFLECT_PROCEED:
448 case DEFLECT_REPORT:
449 case DEFLECT_REJECT:
450 if (dv->rule.action == DEFLECT_PROCEED)
451 if ((!if_used) || ((!extern_wait_max) && (!dv->rule.waittime)))
452 return (0); /* no external deflection needed */
453 if (!(cs = kmalloc(sizeof(struct call_struc), GFP_ATOMIC)))
454 return (0); /* no memory */
455 init_timer(&cs->timer);
456 cs->info[0] = '\0';
457 cs->timer.function = deflect_timer_expire;
458 cs->timer.data = (ulong) cs; /* pointer to own structure */
459
460 cs->ics = *ic; /* copy incoming data */
461 if (!cs->ics.parm.setup.phone[0]) strcpy(cs->ics.parm.setup.phone, "0");
462 if (!cs->ics.parm.setup.eazmsn[0]) strcpy(cs->ics.parm.setup.eazmsn, "0");
463 cs->ics.parm.setup.screen = dv->rule.screen;
464 if (dv->rule.waittime)
465 cs->timer.expires = jiffies + (HZ * dv->rule.waittime);
466 else if (dv->rule.action == DEFLECT_PROCEED)
467 cs->timer.expires = jiffies + (HZ * extern_wait_max);
468 else
469 cs->timer.expires = 0;
470 cs->akt_state = dv->rule.action;
471 spin_lock_irqsave(&divert_lock, flags);
472 cs->divert_id = next_id++; /* new sequence number */
473 spin_unlock_irqrestore(&divert_lock, flags);
474 cs->prev = NULL;
475 if (cs->akt_state == DEFLECT_ALERT) {
476 strcpy(cs->deflect_dest, dv->rule.to_nr);
477 if (!cs->timer.expires) {
478 strcpy(ic->parm.setup.eazmsn,
479 "Testtext direct");
480 ic->parm.setup.screen = dv->rule.screen;
481 strlcpy(ic->parm.setup.phone, dv->rule.to_nr, sizeof(ic->parm.setup.phone));
482 cs->akt_state = DEFLECT_AUTODEL; /* delete after timeout */
483 cs->timer.expires = jiffies + (HZ * AUTODEL_TIME);
484 retval = 5;
485 } else
486 retval = 1; /* alerting */
487 } else {
488 cs->deflect_dest[0] = '\0';
489 retval = 4; /* only proceed */
490 }
491 sprintf(cs->info, "%d 0x%lx %s %s %s %s 0x%x 0x%x %d %d %s\n",
492 cs->akt_state,
493 cs->divert_id,
494 divert_if.drv_to_name(cs->ics.driver),
495 (ic->command == ISDN_STAT_ICALLW) ? "1" : "0",
496 cs->ics.parm.setup.phone,
497 cs->ics.parm.setup.eazmsn,
498 cs->ics.parm.setup.si1,
499 cs->ics.parm.setup.si2,
500 cs->ics.parm.setup.screen,
501 dv->rule.waittime,
502 cs->deflect_dest);
503 if ((dv->rule.action == DEFLECT_REPORT) ||
504 (dv->rule.action == DEFLECT_REJECT)) {
505 put_info_buffer(cs->info);
506 kfree(cs); /* remove */
507 return ((dv->rule.action == DEFLECT_REPORT) ? 0 : 2); /* nothing to do */
508 }
509 break;
510
511 default:
512 return (0); /* ignore call */
513 } /* switch action */
514 break;
515 } /* scan_table */
516
517 if (cs) {
518 cs->prev = NULL;
519 spin_lock_irqsave(&divert_lock, flags);
520 cs->next = divert_head;
521 divert_head = cs;
522 if (cs->timer.expires) add_timer(&cs->timer);
523 spin_unlock_irqrestore(&divert_lock, flags);
524
525 put_info_buffer(cs->info);
526 return (retval);
527 } else
528 return (0);
529 } /* isdn_divert_icall */
^ permalink raw reply
* [PATCH] drivers/isdn/divert: beautify code, delete useless 'break'
From: Chen Gang @ 2013-04-01 1:52 UTC (permalink / raw)
To: isdn, Jiri Slaby, 'Jiri Kosina', tilman
Cc: David Miller, netdev@vger.kernel.org >> netdev
delete useless break statements.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
drivers/isdn/divert/isdn_divert.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/isdn/divert/isdn_divert.c b/drivers/isdn/divert/isdn_divert.c
index db432e6..76d505e 100644
--- a/drivers/isdn/divert/isdn_divert.c
+++ b/drivers/isdn/divert/isdn_divert.c
@@ -442,7 +442,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
switch (dv->rule.action) {
case DEFLECT_IGNORE:
return (0);
- break;
case DEFLECT_ALERT:
case DEFLECT_PROCEED:
@@ -511,7 +510,6 @@ static int isdn_divert_icall(isdn_ctrl *ic)
default:
return (0); /* ignore call */
- break;
} /* switch action */
break;
} /* scan_table */
--
1.7.7.6
^ permalink raw reply related
* Re: RX/dropped counter values for tagged packets
From: Ani Sinha @ 2013-04-01 1:24 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Ani Sinha, netdev
In-Reply-To: <1364708664.5113.139.camel@edumazet-glaptop>
On Sat, Mar 30, 2013 at 10:44 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> I don't know, I am not reading this code like you, I see no problem.
>
> If vlan_do_receive() return true, we "goto another_round" to deliver the
> packt to vlan device.
>
> vlan_do_receive() doesn't deliver the packet at all. It only prepares
> the "another_round"
yes, I am with you on this. But let's focus on this "another_round" code.
>
> So if packet is delivered to vlan, we don't increment rx_dropped.
So in "another_round", if pt_prev is null at the end of the function
(not sure if this can actually happen in reality, but from the code it
looks like a possibility), the dropped counts will get incremented.
Does that make sense?
cheers,
ani
^ permalink raw reply
* Re: [net-next PATCH] [RFC] [v2] net: add option to enable error queue packets waking select
From: David Miller @ 2013-03-31 23:45 UTC (permalink / raw)
To: jacob.e.keller; +Cc: netdev, jeffrey.t.kirsher, richardcochran, matthew.vick
In-Reply-To: <20130328211925.7644.15781.stgit@jekeller-hub.jf.intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
Date: Thu, 28 Mar 2013 14:19:25 -0700
> Currently, when a socket receives something on the error queue it only wakes up
> the socket on select if it is in the "read" list, that is the socket has
> something to read. It is useful also to wake the socket if it is in the error
> list, which would enable software to wait on error queue packets without waking
> up for regular data on the socket. The main use case is for receiving
> timestamped transmit packets which return the timestamp to the socket via the
> error queue. This enables an application to select on the socket for the error
> queue only instead of for the regular traffic.
>
> -v2-
> * Added the SO_SELECT_ERR_QUEUE socket option to every architechture specific file
> * Modified every socket poll function that checks error queue
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH 1/1] DM9000B: driver initialization upgrade
From: David Miller @ 2013-03-31 23:45 UTC (permalink / raw)
To: josright123
Cc: wfp5p, matthew, gregkh, joseph_chang, jiri, netdev, linux-kernel
In-Reply-To: <1364548422-3051-1-git-send-email-josright123@gmail.com>
From: Joseph CHANG <josright123@gmail.com>
Date: Fri, 29 Mar 2013 17:13:42 +0800
> Fix bug for DM9000 revision B which contain a DSP PHY
>
> DM9000B use DSP PHY instead previouse DM9000 revisions' analog PHY,
> So need extra change in initialization, For
> explicity PHY Reset and PHY init parameter, and
> first DM9000_NCR reset need NCR_MAC_LBK bit by dm9000_probe().
>
> Following DM9000_NCR reset cause by dm9000_open() clear the
> NCR_MAC_LBK bit.
>
> Without this fix, Power-up FIFO pointers error happen around 2%
> rate among Davicom's customers' boards. With this fix, All above
> cases can be solved.
>
> Signed-off-by: Joseph CHANG <josright123@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH] sh_eth: make 'link' field of 'struct sh_eth_private' *int*
From: David Miller @ 2013-03-31 23:44 UTC (permalink / raw)
To: sergei.shtylyov; +Cc: netdev, nobuhiro.iwamatsu.yj, linux-sh
In-Reply-To: <201304010011.04950.sergei.shtylyov@cogentembedded.com>
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Mon, 1 Apr 2013 00:11:04 +0400
> The 'link' field of 'struct sh_eth_private' has type 'enum phy_state' while the
> 'link' field of 'struct phy_device' is merely *int* (having values 0 and 1) and
> the former field gets assigned from the latter. Make the field match, getting
> rid of incorrectly used PHY_DOWN value in assignments/comparisons.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Applied.
^ permalink raw reply
* Re: [PATCH 2/2] sh_eth: workaround for spurious ECI interrupt
From: David Miller @ 2013-03-31 23:44 UTC (permalink / raw)
To: sergei.shtylyov; +Cc: netdev, nobuhiro.iwamatsu.yj, linux-sh
In-Reply-To: <201303312354.20695.sergei.shtylyov@cogentembedded.com>
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Sun, 31 Mar 2013 23:54:20 +0400
> At least on Renesas R8A7778, EESR.ECI interrupt seems to fire regardless of its
> mask in EESIPR register. I can 100% reproduce it with the following scenario:
> target is booted with 'ip=on' option, and so IP-Config opens SoC Ether device
> but doesn't get a proper reply and then succeeds with on-board SMC chip; then
> I login and try to bring up the SoC Ether device with 'ifconfig', and I get
> an ECI interrupt once request_irq() is called by sh_eth_open() (while interrupt
> mask in EESIPR register is all 0), if that interrupt is accompanied by a pending
> EESR.FRC (frame receive completion) interrupt, I get kernel oops in sh_eth_rx()
> because sh_eth_ring_init() hasn't been called yet!
>
> The solution I worked out is the following: in sh_eth_interrupt(), mask the
> interrupt status from EESR register with the interrupt mask from EESIPR register
> in order not to handle the disabled interrupts -- but forcing EESIPR.M_ECI bit
> in this mask set because we always need to fully handle EESR.ECI interrupt in
> sh_eth_error() in order to quench it (as it doesn't get cleared by just writing
> 1 to the this bit as all the other interrupts).
>
> While at it, remove unneeded initializer for 'intr_status' variable and give it
> *unsigned long* type, matching the type of sh_eth_read()'s result; fix comment.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Reviewed-by: Max Filippov <max.filippov@cogentembedded.com>
Applied.
^ permalink raw reply
* Re: [PATCH 1/2] sh_eth: fix handling of no LINK signal
From: David Miller @ 2013-03-31 23:44 UTC (permalink / raw)
To: sergei.shtylyov; +Cc: netdev, nobuhiro.iwamatsu.yj, linux-sh
In-Reply-To: <201303312350.08153.sergei.shtylyov@cogentembedded.com>
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Sun, 31 Mar 2013 23:50:07 +0400
> The code handling the absent LINK signal (or the absent PSR register -- which
> reflects the state of this signal) is quite naive and has probably never really
> worked. It's probably enough to say that this code is executed only on the LINK
> change interrupt (sic!) but even if we actually have the signal and choose to
> ignore it (it might be connected to PHY's link/activity LED output as on the
> Renesas BOCK-W board), sh_eth_adjust_link() on which this code relies to update
> 'mdp->link' gets executed later than the LINK change interrupt where it is
> checked, and so RX/TX never get enabled via ECMR register.
>
> So, ignore the LINK changed interrupt iff LINK signal is absent (or just chosen
> not to be used) or PSR register is absent, and enable/disable RX/TX directly in
> sh_eth_adjust_link() in this case.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Applied.
^ permalink raw reply
* Re: Bug#565404: linux-image-2.6.26-2-amd64: atl1e: TSO is broken
From: Hannes Frederic Sowa @ 2013-03-31 21:11 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Anders Boström, Jie.Yang, netdev, 565404, Xiong.Huang
In-Reply-To: <1364689558.3557.22.camel@deadeye.wl.decadent.org.uk>
On Sun, Mar 31, 2013 at 12:25:58AM +0000, Ben Hutchings wrote:
> On Tue, 2010-01-26 at 09:34 +0100, Anders Boström wrote:
> > >>>>> "JY" == Jie Yang <Jie.Yang@Atheros.com> writes:
> >
> > JY> Anders Boström <anders@netinsight.net> wrote:
> >
> > JY> following is my test cese,
> > >>
> > JY> a nfs server server with ar8131chip, device id 1063.
> > >> export /tmp/ dir as the nfs share directory, JY> the client,
> > >> mount the server_ip:/tmp to local dir /mnt/nfs, ust a python
> > >> script to write and read data on the JY>
> > >> /mnt/nfs/testnfs.log. it works fine.
> > >>
> > >> OK, the device-ID in our NFS-server is 1026, rev. b0. So it
> > >> is possible that the problem is specific to that chip/version.
> > JY> oops, its my mistake in writing, my case is 1026 device ID
> >
> > >>
> > JY> Can you give me some advice on how to reproduce this bug??
> > >>
> > >> The only suggestion I have is to try to find a board with a
> > >> 1026-chip on it.
> > >>
> > >> My test-case is just copy of a 1 Gbyte file from the
> > >> NFS-server to /dev/null , after making sure that the file
> > >> isn't cached on the client by reading huge amounts of other data.
> > >>
> > JY> just to check, if the kernel version is 2.6.26-2 ??
> >
> > I've tested with
> > Debian linux-image-2.6.26-2-amd64 version 2.6.26-19lenny2,
> > Debian linux-image-2.6.30-bpo.2-amd64 version 2.6.30-8~bpo50+2 and
> > kernel.org 2.6.30.10 amd64 with ethtool patch for setting of tso. Same
> > result.
>
> Does booting with the kernel parameter 'pci=nomsi' avoid the problem?
Thanks Ben for bringing this up.
I'll have a look if I can reproduce it in the next days and if I'll try to
find a workaround.
^ permalink raw reply
* Freescale FEC: fall back to random address
From: Pavel Machek @ 2013-03-31 21:06 UTC (permalink / raw)
To: kernel list, fabio.estevam, l.stach, Frank.Li, netdev
If there's no valid ethernet address, fall back to randomly generated
one.
(Yes, I need to get newer u-boot for the board, but as the only
available one is from 2009... this might be good idea).
Signed-off-by: Pavel Machek <pavel@denx.de>
index e3f3937..5a7d1e1 100644
pp--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -906,6 +914,16 @@ static void fec_get_mac(struct net_device *ndev)
iap = &tmpaddr[0];
}
+ /*
+ * 5) random mac address
+ */
+ if (!is_valid_ether_addr(iap)) {
+ /* Report it and use a random ethernet address instead */
+ netdev_err(ndev, "Invalid MAC address: %pM\n", iap);
+ random_ether_addr(iap);
+ netdev_info(ndev, "Using random MAC address: %pM\n", iap);
+ }
+
memcpy(ndev->dev_addr, iap, ETH_ALEN);
/* Adjust MAC if using macaddr */
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply
* [PATCH] sh_eth: make 'link' field of 'struct sh_eth_private' *int*
From: Sergei Shtylyov @ 2013-03-31 20:11 UTC (permalink / raw)
To: netdev; +Cc: nobuhiro.iwamatsu.yj, linux-sh
The 'link' field of 'struct sh_eth_private' has type 'enum phy_state' while the
'link' field of 'struct phy_device' is merely *int* (having values 0 and 1) and
the former field gets assigned from the latter. Make the field match, getting
rid of incorrectly used PHY_DOWN value in assignments/comparisons.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
The patch is against David Miller's 'net-next.git' repo.
drivers/net/ethernet/renesas/sh_eth.c | 8 ++++----
drivers/net/ethernet/renesas/sh_eth.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -1674,7 +1674,7 @@ static void sh_eth_adjust_link(struct ne
struct phy_device *phydev = mdp->phydev;
int new_state = 0;
- if (phydev->link != PHY_DOWN) {
+ if (phydev->link) {
if (phydev->duplex != mdp->duplex) {
new_state = 1;
mdp->duplex = phydev->duplex;
@@ -1688,7 +1688,7 @@ static void sh_eth_adjust_link(struct ne
if (mdp->cd->set_rate)
mdp->cd->set_rate(ndev);
}
- if (mdp->link == PHY_DOWN) {
+ if (!mdp->link) {
sh_eth_write(ndev,
(sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR);
new_state = 1;
@@ -1696,7 +1696,7 @@ static void sh_eth_adjust_link(struct ne
}
} else if (mdp->link) {
new_state = 1;
- mdp->link = PHY_DOWN;
+ mdp->link = 0;
mdp->speed = 0;
mdp->duplex = -1;
}
@@ -1715,7 +1715,7 @@ static int sh_eth_phy_init(struct net_de
snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT,
mdp->mii_bus->id , mdp->phy_id);
- mdp->link = PHY_DOWN;
+ mdp->link = 0;
mdp->speed = 0;
mdp->duplex = -1;
Index: net-next/drivers/net/ethernet/renesas/sh_eth.h
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.h
+++ net-next/drivers/net/ethernet/renesas/sh_eth.h
@@ -503,7 +503,7 @@ struct sh_eth_private {
u32 phy_id; /* PHY ID */
struct mii_bus *mii_bus; /* MDIO bus control */
struct phy_device *phydev; /* PHY device control */
- enum phy_state link;
+ int link;
phy_interface_t phy_interface;
int msg_enable;
int speed;
^ permalink raw reply
* [PATCH 2/2] sh_eth: workaround for spurious ECI interrupt
From: Sergei Shtylyov @ 2013-03-31 19:54 UTC (permalink / raw)
To: netdev; +Cc: nobuhiro.iwamatsu.yj, linux-sh
At least on Renesas R8A7778, EESR.ECI interrupt seems to fire regardless of its
mask in EESIPR register. I can 100% reproduce it with the following scenario:
target is booted with 'ip=on' option, and so IP-Config opens SoC Ether device
but doesn't get a proper reply and then succeeds with on-board SMC chip; then
I login and try to bring up the SoC Ether device with 'ifconfig', and I get
an ECI interrupt once request_irq() is called by sh_eth_open() (while interrupt
mask in EESIPR register is all 0), if that interrupt is accompanied by a pending
EESR.FRC (frame receive completion) interrupt, I get kernel oops in sh_eth_rx()
because sh_eth_ring_init() hasn't been called yet!
The solution I worked out is the following: in sh_eth_interrupt(), mask the
interrupt status from EESR register with the interrupt mask from EESIPR register
in order not to handle the disabled interrupts -- but forcing EESIPR.M_ECI bit
in this mask set because we always need to fully handle EESR.ECI interrupt in
sh_eth_error() in order to quench it (as it doesn't get cleared by just writing
1 to the this bit as all the other interrupts).
While at it, remove unneeded initializer for 'intr_status' variable and give it
*unsigned long* type, matching the type of sh_eth_read()'s result; fix comment.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Max Filippov <max.filippov@cogentembedded.com>
---
The patch is against the David Miller's 'net.git' repo, however I'm not sure if
it needs to be applied to it and not to 'net-next.git' (it should apply there
with line offsets) since R8A7778 support is not upstream yet.
drivers/net/ethernet/renesas/sh_eth.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
Index: net/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net/drivers/net/ethernet/renesas/sh_eth.c
@@ -1324,12 +1324,18 @@ static irqreturn_t sh_eth_interrupt(int
struct sh_eth_private *mdp = netdev_priv(ndev);
struct sh_eth_cpu_data *cd = mdp->cd;
irqreturn_t ret = IRQ_NONE;
- u32 intr_status = 0;
+ unsigned long intr_status;
spin_lock(&mdp->lock);
- /* Get interrpt stat */
+ /* Get interrupt status */
intr_status = sh_eth_read(ndev, EESR);
+ /* Mask it with the interrupt mask, forcing ECI interrupt to be always
+ * enabled since it's the one that comes thru regardless of the mask,
+ * and we need to fully handle it in sh_eth_error() in order to quench
+ * it as it doesn't get cleared by just writing 1 to the ECI bit...
+ */
+ intr_status &= sh_eth_read(ndev, EESIPR) | DMAC_M_ECI;
/* Clear interrupt */
if (intr_status & (EESR_FRC | EESR_RMAF | EESR_RRF |
EESR_RTLF | EESR_RTSF | EESR_PRE | EESR_CERF |
^ permalink raw reply
* [PATCH 1/2] sh_eth: fix handling of no LINK signal
From: Sergei Shtylyov @ 2013-03-31 19:50 UTC (permalink / raw)
To: netdev; +Cc: nobuhiro.iwamatsu.yj, linux-sh
The code handling the absent LINK signal (or the absent PSR register -- which
reflects the state of this signal) is quite naive and has probably never really
worked. It's probably enough to say that this code is executed only on the LINK
change interrupt (sic!) but even if we actually have the signal and choose to
ignore it (it might be connected to PHY's link/activity LED output as on the
Renesas BOCK-W board), sh_eth_adjust_link() on which this code relies to update
'mdp->link' gets executed later than the LINK change interrupt where it is
checked, and so RX/TX never get enabled via ECMR register.
So, ignore the LINK changed interrupt iff LINK signal is absent (or just chosen
not to be used) or PSR register is absent, and enable/disable RX/TX directly in
sh_eth_adjust_link() in this case.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
The patch is against the David Miller's 'net.git' repo.
drivers/net/ethernet/renesas/sh_eth.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: net/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net/drivers/net/ethernet/renesas/sh_eth.c
@@ -1216,10 +1216,7 @@ static void sh_eth_error(struct net_devi
if (felic_stat & ECSR_LCHNG) {
/* Link Changed */
if (mdp->cd->no_psr || mdp->no_ether_link) {
- if (mdp->link == PHY_DOWN)
- link_stat = 0;
- else
- link_stat = PHY_ST_LINK;
+ goto ignore_link;
} else {
link_stat = (sh_eth_read(ndev, PSR));
if (mdp->ether_link_active_low)
@@ -1242,6 +1239,7 @@ static void sh_eth_error(struct net_devi
}
}
+ignore_link:
if (intr_status & EESR_TWB) {
/* Write buck end. unused write back interrupt */
if (intr_status & EESR_TABT) /* Transmit Abort int */
@@ -1392,12 +1390,16 @@ static void sh_eth_adjust_link(struct ne
(sh_eth_read(ndev, ECMR) & ~ECMR_TXF), ECMR);
new_state = 1;
mdp->link = phydev->link;
+ if (mdp->cd->no_psr || mdp->no_ether_link)
+ sh_eth_rcv_snd_enable(ndev);
}
} else if (mdp->link) {
new_state = 1;
mdp->link = PHY_DOWN;
mdp->speed = 0;
mdp->duplex = -1;
+ if (mdp->cd->no_psr || mdp->no_ether_link)
+ sh_eth_rcv_snd_disable(ndev);
}
if (new_state && netif_msg_link(mdp))
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox