* [patch 1/2] qlcnic: clean up qlcnic_init_pci_info()
From: Dan Carpenter @ 2010-08-09 10:36 UTC (permalink / raw)
To: Amit Kumar Salecha
Cc: Anirban Chakraborty, linux-driver, David S. Miller,
Sucheta Chakraborty, netdev, kernel-janitors
In the original code we allocated memory conditionally and freed it in
the error handling unconditionally. It turns out that this function is
only called during initialization and "adapter->npars" and
"adapter->eswitch" are always NULL at the start of the function. I
removed those checks.
Also since I was cleaning things, I changed the error handling for
qlcnic_get_pci_info() and pulled everything in an indent level.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index b9615bd..2b0bc95 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -477,44 +477,45 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
int i, ret = 0, err;
u8 pfn;
- if (!adapter->npars)
- adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) *
+ adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) *
QLCNIC_MAX_PCI_FUNC, GFP_KERNEL);
if (!adapter->npars)
return -ENOMEM;
- if (!adapter->eswitch)
- adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
+ adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
if (!adapter->eswitch) {
err = -ENOMEM;
- goto err_eswitch;
+ goto err_npars;
}
ret = qlcnic_get_pci_info(adapter, pci_info);
- if (!ret) {
- for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
- pfn = pci_info[i].id;
- if (pfn > QLCNIC_MAX_PCI_FUNC)
- return QL_STATUS_INVALID_PARAM;
- adapter->npars[pfn].active = pci_info[i].active;
- adapter->npars[pfn].type = pci_info[i].type;
- adapter->npars[pfn].phy_port = pci_info[i].default_port;
- adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN;
- adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw;
- adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw;
- }
-
- for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
- adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE;
+ if (ret)
+ goto err_eswitch;
- return ret;
+ for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
+ pfn = pci_info[i].id;
+ if (pfn > QLCNIC_MAX_PCI_FUNC)
+ return QL_STATUS_INVALID_PARAM;
+ adapter->npars[pfn].active = pci_info[i].active;
+ adapter->npars[pfn].type = pci_info[i].type;
+ adapter->npars[pfn].phy_port = pci_info[i].default_port;
+ adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN;
+ adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw;
+ adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw;
}
+ for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
+ adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE;
+
+ return 0;
+
+err_eswitch:
kfree(adapter->eswitch);
adapter->eswitch = NULL;
-err_eswitch:
+err_npars:
kfree(adapter->npars);
+ adapter->eswitch = NULL;
return ret;
}
^ permalink raw reply related
* [GIT] Networking
From: David Miller @ 2010-08-09 10:28 UTC (permalink / raw)
To: torvalds; +Cc: akpm, netdev, linux-kernel
1) TX timeout task in netxen driver must take RTNL lock. From
Amit Kumar Salecha.
2) Add missing packet length sanity changes to various packet
scheduler modules that peek at packet contents, from
Changli Gao.
3) Correct ICMP packet peeking in act_nat module, also from
Changli Gao.
4) Locking and memory freeing fixes in isdn gigaset driver from
Dan Carpenter.
5) When TCP hits a md5 option while parsing, it needs to validate
a minimum length. Fix from Dmitry Popov.
6) RX tasklet race fix in solos-pci driver from David Woodhouse.
7) sch_sfq oops fix from Jarek Poplawski.
8) Fix ixgbe build with FCOE disabled, from John Fastabend.
9) iwlwifi locking fixes from Johannes Berg.
10) Mimick memory barrier fixes made to e1000 in e100, e1000e,
igb and ixgbe. From Jeff Kircher.
11) Several ath9k bug fixes via Felix Fietkau.
12) Fix oops in rtl8180_beacon_work, from John W. Linville.
Please pull, thanks a lot!
The following changes since commit 3cfc2c42c1cbc8e238bb9c0612c0df4565e3a8b4:
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial (2010-08-04 15:31:02 -0700)
are available in the git repository at:
master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git master
Amit Kumar Salecha (1):
netxen: protect tx timeout recovery by rtnl lock
Andy Lutomirski (1):
iwlagn: Improve aggregation failure error messages
Changli Gao (6):
act_nat: fix on the TX path
sk_buff: introduce pskb_network_may_pull()
cls_flow: add sanity check for the packet length
cls_rsvp: add sanity check for the packet length
sch_sfq: add sanity check for the packet length
net: disable preemption before call smp_processor_id()
Christian Samsel (1):
usbnet: remove noisy and hardly useful printk
Christoph Fritz (1):
wireless: ipw2100: check result of kzalloc()
Dan Carpenter (3):
isdn: fix information leak
isdn: gigaset: add missing unlock
isdn: gigaset: use after free
Dan Williams (3):
libertas: get the right # of scanned BSSes
libertas: fix association with some APs by using extended rates
libertas: scan before assocation if no BSSID was given
David Howells (1):
RxRPC: Fix a potential deadlock between the call resend_timer and state_lock
David Miller (1):
Bluetooth: Use list_head for HCI blacklist head
David S. Miller (1):
Merge branch 'master' of git://git.kernel.org/.../linville/wireless-2.6
David Woodhouse (1):
solos-pci: Fix race condition in tasklet RX handling
Dmitry Popov (1):
tcp: no md5sig option size check bug
Felix Fietkau (7):
ath9k_hw: clean up and fix initial noise floor calibration
ath9k_hw: fix periodic noise floor calibration on AR9003
ath9k: fix a crash in the PA predistortion apply function
ath9k_hw: fix analog shift register writes on AR9003
ath9k: prevent calibration during off-channel activity
ath9k_hw: clean up per-channel calibration data
ath9k_hw: fix a noise floor calibration related race condition
Gustavo F. Padovan (2):
Bluetooth: Remove __exit from rfcomm_cleanup_ttys()
Bluetooth: Don't send RFC for Basic Mode if only it is supported
Jan Friedrich (1):
ath9k: fix erased ieee80211_rx_status.mactime
Jarek Poplawski (2):
net: Fix napi_gro_frags vs netpoll path
pkt_sched: Fix sch_sfq vs tcf_bind_filter oops
Jeff Kirsher (3):
e100/e1000*/igb*/ixgb*: Add missing read memory barrier
igb.txt: Add igb documentation
igbvf.txt: Add igbvf Documentation
Joe Perches (1):
drivers/net/enic: Use %pUB to format a UUID
Johannes Berg (5):
iwlwifi: fix possible recursive locking deadlock
mac80211: fix scan locking wrt. hw scan
iwlwifi: fix compile warning
iwlwifi: fix TX tracer
iwlwifi: fix locking assertions
John Fastabend (1):
ixgbe: fix build error with FCOE_CONFIG without DCB_CONFIG
John W. Linville (2):
Merge branch 'master' of git://git.kernel.org/.../holtmann/bluetooth-next-2.6
rtl8180: avoid potential NULL deref in rtl8180_beacon_work
Juuso Oikarinen (1):
mac80211: Fix compilation warning when CONFIG_INET is not set
Kulikov Vasiliy (5):
net: wl12xx: do not use kfree'd memory
rt2x00: do not use PCI resources before pci_enable_device()
cxgb3: do not use PCI resources before pci_enable_device()
cxgb4vf: do not use PCI resources before pci_enable_device()
via-velocity: do not use PCI resources before pci_enable_device()
Larry Finger (1):
p54pci: Add PCI ID for SMC2802W
Lorenzo Bianconi (1):
ath9k: fix an issue in ath_atx_tid paused flag management
Luis R. Rodriguez (1):
ath9k_hw: Fix regulatory CTL index usage for AR9003
Rusty Russell (1):
virtio_net: implements ethtool_ops.get_drvinfo
Stefan Weil (1):
davinci_emac: Fix use after free in davinci_emac_remove
Sujith (1):
ath9k: Remove myself from the MAINTAINERS list
Ville Tervo (1):
Bluetooth: Check result code of L2CAP information response
Wey-Yi Guy (2):
iwlwifi: BA scd_flow not match condition detected
iwlagn: fix typo in ucode_bt_stats_read debugfs
stephen hemminger (1):
ppp: make channel_ops const
Documentation/networking/igb.txt | 132 ++++++++
Documentation/networking/igbvf.txt | 78 +++++
MAINTAINERS | 1 -
drivers/atm/solos-pci.c | 7 +-
drivers/char/pcmcia/ipwireless/network.c | 2 +-
drivers/isdn/gigaset/bas-gigaset.c | 6 +-
drivers/isdn/gigaset/capi.c | 1 +
drivers/isdn/sc/ioctl.c | 10 +-
drivers/net/cxgb3/cxgb3_main.c | 25 +-
drivers/net/cxgb4vf/cxgb4vf_main.c | 31 +-
drivers/net/davinci_emac.c | 2 +-
drivers/net/e100.c | 2 +
drivers/net/e1000/e1000_main.c | 3 +
drivers/net/e1000e/netdev.c | 4 +
drivers/net/enic/enic_main.c | 17 +-
drivers/net/igb/igb_main.c | 2 +
drivers/net/igbvf/netdev.c | 2 +
drivers/net/ixgb/ixgb_main.c | 2 +
drivers/net/ixgbe/ixgbe_main.c | 15 +-
drivers/net/ixgbevf/ixgbevf_main.c | 2 +
drivers/net/netxen/netxen_nic_main.c | 15 +-
drivers/net/ppp_async.c | 6 +-
drivers/net/ppp_synctty.c | 6 +-
drivers/net/pppoe.c | 4 +-
drivers/net/usb/usbnet.c | 1 -
drivers/net/via-velocity.c | 4 +-
drivers/net/virtio_net.c | 14 +
drivers/net/wireless/ath/ath9k/ar9002_calib.c | 43 ++-
drivers/net/wireless/ath/ath9k/ar9003_calib.c | 18 +-
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 388 +++++++++++++++++++++++-
drivers/net/wireless/ath/ath9k/ar9003_paprd.c | 17 +-
drivers/net/wireless/ath/ath9k/ar9003_phy.c | 6 +-
drivers/net/wireless/ath/ath9k/ath9k.h | 3 +-
drivers/net/wireless/ath/ath9k/calib.c | 118 ++++----
drivers/net/wireless/ath/ath9k/calib.h | 8 +-
drivers/net/wireless/ath/ath9k/htc.h | 2 +
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 10 +-
drivers/net/wireless/ath/ath9k/hw.c | 25 +-
drivers/net/wireless/ath/ath9k/hw.h | 25 +-
drivers/net/wireless/ath/ath9k/main.c | 104 ++++---
drivers/net/wireless/ath/ath9k/recv.c | 10 +-
drivers/net/wireless/ath/ath9k/xmit.c | 36 +--
drivers/net/wireless/ipw2x00/ipw2100.c | 4 +
drivers/net/wireless/iwlwifi/iwl-agn-debugfs.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 11 +-
drivers/net/wireless/iwlwifi/iwl-agn-tx.c | 11 +-
drivers/net/wireless/iwlwifi/iwl-core.c | 6 +-
drivers/net/wireless/iwlwifi/iwl-debug.h | 2 +-
drivers/net/wireless/iwlwifi/iwl-devtrace.h | 2 +-
drivers/net/wireless/iwlwifi/iwl-scan.c | 2 +-
drivers/net/wireless/iwlwifi/iwl-sta.c | 6 +-
drivers/net/wireless/libertas/cfg.c | 214 ++++++++++---
drivers/net/wireless/libertas/dev.h | 5 +
drivers/net/wireless/libertas/main.c | 1 +
drivers/net/wireless/p54/p54pci.c | 2 +
drivers/net/wireless/rt2x00/rt2x00pci.c | 21 +-
drivers/net/wireless/rtl818x/rtl8180_dev.c | 2 +
drivers/net/wireless/wl12xx/wl1271_spi.c | 3 +-
include/linux/ppp_channel.h | 2 +-
include/linux/skbuff.h | 5 +
include/net/bluetooth/hci_core.h | 2 +-
net/atm/pppoatm.c | 2 +-
net/bluetooth/hci_core.c | 2 +-
net/bluetooth/hci_sock.c | 8 +-
net/bluetooth/hci_sysfs.c | 3 +-
net/bluetooth/l2cap.c | 24 ++-
net/bluetooth/rfcomm/tty.c | 2 +-
net/core/dev.c | 7 +-
net/ipv4/tcp_input.c | 2 +-
net/irda/irnet/irnet_ppp.c | 2 +-
net/l2tp/l2tp_ppp.c | 5 +-
net/mac80211/main.c | 2 +
net/mac80211/scan.c | 14 -
net/rxrpc/ar-ack.c | 3 +
net/rxrpc/ar-call.c | 6 +-
net/sched/act_nat.c | 23 +-
net/sched/cls_flow.c | 96 ++++---
net/sched/cls_rsvp.h | 12 +-
net/sched/sch_sfq.c | 36 ++-
80 files changed, 1311 insertions(+), 450 deletions(-)
create mode 100644 Documentation/networking/igb.txt
create mode 100644 Documentation/networking/igbvf.txt
^ permalink raw reply
* RE: [PATCH] [Bug 16494] NFS client over TCP hangs due to packet loss
From: Andy Chittenden @ 2010-08-09 9:27 UTC (permalink / raw)
To: 'Andy Chittenden', 'Trond Myklebust'
Cc: 'Andrew Morton', 'David Miller', kuznet, pekkas,
jmorris, yoshfuji, kaber, eric.dumazet, William.Allen.Simpson,
gilad, ilpo.jarvinen, netdev, linux-kernel, linux-nfs,
'J. Bruce Fields', 'Neil Brown',
'Chuck Lever', 'Benny Halevy',
'Alexandros Batsakis', 'Joe Perches',
Andy Chittenden
In-Reply-To: <4c5bd64a.4a2ae30a.0283.0551@mx.google.com>
> > On Thu, 2010-08-05 at 15:55 +0100, Andy Chittenden wrote:
> > > > On 2010-08-03 10:11, Andrew Morton wrote:
> > > > > (cc linux-nfs)
> > > > >
> > > > > On Tue, 03 Aug 2010 01:21:44 -0700 (PDT) David
> > > > Miller<davem@davemloft.net> wrote:
> > > > >
> > > > >> From: "Andy Chittenden"<andyc.bluearc@gmail.com>
> > > > >> Date: Tue, 3 Aug 2010 09:14:31 +0100
> > > > >>
> > > > >>> I don't know whether this patch is the correct fix or not but
> > it
> > > > enables the
> > > > >>> NFS client to recover.
> > > > >>>
> > > > >>> Kernel version: 2.6.34.1 and 2.6.32.
> > > > >>>
> > > > >>> Fixes<https://bugzilla.kernel.org/show_bug.cgi?id=16494>. It
> > clears
> > > > down
> > > > >>> any previous shutdown attempts so that reconnects on a socket
> > > > that's been
> > > > >>> shutdown leave the socket in a usable state (otherwise
> > > > tcp_sendmsg() returns
> > > > >>> -EPIPE).
> > > > >>
> > > > >> If the SunRPC code wants to close a TCP socket then use it
> > again,
> > > > >> it should disconnect by doing a connect() with sa_family ==
> > > > AF_UNSPEC
> > > >
> > > > There is code to do that in the SunRPC code in
> > xs_abort_connection()
> > > > but
> > > > that's conditionally called from xs_tcp_reuse_connection():
> > > >
> > > > static void xs_tcp_reuse_connection(struct rpc_xprt *xprt, struct
> > > > sock_xprt *transport)
> > > > {
> > > > unsigned int state = transport->inet->sk_state;
> > > >
> > > > if (state == TCP_CLOSE && transport->sock->state ==
> > > > SS_UNCONNECTED)
> > > > return;
> > > > if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
> > > > return;
> > > > xs_abort_connection(xprt, transport);
> > > > }
> > > >
> > > > That's changed since 2.6.26 where it unconditionally did the
> > connect()
> > > > with sa_family == AF_UNSPEC. FWIW we cannot reproduce this
> problem
> > with
> > > > 2.6.26.
> > >
> > > The problem is fixed with this patch which also prints out that
> > sk_shutdown
> > > can be non-zero on entry to xs_tcp_reuse_connection:
> > >
> > > # diff -up /home/company/software/src/linux-
> > 2.6.34.2/net/sunrpc/xprtsock.c
> > > net/sunrpc/xprtsock.c
> > > --- /home/company/software/src/linux-2.6.34.2/net/sunrpc/xprtsock.c
> > > 2010-08-02 18:30:51.000000000 +0100
> > > +++ net/sunrpc/xprtsock.c 2010-08-05 12:21:11.000000000 +0100
> > > @@ -1322,10 +1322,11 @@ static void xs_tcp_state_change(struct s
> > > if (!(xprt = xprt_from_sock(sk)))
> > > goto out;
> > > dprintk("RPC: xs_tcp_state_change client %p...\n",
> > xprt);
> > > - dprintk("RPC: state %x conn %d dead %d zapped %d\n",
> > > + dprintk("RPC: state %x conn %d dead %d zapped %d
> > sk_shutdown
> > > %d\n",
> > > sk->sk_state, xprt_connected(xprt),
> > > sock_flag(sk, SOCK_DEAD),
> > > - sock_flag(sk, SOCK_ZAPPED));
> > > + sock_flag(sk, SOCK_ZAPPED),
> > > + sk->sk_shutdown);
> > >
> > > switch (sk->sk_state) {
> > > case TCP_ESTABLISHED:
> > > @@ -1796,10 +1797,18 @@ static void xs_tcp_reuse_connection(stru
> > > {
> > > unsigned int state = transport->inet->sk_state;
> > >
> > > - if (state == TCP_CLOSE && transport->sock->state ==
> > SS_UNCONNECTED)
> > > - return;
> > > - if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
> > > - return;
> > > + if (state == TCP_CLOSE && transport->sock->state ==
> > SS_UNCONNECTED)
> > > {
> > > + if (transport->inet->sk_shutdown == 0)
> > > + return;
> > > + printk("%s: TCP_CLOSEd and sk_shutdown set to
> %d\n",
> > > + __func__, transport->inet->sk_shutdown);
> > > + }
> > > + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) {
> > > + if (transport->inet->sk_shutdown == 0)
> > > + return;
> > > + printk("%s: sk_shutdown set to %d\n",
> > > + __func__, transport->inet->sk_shutdown);
> > > + }
> > > xs_abort_connection(xprt, transport);
> > > }
> > >
> > > Signed-off-by: Andy Chittenden <andyc.bluearc@gmail.com>
> > >
> > > dmesg displays:
> > >
> > > [ 2840.896043] xs_tcp_reuse_connection: TCP_CLOSEd and sk_shutdown
> > set to 2
> > >
> > > so previously the code was attempting to reuse the connection but
> > wasn't
> > > aborting it and thus didn't clear down sk_shutdown.
> >
> > Hi Andy,
> >
> > I note that you are adding in two new printk()s. Why should they be
> > printk(), and not dprintk()? Are you trying to report an exception
> that
> > the user needs to be aware of, or is this only debugging info that
> > we'll
> > want to turn off under normal operation?
>
> Hi Trond
>
> Thanks for replying. It was debugging info: the printk()s show what the
> problem is. I was half expecting someone to pipe up "that isn't the
> correct way to fix this" and suggest another avenue to look at, or
> even, hopefully, come up with an alternative appropriate patch as I'm
> not an expert in this code: I don't know whether the sk_shutdown field
> being left set has implications elsewhere in the sunrpc code. FWIW I
> left the test case running overnight and have had only 50 such messages
> logged so it's not a heavy printk() load.
>
> >
> > Also, it might be useful to add a comment to the code here to remind
> us
> > what the 'sk_shutdown == 0' case corresponds to as far as the socket
> > state is concerned, so that the casual reader can see why we
> shouldn't
> > reset the connection.
>
> If I knew what sk_shutdown == 0 really corresponded to, I could well
> add a comment! :-). I just knew that in 2.6.26 we didn't see this
> problem and that in later kernels the connection abort sequence was
> being done conditionally and that the sk_shutdown flag being left set
> was making tcp_sendmsg return an error. So, putting two and two
> together, I've effectively just added another condition in which to
> abort the connection.
>
> As nobody has objected to the essence of my patch, I'll attempt a new
> patch that changes those printk()s into dprintk() and drop in what I
> think are appropriate comments. So here's a revised patch:
>
> # diff -up /home/company/software/src/linux-
> 2.6.34.2/net/sunrpc/xprtsock.c net/sunrpc/xprtsock.c
> --- /home/company/software/src/linux-2.6.34.2/net/sunrpc/xprtsock.c
> 2010-08-02 18:30:51.000000000 +0100
> +++ net/sunrpc/xprtsock.c 2010-08-06 08:09:08.000000000 +0100
> @@ -1322,10 +1322,11 @@ static void xs_tcp_state_change(struct s
> if (!(xprt = xprt_from_sock(sk)))
> goto out;
> dprintk("RPC: xs_tcp_state_change client %p...\n", xprt);
> - dprintk("RPC: state %x conn %d dead %d zapped %d\n",
> + dprintk("RPC: state %x conn %d dead %d zapped %d
> sk_shutdown %d\n",
> sk->sk_state, xprt_connected(xprt),
> sock_flag(sk, SOCK_DEAD),
> - sock_flag(sk, SOCK_ZAPPED));
> + sock_flag(sk, SOCK_ZAPPED),
> + sk->sk_shutdown);
>
> switch (sk->sk_state) {
> case TCP_ESTABLISHED:
> @@ -1796,10 +1797,25 @@ static void xs_tcp_reuse_connection(stru
> {
> unsigned int state = transport->inet->sk_state;
>
> - if (state == TCP_CLOSE && transport->sock->state ==
> SS_UNCONNECTED)
> - return;
> - if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT))
> - return;
> + if (state == TCP_CLOSE && transport->sock->state ==
> SS_UNCONNECTED) {
> + /* we don't need to abort the connection if the socket
> + * hasn't undergone a shutdown
> + */
> + if (transport->inet->sk_shutdown == 0)
> + return;
> + dprintk("RPC: %s: TCP_CLOSEd and sk_shutdown set
> to %d\n",
> + __func__, transport->inet->sk_shutdown);
> + }
> + if ((1 << state) & (TCPF_ESTABLISHED|TCPF_SYN_SENT)) {
> + /* we don't need to abort the connection if the socket
> + * hasn't undergone a shutdown
> + */
> + if (transport->inet->sk_shutdown == 0)
> + return;
> + dprintk("RPC: %s: ESTABLISHED/SYN_SENT "
> + "sk_shutdown set to %d\n",
> + __func__, transport->inet-
> >sk_shutdown);
> + }
> xs_abort_connection(xprt, transport);
> }
>
> Signed-off-by: Andy Chittenden <andyc.bluearc@gmail.com>
>
A weekend run with that patch applied to 2.6.34.2 was successful. As nobody has objected, what's the next step to getting it applied to the official source trees?
^ permalink raw reply
* dccp-test tree [Patch v2 1/1] dccp: Refine the wait-for-ccid mechanism
From: Gerrit Renker @ 2010-08-09 5:59 UTC (permalink / raw)
To: dccp; +Cc: netdev
This change _only_ affects the DCCP test tree at git://eden-feed.erg.abdn.ac.uk
The change below avoids futile timer modifications when rate-based CCIDs 3/4
are used. The timer is set by the CCID congestion control to limit the number
of outgoing packets.
Once the timer expires, as many packets are taken off the tx queue as allowed
by the current rate of the TX CCID. Calling dccp_write_xmit() before the timer
expires is futile since it will merely cause the timer to be reset.
The degree of useless activity increases according to the amount of data to
send. In the worst case the first packet in the tx queue causes the timer to
be set, and the n-1 remaining packets merely retrigger this event.
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -731,7 +731,13 @@ int dccp_sendmsg(struct kiocb *iocb, str
goto out_discard;
skb_queue_tail(&sk->sk_write_queue, skb);
- dccp_write_xmit(sk);
+ /*
+ * The xmit_timer is set if the TX CCID is rate-based and will expire
+ * when congestion control permits to release further packets into the
+ * network. Window-based CCIDs do not use this timer.
+ */
+ if (!timer_pending(&dp->dccps_xmit_timer))
+ dccp_write_xmit(sk);
out_release:
release_sock(sk);
return rc ? : len;
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Patch v2 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
dccp: Refine the wait-for-ccid mechanism
This extends the existing wait-for-ccid routine so that it may be used with
different types of CCID. It further addresses the problems listed below.
The code looks if the write queue is non-empty and grants the TX CCID up to
`timeout' jiffies to drain the queue. It will instead purge that queue if
* the delay suggested by the CCID exceeds the time budget;
* a socket error occurred while waiting for the CCID;
* there is a signal pending (eg. annoyed user pressed Control-C);
* the CCID does not support delays (we don't know how long it will take).
D e t a i l s [can be removed]
-------------------------------
DCCP's sending mechanism acts similar to non-blocking I/O: dccp_sendmsg() will
enqueue up to net.dccp.default.tx_qlen packets (default=5), without waiting for
them to be released to the network.
Rate-based CCIDs, such as CCID-3/4, can impose sending delays of up to maximally
64 seconds (t_mbi in RFC 5348). Hence the write queue may still contain packets
when the application closes. Since the write queue is congestion-controlled by
the CCID, draining the queue is also under control of the CCID.
There are several problems to address here:
1) The queue-drain mechanism only works with rate-based CCIDs. If CCID-2 for
example has a full TX queue and becomes network-limited just as the
application wants to close, then waiting for CCID-2 to become unblocked could
lead to an indefinite delay (i.e., application "hangs").
2) Since each TX CCID in turn uses a feedback mechanism, there may be changes
in its sending policy while the queue is being drained. This can lead to
further delays during which the application will not be able to terminate.
3) The minimum wait time for CCID-3/4 can be expected to be the queue length
times the current inter-packet delay. For example if tx_qlen=100 and a delay
of 15 ms is used for each packet, then the application would have to wait
for a minimum of 1.5 seconds before being allowed to exit.
4) There is no way for the user/application to control this behaviour. It would
be good to use the timeout argument of dccp_close() as an upper bound. Then
the maximum time that an application is willing to wait for its CCIDs to can
be set via the SO_LINGER option.
These problems are addressed by giving the CCID a grace period of up to the
`timeout' value.
The wait-for-ccid function is, as before, used when the application
(a) has read all the data in its receive buffer and
(b) if SO_LINGER was set with a non-zero linger time, or
(c) the socket is either in the OPEN (active close) or in the PASSIVE_CLOSEREQ
state (client application closes after receiving CloseReq).
In addition, there is a catch-all case of __skb_queue_purge() after waiting for
the CCID. This is necessary since the write queue may still have data when
(a) the host has been passively-closed,
(b) abnormal termination (unread data, zero linger time),
(c) wait-for-ccid could not finish within the given time limit.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
net/dccp/dccp.h | 5 +-
net/dccp/output.c | 115 ++++++++++++++++++++++++++++++------------------------
net/dccp/proto.c | 21 +++++++++
net/dccp/timer.c | 2
4 files changed, 89 insertions(+), 54 deletions(-)
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -209,49 +209,29 @@ void dccp_write_space(struct sock *sk)
}
/**
- * dccp_wait_for_ccid - Wait for ccid to tell us we can send a packet
+ * dccp_wait_for_ccid - Await CCID send permission
* @sk: socket to wait for
- * @skb: current skb to pass on for waiting
- * @delay: sleep timeout in milliseconds (> 0)
- * This function is called by default when the socket is closed, and
- * when a non-zero linger time is set on the socket. For consistency
+ * @delay: timeout in jiffies
+ * This is used by CCIDs which need to delay the send time in process context.
*/
-static int dccp_wait_for_ccid(struct sock *sk, struct sk_buff *skb, int delay)
+static int dccp_wait_for_ccid(struct sock *sk, unsigned long delay)
{
- struct dccp_sock *dp = dccp_sk(sk);
DEFINE_WAIT(wait);
- unsigned long jiffdelay;
- int rc;
+ long remaining;
- do {
- dccp_pr_debug("delayed send by %d msec\n", delay);
- jiffdelay = msecs_to_jiffies(delay);
-
- prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
-
- sk->sk_write_pending++;
- release_sock(sk);
- schedule_timeout(jiffdelay);
- lock_sock(sk);
- sk->sk_write_pending--;
-
- if (sk->sk_err)
- goto do_error;
- if (signal_pending(current))
- goto do_interrupted;
+ prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
+ sk->sk_write_pending++;
+ release_sock(sk);
- rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb);
- } while ((delay = rc) > 0);
-out:
+ remaining = schedule_timeout(delay);
+
+ lock_sock(sk);
+ sk->sk_write_pending--;
finish_wait(sk_sleep(sk), &wait);
- return rc;
-do_error:
- rc = -EPIPE;
- goto out;
-do_interrupted:
- rc = -EINTR;
- goto out;
+ if (signal_pending(current) || sk->sk_err)
+ return -1;
+ return remaining;
}
/**
@@ -305,7 +285,53 @@ static void dccp_xmit_packet(struct sock
ccid_hc_tx_packet_sent(dp->dccps_hc_tx_ccid, sk, len);
}
-void dccp_write_xmit(struct sock *sk, int block)
+/**
+ * dccp_flush_write_queue - Drain queue at end of connection
+ * Since dccp_sendmsg queues packets without waiting for them to be sent, it may
+ * happen that the TX queue is not empty at the end of a connection. We give the
+ * HC-sender CCID a grace period of up to @time_budget jiffies. If this function
+ * returns with a non-empty write queue, it will be purged later.
+ */
+void dccp_flush_write_queue(struct sock *sk, long *time_budget)
+{
+ struct dccp_sock *dp = dccp_sk(sk);
+ struct sk_buff *skb;
+ long delay, rc;
+
+ while (*time_budget > 0 && (skb = skb_peek(&sk->sk_write_queue))) {
+ rc = ccid_hc_tx_send_packet(dp->dccps_hc_tx_ccid, sk, skb);
+
+ switch (ccid_packet_dequeue_eval(rc)) {
+ case CCID_PACKET_WILL_DEQUEUE_LATER:
+ /*
+ * If the CCID determines when to send, the next sending
+ * time is unknown or the CCID may not even send again
+ * (e.g. remote host crashes or lost Ack packets).
+ */
+ DCCP_WARN("CCID did not manage to send all packets\n");
+ return;
+ case CCID_PACKET_DELAY:
+ delay = msecs_to_jiffies(rc);
+ if (delay > *time_budget)
+ return;
+ rc = dccp_wait_for_ccid(sk, delay);
+ if (rc < 0)
+ return;
+ *time_budget -= (delay - rc);
+ /* check again if we can send now */
+ break;
+ case CCID_PACKET_SEND_AT_ONCE:
+ dccp_xmit_packet(sk);
+ break;
+ case CCID_PACKET_ERR:
+ skb_dequeue(&sk->sk_write_queue);
+ kfree_skb(skb);
+ dccp_pr_debug("packet discarded due to err=%ld\n", rc);
+ }
+ }
+}
+
+void dccp_write_xmit(struct sock *sk)
{
struct dccp_sock *dp = dccp_sk(sk);
struct sk_buff *skb;
@@ -317,19 +343,9 @@ void dccp_write_xmit(struct sock *sk, in
case CCID_PACKET_WILL_DEQUEUE_LATER:
return;
case CCID_PACKET_DELAY:
- if (!block) {
- sk_reset_timer(sk, &dp->dccps_xmit_timer,
- msecs_to_jiffies(rc)+jiffies);
- return;
- }
- rc = dccp_wait_for_ccid(sk, skb, rc);
- if (rc && rc != -EINTR) {
- DCCP_BUG("err=%d after dccp_wait_for_ccid", rc);
- skb_dequeue(&sk->sk_write_queue);
- kfree_skb(skb);
- break;
- }
- /* fall through */
+ sk_reset_timer(sk, &dp->dccps_xmit_timer,
+ jiffies + msecs_to_jiffies(rc));
+ return;
case CCID_PACKET_SEND_AT_ONCE:
dccp_xmit_packet(sk);
break;
@@ -648,7 +664,6 @@ void dccp_send_close(struct sock *sk, co
DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_CLOSE;
if (active) {
- dccp_write_xmit(sk, 1);
dccp_skb_entail(sk, skb);
dccp_transmit_skb(sk, skb_clone(skb, prio));
/*
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -731,7 +731,13 @@ int dccp_sendmsg(struct kiocb *iocb, str
goto out_discard;
skb_queue_tail(&sk->sk_write_queue, skb);
- dccp_write_xmit(sk,0);
+ /*
+ * The xmit_timer is set if the TX CCID is rate-based and will expire
+ * when congestion control permits to release further packets into the
+ * network. Window-based CCIDs do not use this timer.
+ */
+ if (!timer_pending(&dp->dccps_xmit_timer))
+ dccp_write_xmit(sk);
out_release:
release_sock(sk);
return rc ? : len;
@@ -956,9 +962,22 @@ void dccp_close(struct sock *sk, long ti
/* Check zero linger _after_ checking for unread data. */
sk->sk_prot->disconnect(sk, 0);
} else if (sk->sk_state != DCCP_CLOSED) {
+ /*
+ * Normal connection termination. May need to wait if there are
+ * still packets in the TX queue that are delayed by the CCID.
+ */
+ dccp_flush_write_queue(sk, &timeout);
dccp_terminate_connection(sk);
}
+ /*
+ * Flush write queue. This may be necessary in several cases:
+ * - we have been closed by the peer but still have application data;
+ * - abortive termination (unread data or zero linger time),
+ * - normal termination but queue could not be flushed within time limit
+ */
+ __skb_queue_purge(&sk->sk_write_queue);
+
sk_stream_wait_close(sk, timeout);
adjudge_to_death:
--- a/net/dccp/timer.c
+++ b/net/dccp/timer.c
@@ -249,7 +249,7 @@ static void dccp_write_xmitlet(unsigned
if (sock_owned_by_user(sk))
sk_reset_timer(sk, &dccp_sk(sk)->dccps_xmit_timer, jiffies + 1);
else
- dccp_write_xmit(sk, 0);
+ dccp_write_xmit(sk);
bh_unlock_sock(sk);
}
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -243,8 +243,9 @@ extern void dccp_reqsk_send_ack(struct s
extern void dccp_send_sync(struct sock *sk, const u64 seq,
const enum dccp_pkt_type pkt_type);
-extern void dccp_write_xmit(struct sock *sk, int block);
-extern void dccp_write_space(struct sock *sk);
+extern void dccp_write_xmit(struct sock *sk);
+extern void dccp_write_space(struct sock *sk);
+extern void dccp_flush_write_queue(struct sock *sk, long *time_budget);
extern void dccp_init_xmit_timers(struct sock *sk);
static inline void dccp_clear_xmit_timers(struct sock *sk)
^ permalink raw reply
* Re: [PATCH] xfrm: fix a possible leak of dev reference count.
From: David Miller @ 2010-08-09 3:17 UTC (permalink / raw)
To: kzjeef; +Cc: netdev, error27
In-Reply-To: <AANLkTi==t8MGGLDxMLZsHtRoLqwhgNskU83wBw7-+ZyJ@mail.gmail.com>
From: Zhang JieJing <kzjeef@gmail.com>
Date: Sun, 8 Aug 2010 21:34:12 +0800
> call dev_put(dev) on error path.
>
> Signed-off-by: JieJing.Zhang <kzjeef@gmail.com>
There is no leak, the caller will dst_free() the dst and at
such time the device at dst->dev will be released.
^ permalink raw reply
* Re: [net-2.6 PATCH v2 2/2] igbvf.txt: Add igbvf Documentation
From: David Miller @ 2010-08-09 3:03 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, linux-kernel, gospo, bphilips
In-Reply-To: <20100809015431.832.45021.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sun, 08 Aug 2010 18:54:31 -0700
> Adds documentation for the igbvf (igb virtual function driver).
>
> v2:
> - Removed trailing white space
> - Removed Ethtool version info
>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Applied.
^ permalink raw reply
* Re: [net-2.6 PATCH] e100/e1000*/igb*/ixgb*: Add missing read memory barrier
From: David Miller @ 2010-08-09 3:04 UTC (permalink / raw)
To: jeffrey.t.kirsher
Cc: netdev, gospo, bphilips, miltonm, anton, sonnyrao, stable
In-Reply-To: <20100809020230.1087.42749.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sun, 08 Aug 2010 19:02:31 -0700
> Based on patches from Sonny Rao and Milton Miller...
>
> Combined the patches to fix up clean_tx_irq and clean_rx_irq.
>
> The PowerPC architecture does not require loads to independent bytes
> to be ordered without adding an explicit barrier.
>
> In ixgbe_clean_rx_irq we load the status bit then load the packet data.
> With packet split disabled if these loads go out of order we get a
> stale packet, but we will notice the bad sequence numbers and drop it.
...
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [net-2.6 PATCH v2 1/2] igb.txt: Add igb documentation
From: David Miller @ 2010-08-09 3:03 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, linux-kernel, gospo, bphilips
In-Reply-To: <20100809015410.832.85025.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sun, 08 Aug 2010 18:54:11 -0700
> Add documentation for the igb networking driver.
>
> v2:
> - Removed trailing white space
> - Removed Ethtool version info
> - Removed LRO kernel version info
>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Applied.
^ permalink raw reply
* Re: [net-2.6 PATCH] ixgbe: fix build error with FCOE_CONFIG without DCB_CONFIG
From: David Miller @ 2010-08-09 3:03 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, john.r.fastabend
In-Reply-To: <20100809014538.595.63259.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sun, 08 Aug 2010 18:46:15 -0700
> From: John Fastabend <john.r.fastabend@intel.com>
>
> Building ixgbe without DCB_CONFIG and FCOE_CONFIG will cause
> a build error. This resolves the build error by wrapping
> the fcoe.up in CONFIG_IXGBE_DCB ifdefs.
>
> Also frames were being priority VLAN tagged even without DCB
> enabled. This fixes this so that 8021Q priority tags are
> only added with DCB actually enabled.
>
> Reported-by: divya <dipraksh@linux.vnet.ibm.com>
> Reported-by: Jon Mason <jon.mason@exar.com>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> Tested-by: Stephen Ko <stephen.s.ko@intel.com>
> Tested-by: Ross Brattain <ross.b.brattain@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* [net-2.6 PATCH] e100/e1000*/igb*/ixgb*: Add missing read memory barrier
From: Jeff Kirsher @ 2010-08-09 2:02 UTC (permalink / raw)
To: davem
Cc: netdev, gospo, bphilips, Milton Miller, Anton Blanchard,
Sonny Rao, stable, Jeff Kirsher
Based on patches from Sonny Rao and Milton Miller...
Combined the patches to fix up clean_tx_irq and clean_rx_irq.
The PowerPC architecture does not require loads to independent bytes
to be ordered without adding an explicit barrier.
In ixgbe_clean_rx_irq we load the status bit then load the packet data.
With packet split disabled if these loads go out of order we get a
stale packet, but we will notice the bad sequence numbers and drop it.
The problem occurs with packet split enabled where the TCP/IP header
and data are in different descriptors. If the reads go out of order
we may have data that doesn't match the TCP/IP header. Since we use
hardware checksumming this bad data is never verified and it makes it
all the way to the application.
This bug was found during stress testing and adding this barrier has
been shown to fix it. The bug can manifest as a data integrity issue
(bad payload data) or as a BUG in skb_pull().
This was a nasty bug to hunt down, if people agree with the fix I think
it's a candidate for stable.
Previously Submitted to e1000-devel only for ixgbe
http://marc.info/?l=e1000-devel&m=126593062701537&w=3
We've now seen this problem hit with other device drivers (e1000e mostly)
So I'm resubmitting with fixes for other Intel Device Drivers with
similar issues.
CC: Milton Miller <miltonm@bga.com>
CC: Anton Blanchard <anton@samba.org>
CC: Sonny Rao <sonnyrao@us.ibm.com>
CC: stable <stable@kernel.org>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/e100.c | 2 ++
drivers/net/e1000/e1000_main.c | 3 +++
drivers/net/e1000e/netdev.c | 4 ++++
drivers/net/igb/igb_main.c | 2 ++
drivers/net/igbvf/netdev.c | 2 ++
drivers/net/ixgb/ixgb_main.c | 2 ++
drivers/net/ixgbe/ixgbe_main.c | 1 +
drivers/net/ixgbevf/ixgbevf_main.c | 2 ++
8 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index b194bad..8e2eab4 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1779,6 +1779,7 @@ static int e100_tx_clean(struct nic *nic)
for (cb = nic->cb_to_clean;
cb->status & cpu_to_le16(cb_complete);
cb = nic->cb_to_clean = cb->next) {
+ rmb(); /* read skb after status */
netif_printk(nic, tx_done, KERN_DEBUG, nic->netdev,
"cb[%d]->status = 0x%04X\n",
(int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
@@ -1927,6 +1928,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
netif_printk(nic, rx_status, KERN_DEBUG, nic->netdev,
"status=0x%04X\n", rfd_status);
+ rmb(); /* read size after status bit */
/* If data isn't ready, nothing to indicate */
if (unlikely(!(rfd_status & cb_complete))) {
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 02833af..5cc39ed 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3454,6 +3454,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
(count < tx_ring->count)) {
bool cleaned = false;
+ rmb(); /* read buffer_info after eop_desc */
for ( ; !cleaned; count++) {
tx_desc = E1000_TX_DESC(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
@@ -3643,6 +3644,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
if (*work_done >= work_to_do)
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
status = rx_desc->status;
skb = buffer_info->skb;
@@ -3849,6 +3851,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
if (*work_done >= work_to_do)
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
status = rx_desc->status;
skb = buffer_info->skb;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 36d31a4..c3dd590 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -781,6 +781,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
if (*work_done >= work_to_do)
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
status = rx_desc->status;
skb = buffer_info->skb;
@@ -991,6 +992,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
(count < tx_ring->count)) {
bool cleaned = false;
+ rmb(); /* read buffer_info after eop_desc */
for (; !cleaned; count++) {
tx_desc = E1000_TX_DESC(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
@@ -1087,6 +1089,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
break;
(*work_done)++;
skb = buffer_info->skb;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
/* in the packet split case this is header only */
prefetch(skb->data - NET_IP_ALIGN);
@@ -1286,6 +1289,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
if (*work_done >= work_to_do)
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
status = rx_desc->status;
skb = buffer_info->skb;
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index df5dcd2..9b4e589 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -5353,6 +5353,7 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
while ((eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD)) &&
(count < tx_ring->count)) {
+ rmb(); /* read buffer_info after eop_desc status */
for (cleaned = false; !cleaned; count++) {
tx_desc = E1000_TX_DESC_ADV(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
@@ -5558,6 +5559,7 @@ static bool igb_clean_rx_irq_adv(struct igb_q_vector *q_vector,
if (*work_done >= budget)
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
skb = buffer_info->skb;
prefetch(skb->data - NET_IP_ALIGN);
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index ec808fa..c539f7c 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -248,6 +248,7 @@ static bool igbvf_clean_rx_irq(struct igbvf_adapter *adapter,
if (*work_done >= work_to_do)
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
buffer_info = &rx_ring->buffer_info[i];
@@ -780,6 +781,7 @@ static bool igbvf_clean_tx_irq(struct igbvf_ring *tx_ring)
while ((eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD)) &&
(count < tx_ring->count)) {
+ rmb(); /* read buffer_info after eop_desc status */
for (cleaned = false; !cleaned; count++) {
tx_desc = IGBVF_TX_DESC_ADV(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index c6b75c8..45fc89b 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1816,6 +1816,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
while (eop_desc->status & IXGB_TX_DESC_STATUS_DD) {
+ rmb(); /* read buffer_info after eop_desc */
for (cleaned = false; !cleaned; ) {
tx_desc = IXGB_TX_DESC(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
@@ -1976,6 +1977,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
status = rx_desc->status;
skb = buffer_info->skb;
buffer_info->skb = NULL;
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7d6a415..27cc8f8 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -748,6 +748,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
while ((eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)) &&
(count < tx_ring->work_limit)) {
bool cleaned = false;
+ rmb(); /* read buffer_info after eop_desc */
for ( ; !cleaned; count++) {
struct sk_buff *skb;
tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i);
diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
index 3e291cc..918c003 100644
--- a/drivers/net/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ixgbevf/ixgbevf_main.c
@@ -231,6 +231,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter,
while ((eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)) &&
(count < tx_ring->work_limit)) {
bool cleaned = false;
+ rmb(); /* read buffer_info after eop_desc */
for ( ; !cleaned; count++) {
struct sk_buff *skb;
tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i);
@@ -518,6 +519,7 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
break;
(*work_done)++;
+ rmb(); /* read descriptor and rx_buffer_info after status DD */
if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
hdr_info = le16_to_cpu(ixgbevf_get_hdr_info(rx_desc));
len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >>
^ permalink raw reply related
* [net-2.6 PATCH v2 2/2] igbvf.txt: Add igbvf Documentation
From: Jeff Kirsher @ 2010-08-09 1:54 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, gospo, bphilips, Jeff Kirsher
In-Reply-To: <20100809015410.832.85025.stgit@localhost.localdomain>
Adds documentation for the igbvf (igb virtual function driver).
v2:
- Removed trailing white space
- Removed Ethtool version info
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
---
Documentation/networking/igbvf.txt | 80 ++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
create mode 100644 Documentation/networking/igbvf.txt
diff --git a/Documentation/networking/igbvf.txt b/Documentation/networking/igbvf.txt
new file mode 100644
index 0000000..e945472
--- /dev/null
+++ b/Documentation/networking/igbvf.txt
@@ -0,0 +1,80 @@
+Linux* Base Driver for Intel(R) Network Connection
+==================================================
+
+Intel Gigabit Linux driver.
+Copyright(c) 1999 - 2010 Intel Corporation.
+
+Contents
+========
+
+- Identifying Your Adapter
+- Additional Configurations
+- Support
+
+This file describes the igbvf Linux* Base Driver for Intel Network Connection.
+
+The igbvf driver supports 82576-based virtual function devices that can only
+be activated on kernels that support SR-IOV. SR-IOV requires the correct
+platform and OS support.
+
+The igbvf driver requires the igb driver, version 2.0 or later. The igbvf
+driver supports virtual functions generated by the igb driver with a max_vfs
+value of 1 or greater. For more information on the max_vfs parameter refer
+to the README included with the igb driver.
+
+The guest OS loading the igbvf driver must support MSI-X interrupts.
+
+This driver is only supported as a loadable module at this time. Intel is
+not supplying patches against the kernel source to allow for static linking
+of the driver. For questions related to hardware requirements, refer to the
+documentation supplied with your Intel Gigabit adapter. All hardware
+requirements listed apply to use with Linux.
+
+Instructions on updating ethtool can be found in the section "Additional
+Configurations" later in this document.
+
+VLANs: There is a limit of a total of 32 shared VLANs to 1 or more VFs.
+
+Identifying Your Adapter
+========================
+
+The igbvf driver supports 82576-based virtual function devices that can only
+be activated on kernels that support SR-IOV.
+
+For more information on how to identify your adapter, go to the Adapter &
+Driver ID Guide at:
+
+ http://support.intel.com/support/go/network/adapter/idguide.htm
+
+For the latest Intel network drivers for Linux, refer to the following
+website. In the search field, enter your adapter name or type, or use the
+networking link on the left to search for your adapter:
+
+ http://downloadcenter.intel.com/scripts-df-external/Support_Intel.aspx
+
+Additional Configurations
+=========================
+
+ Ethtool
+ -------
+ The driver utilizes the ethtool interface for driver configuration and
+ diagnostics, as well as displaying statistical information.
+
+ http://sourceforge.net/projects/gkernel.
+
+Support
+=======
+
+For general information, go to the Intel support website at:
+
+ http://support.intel.com
+
+or the Intel Wired Networking project hosted by Sourceforge at:
+
+ http://sourceforge.net/projects/e1000
+
+If an issue is identified with the released source code on the supported
+kernel with a supported adapter, email the specific information related
+to the issue to e1000-devel@lists.sf.net
+
+
^ permalink raw reply related
* [net-2.6 PATCH v2 1/2] igb.txt: Add igb documentation
From: Jeff Kirsher @ 2010-08-09 1:54 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, gospo, bphilips, Jeff Kirsher
Add documentation for the igb networking driver.
v2:
- Removed trailing white space
- Removed Ethtool version info
- Removed LRO kernel version info
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
---
Documentation/networking/igb.txt | 132 ++++++++++++++++++++++++++++++++++++++
1 files changed, 132 insertions(+), 0 deletions(-)
create mode 100644 Documentation/networking/igb.txt
diff --git a/Documentation/networking/igb.txt b/Documentation/networking/igb.txt
new file mode 100644
index 0000000..ab2d718
--- /dev/null
+++ b/Documentation/networking/igb.txt
@@ -0,0 +1,132 @@
+Linux* Base Driver for Intel(R) Network Connection
+==================================================
+
+Intel Gigabit Linux driver.
+Copyright(c) 1999 - 2010 Intel Corporation.
+
+Contents
+========
+
+- Identifying Your Adapter
+- Additional Configurations
+- Support
+
+Identifying Your Adapter
+========================
+
+This driver supports all 82575, 82576 and 82580-based Intel (R) gigabit network
+connections.
+
+For specific information on how to identify your adapter, go to the Adapter &
+Driver ID Guide at:
+
+ http://support.intel.com/support/go/network/adapter/idguide.htm
+
+Command Line Parameters
+=======================
+
+The default value for each parameter is generally the recommended setting,
+unless otherwise noted.
+
+max_vfs
+-------
+Valid Range: 0-7
+Default Value: 0
+
+This parameter adds support for SR-IOV. It causes the driver to spawn up to
+max_vfs worth of virtual function.
+
+Additional Configurations
+=========================
+
+ Jumbo Frames
+ ------------
+ Jumbo Frames support is enabled by changing the MTU to a value larger than
+ the default of 1500. Use the ifconfig command to increase the MTU size.
+ For example:
+
+ ifconfig eth<x> mtu 9000 up
+
+ This setting is not saved across reboots.
+
+ Notes:
+
+ - The maximum MTU setting for Jumbo Frames is 9216. This value coincides
+ with the maximum Jumbo Frames size of 9234 bytes.
+
+ - Using Jumbo Frames at 10 or 100 Mbps may result in poor performance or
+ loss of link.
+
+ Ethtool
+ -------
+ The driver utilizes the ethtool interface for driver configuration and
+ diagnostics, as well as displaying statistical information.
+
+ http://sourceforge.net/projects/gkernel.
+
+ Enabling Wake on LAN* (WoL)
+ ---------------------------
+ WoL is configured through the Ethtool* utility.
+
+ For instructions on enabling WoL with Ethtool, refer to the Ethtool man page.
+
+ WoL will be enabled on the system during the next shut down or reboot.
+ For this driver version, in order to enable WoL, the igb driver must be
+ loaded when shutting down or rebooting the system.
+
+ Wake On LAN is only supported on port A of multi-port adapters.
+
+ Wake On LAN is not supported for the Intel(R) Gigabit VT Quad Port Server
+ Adapter.
+
+ Multiqueue
+ ----------
+ In this mode, a separate MSI-X vector is allocated for each queue and one
+ for "other" interrupts such as link status change and errors. All
+ interrupts are throttled via interrupt moderation. Interrupt moderation
+ must be used to avoid interrupt storms while the driver is processing one
+ interrupt. The moderation value should be at least as large as the expected
+ time for the driver to process an interrupt. Multiqueue is off by default.
+
+ REQUIREMENTS: MSI-X support is required for Multiqueue. If MSI-X is not
+ found, the system will fallback to MSI or to Legacy interrupts.
+
+ LRO
+ ---
+ Large Receive Offload (LRO) is a technique for increasing inbound throughput
+ of high-bandwidth network connections by reducing CPU overhead. It works by
+ aggregating multiple incoming packets from a single stream into a larger
+ buffer before they are passed higher up the networking stack, thus reducing
+ the number of packets that have to be processed. LRO combines multiple
+ Ethernet frames into a single receive in the stack, thereby potentially
+ decreasing CPU utilization for receives.
+
+ NOTE: You need to have inet_lro enabled via either the CONFIG_INET_LRO or
+ CONFIG_INET_LRO_MODULE kernel config option. Additionally, if
+ CONFIG_INET_LRO_MODULE is used, the inet_lro module needs to be loaded
+ before the igb driver.
+
+ You can verify that the driver is using LRO by looking at these counters in
+ Ethtool:
+
+ lro_aggregated - count of total packets that were combined
+ lro_flushed - counts the number of packets flushed out of LRO
+ lro_no_desc - counts the number of times an LRO descriptor was not available
+ for the LRO packet
+
+ NOTE: IPv6 and UDP are not supported by LRO.
+
+Support
+=======
+
+For general information, go to the Intel support website at:
+
+ www.intel.com/support/
+
+or the Intel Wired Networking project hosted by Sourceforge at:
+
+ http://sourceforge.net/projects/e1000
+
+If an issue is identified with the released source code on the supported
+kernel with a supported adapter, email the specific information related
+to the issue to e1000-devel@lists.sf.net
^ permalink raw reply related
* [net-2.6 PATCH] ixgbe: fix build error with FCOE_CONFIG without DCB_CONFIG
From: Jeff Kirsher @ 2010-08-09 1:46 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, bphilips, John Fastabend, Jeff Kirsher
From: John Fastabend <john.r.fastabend@intel.com>
Building ixgbe without DCB_CONFIG and FCOE_CONFIG will cause
a build error. This resolves the build error by wrapping
the fcoe.up in CONFIG_IXGBE_DCB ifdefs.
Also frames were being priority VLAN tagged even without DCB
enabled. This fixes this so that 8021Q priority tags are
only added with DCB actually enabled.
Reported-by: divya <dipraksh@linux.vnet.ibm.com>
Reported-by: Jon Mason <jon.mason@exar.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ixgbe/ixgbe_main.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7d6a415..55394a2 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -6155,9 +6155,11 @@ static u16 ixgbe_select_queue(struct net_device *dev, struct sk_buff *skb)
txq &= (adapter->ring_feature[RING_F_FCOE].indices - 1);
txq += adapter->ring_feature[RING_F_FCOE].mask;
return txq;
+#ifdef CONFIG_IXGBE_DCB
} else if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
txq = adapter->fcoe.up;
return txq;
+#endif
}
}
#endif
@@ -6216,10 +6218,14 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb,
if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED &&
(skb->protocol == htons(ETH_P_FCOE) ||
skb->protocol == htons(ETH_P_FIP))) {
- tx_flags &= ~(IXGBE_TX_FLAGS_VLAN_PRIO_MASK
- << IXGBE_TX_FLAGS_VLAN_SHIFT);
- tx_flags |= ((adapter->fcoe.up << 13)
- << IXGBE_TX_FLAGS_VLAN_SHIFT);
+#ifdef CONFIG_IXGBE_DCB
+ if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
+ tx_flags &= ~(IXGBE_TX_FLAGS_VLAN_PRIO_MASK
+ << IXGBE_TX_FLAGS_VLAN_SHIFT);
+ tx_flags |= ((adapter->fcoe.up << 13)
+ << IXGBE_TX_FLAGS_VLAN_SHIFT);
+ }
+#endif
/* flag for FCoE offloads */
if (skb->protocol == htons(ETH_P_FCOE))
tx_flags |= IXGBE_TX_FLAGS_FCOE;
^ permalink raw reply related
* Re: [PATCH 2/2] igbvf.txt: Add igbvf Documentation
From: Jeff Kirsher @ 2010-08-09 0:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-kernel, gospo, bphilips
In-Reply-To: <20100807.230156.25112206.davem@davemloft.net>
On Sat, Aug 7, 2010 at 23:01, David Miller <davem@davemloft.net> wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Tue, 03 Aug 2010 17:16:17 -0700
>
>> Adds documentation for the igbvf (igb virtual function driver).
>>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
>
> Tons of trailing whitespace, GIT nearly craps itself when I try
> to apply this.
>
> Please fix this, and also submit the fixed up 1/1 ixgbe.txt doc patch
> and even more importantly the ixgbe FCOE build fix you promised I'd
> have two nights ago :-)
>
> Thanks.
> --
I will get you everything tonight, sorry about not getting the ixgbe
FCOE build fix when I said I would. I was expecting better internet
connectivity than what I had the last couple of days.
--
Cheers,
Jeff
^ permalink raw reply
* Re: Latest iproute2 breaks "ip route get" command
From: Andreas Henriksson @ 2010-08-08 19:52 UTC (permalink / raw)
To: Fabio Comolli; +Cc: Ulrich Weber, netdev
In-Reply-To: <AANLkTim4h7rTJuF7UWAE-p_4NGkrwksUjoK6m2x5BubG@mail.gmail.com>
On sön, 2010-08-08 at 21:31 +0200, Fabio Comolli wrote:
> Yup, that seems to fix it.
> You can add my Tested-By in case you need it.
I'll let Ulrich Weber confirm it's the right fix and forward to Stephen
Hemminger. Just received an "out of office" notice saying he'll be back
11 august (wednesday), so I guess we'll have to wait a couple of days
for that.
//Andreas
^ permalink raw reply
* [PATCH] cpmac: fix all checkpatch errors and warnings
From: Florian Fainelli @ 2010-08-08 20:09 UTC (permalink / raw)
To: netdev, David Miller
This patches fixes a couple of checkpatch warnings and errors:
- lines over 80 columns
- printk() instead of pr_cont()
- assignments in tests (if ((foo == bar())))
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index e1f6156..fe017eb 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -38,7 +38,7 @@
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
-#include <asm/gpio.h>
+#include <linux/gpio.h>
#include <asm/atomic.h>
MODULE_AUTHOR("Eugene Konev <ejka@imfi.kspu.ru>");
@@ -108,7 +108,7 @@ MODULE_PARM_DESC(dumb_switch, "Assume switch is not connected to MDIO bus");
#define CPMAC_RX_INT_CLEAR 0x019c
#define CPMAC_MAC_INT_ENABLE 0x01a8
#define CPMAC_MAC_INT_CLEAR 0x01ac
-#define CPMAC_MAC_ADDR_LO(channel) (0x01b0 + (channel) * 4)
+#define CPMAC_MAC_ADDR_LO(channel) (0x01b0 + (channel) * 4)
#define CPMAC_MAC_ADDR_MID 0x01d0
#define CPMAC_MAC_ADDR_HI 0x01d4
#define CPMAC_MAC_HASH_LO 0x01d8
@@ -227,7 +227,7 @@ static void cpmac_dump_regs(struct net_device *dev)
for (i = 0; i < CPMAC_REG_END; i += 4) {
if (i % 16 == 0) {
if (i)
- printk("\n");
+ pr_cont("\n");
printk(KERN_DEBUG "%s: reg[%p]:", dev->name,
priv->regs + i);
}
@@ -262,7 +262,7 @@ static void cpmac_dump_skb(struct net_device *dev, struct sk_buff *skb)
for (i = 0; i < skb->len; i++) {
if (i % 16 == 0) {
if (i)
- printk("\n");
+ pr_cont("\n");
printk(KERN_DEBUG "%s: data[%p]:", dev->name,
skb->data + i);
}
@@ -873,7 +873,8 @@ static int cpmac_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
return -EINVAL;
}
-static void cpmac_get_ringparam(struct net_device *dev, struct ethtool_ringparam* ring)
+static void cpmac_get_ringparam(struct net_device *dev,
+ struct ethtool_ringparam *ring)
{
struct cpmac_priv *priv = netdev_priv(dev);
@@ -888,7 +889,8 @@ static void cpmac_get_ringparam(struct net_device *dev, struct ethtool_ringparam
ring->tx_pending = 1;
}
-static int cpmac_set_ringparam(struct net_device *dev, struct ethtool_ringparam* ring)
+static int cpmac_set_ringparam(struct net_device *dev,
+ struct ethtool_ringparam *ring)
{
struct cpmac_priv *priv = netdev_priv(dev);
@@ -1012,8 +1014,8 @@ static int cpmac_open(struct net_device *dev)
priv->rx_head->prev->hw_next = (u32)0;
- if ((res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED,
- dev->name, dev))) {
+ res = request_irq(dev->irq, cpmac_irq, IRQF_SHARED, dev->name, dev);
+ if (res) {
if (netif_msg_drv(priv))
printk(KERN_ERR "%s: failed to obtain irq\n",
dev->name);
@@ -1133,7 +1135,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
}
if (phy_id == PHY_MAX_ADDR) {
- dev_err(&pdev->dev, "no PHY present, falling back to switch on MDIO bus 0\n");
+ dev_err(&pdev->dev, "no PHY present, falling back "
+ "to switch on MDIO bus 0\n");
strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
phy_id = pdev->id;
}
@@ -1169,7 +1172,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
priv->msg_enable = netif_msg_init(debug_level, 0xff);
memcpy(dev->dev_addr, pdata->dev_addr, sizeof(pdata->dev_addr));
- snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
+ snprintf(priv->phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT,
+ mdio_bus_id, phy_id);
priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
PHY_INTERFACE_MODE_MII);
@@ -1182,7 +1186,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
goto fail;
}
- if ((rc = register_netdev(dev))) {
+ rc = register_netdev(dev);
+ if (rc) {
printk(KERN_ERR "cpmac: error %i registering device %s\n", rc,
dev->name);
goto fail;
@@ -1248,11 +1253,13 @@ int __devinit cpmac_init(void)
cpmac_mii->reset(cpmac_mii);
- for (i = 0; i < 300; i++)
- if ((mask = cpmac_read(cpmac_mii->priv, CPMAC_MDIO_ALIVE)))
+ for (i = 0; i < 300; i++) {
+ mask = cpmac_read(cpmac_mii->priv, CPMAC_MDIO_ALIVE);
+ if (mask)
break;
else
msleep(10);
+ }
mask &= 0x7fffffff;
if (mask & (mask - 1)) {
^ permalink raw reply related
* [PATCH] r6040: fix all checkpatch errors and warnings
From: Florian Fainelli @ 2010-08-08 20:08 UTC (permalink / raw)
To: netdev, David Miller
This patch fixes a couple of errors and warnings spotted by checkpatch.pl:
- some lines were over 80 columns
- there were some whitespaces left
The call to printk is now replaced by a call to pr_info and the log-level
included in the driver version is now removed, so there are no longer false
positives on this warning.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 142c381..0a00850 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -200,7 +200,7 @@ struct r6040_private {
int old_duplex;
};
-static char version[] __devinitdata = KERN_INFO DRV_NAME
+static char version[] __devinitdata = DRV_NAME
": RDC R6040 NAPI net driver,"
"version "DRV_VERSION " (" DRV_RELDATE ")";
@@ -224,7 +224,8 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
}
/* Write a word data from PHY Chip */
-static void r6040_phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val)
+static void r6040_phy_write(void __iomem *ioaddr,
+ int phy_addr, int reg, u16 val)
{
int limit = 2048;
u16 cmd;
@@ -348,8 +349,8 @@ static int r6040_alloc_rxbufs(struct net_device *dev)
}
desc->skb_ptr = skb;
desc->buf = cpu_to_le32(pci_map_single(lp->pdev,
- desc->skb_ptr->data,
- MAX_BUF_SIZE, PCI_DMA_FROMDEVICE));
+ desc->skb_ptr->data,
+ MAX_BUF_SIZE, PCI_DMA_FROMDEVICE));
desc->status = DSC_OWNER_MAC;
desc = desc->vndescp;
} while (desc != lp->rx_ring);
@@ -491,12 +492,14 @@ static int r6040_close(struct net_device *dev)
/* Free Descriptor memory */
if (lp->rx_ring) {
- pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
+ pci_free_consistent(pdev,
+ RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
lp->rx_ring = NULL;
}
if (lp->tx_ring) {
- pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
+ pci_free_consistent(pdev,
+ TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
lp->tx_ring = NULL;
}
@@ -547,7 +550,7 @@ static int r6040_rx(struct net_device *dev, int limit)
}
goto next_descr;
}
-
+
/* Packet successfully received */
new_skb = netdev_alloc_skb(dev, MAX_BUF_SIZE);
if (!new_skb) {
@@ -556,13 +559,13 @@ static int r6040_rx(struct net_device *dev, int limit)
}
skb_ptr = descptr->skb_ptr;
skb_ptr->dev = priv->dev;
-
+
/* Do not count the CRC */
skb_put(skb_ptr, descptr->len - 4);
pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev);
-
+
/* Send to upper layer */
netif_receive_skb(skb_ptr);
dev->stats.rx_packets++;
@@ -710,8 +713,10 @@ static int r6040_up(struct net_device *dev)
return ret;
/* improve performance (by RDC guys) */
- r6040_phy_write(ioaddr, 30, 17, (r6040_phy_read(ioaddr, 30, 17) | 0x4000));
- r6040_phy_write(ioaddr, 30, 17, ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000));
+ r6040_phy_write(ioaddr, 30, 17,
+ (r6040_phy_read(ioaddr, 30, 17) | 0x4000));
+ r6040_phy_write(ioaddr, 30, 17,
+ ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000));
r6040_phy_write(ioaddr, 0, 19, 0x0000);
r6040_phy_write(ioaddr, 0, 30, 0x01F0);
@@ -946,7 +951,7 @@ static const struct net_device_ops r6040_netdev_ops = {
.ndo_set_multicast_list = r6040_multicast_list,
.ndo_change_mtu = eth_change_mtu,
.ndo_validate_addr = eth_validate_addr,
- .ndo_set_mac_address = eth_mac_addr,
+ .ndo_set_mac_address = eth_mac_addr,
.ndo_do_ioctl = r6040_ioctl,
.ndo_tx_timeout = r6040_tx_timeout,
#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1039,7 +1044,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
u16 *adrp;
int i;
- printk("%s\n", version);
+ pr_info("%s\n", version);
err = pci_enable_device(pdev);
if (err)
@@ -1113,7 +1118,8 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
/* Some bootloader/BIOSes do not initialize
* MAC address, warn about that */
if (!(adrp[0] || adrp[1] || adrp[2])) {
- netdev_warn(dev, "MAC address not initialized, generating random\n");
+ netdev_warn(dev, "MAC address not initialized, "
+ "generating random\n");
random_ether_addr(dev->dev_addr);
}
^ permalink raw reply related
* Re: Latest iproute2 breaks "ip route get" command
From: Fabio Comolli @ 2010-08-08 19:31 UTC (permalink / raw)
To: Andreas Henriksson; +Cc: Ulrich Weber, netdev
In-Reply-To: <20100808193304.GA15380@amd64.fatal.se>
Yup, that seems to fix it.
You can add my Tested-By in case you need it.
Regards,
Fabio
On Sun, Aug 8, 2010 at 9:33 PM, Andreas Henriksson <andreas@fatal.se> wrote:
>> The following logs should explain the problem. In short, the "ip route
>> get" command with iproute2 v. 2.6.35 does not output anything (and
>> exits with a 0). This breaks (for example) vpnc.
>
> Seems to be caused by:
>
> http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=commitdiff;h=447928279c88b6581ae4cdc1b5ac0a9e755aff64
>
> Have no idea if this is the correct fix, but it seemed like a likely typo
> based on the changes in the above commit and that this brings the output back:
>
>
> diff --git a/ip/iproute.c b/ip/iproute.c
> index 711576e..86c7ab7 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -160,7 +160,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
> if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
> ip6_multiple_tables = 1;
>
> - if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
> + if (filter.cloned && !(r->rtm_flags&RTM_F_CLONED))
> return 0;
>
> if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {
>
>
>
> (PS. Sorry for not properly replying in thread, but todays mailing list
> archives seems to be extremely afraid of exposing any real mail headers
> making it hard to reply properly without having received the original mail.)
>
> --
> Andreas Henriksson
>
^ permalink raw reply
* Re: Latest iproute2 breaks "ip route get" command
From: Andreas Henriksson @ 2010-08-08 19:33 UTC (permalink / raw)
To: Fabio Comolli, Ulrich Weber; +Cc: netdev
> The following logs should explain the problem. In short, the "ip route
> get" command with iproute2 v. 2.6.35 does not output anything (and
> exits with a 0). This breaks (for example) vpnc.
Seems to be caused by:
http://git.kernel.org/?p=linux/kernel/git/shemminger/iproute2.git;a=commitdiff;h=447928279c88b6581ae4cdc1b5ac0a9e755aff64
Have no idea if this is the correct fix, but it seemed like a likely typo
based on the changes in the above commit and that this brings the output back:
diff --git a/ip/iproute.c b/ip/iproute.c
index 711576e..86c7ab7 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -160,7 +160,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
ip6_multiple_tables = 1;
- if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
+ if (filter.cloned && !(r->rtm_flags&RTM_F_CLONED))
return 0;
if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {
(PS. Sorry for not properly replying in thread, but todays mailing list
archives seems to be extremely afraid of exposing any real mail headers
making it hard to reply properly without having received the original mail.)
--
Andreas Henriksson
^ permalink raw reply related
* Re: [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
From: Eilon Greenstein @ 2010-08-08 19:14 UTC (permalink / raw)
To: Dan Carpenter
Cc: Julia Lawall, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
yanivr
In-Reply-To: <20100806070749.GP9031@bicker>
On Fri, 2010-08-06 at 00:07 -0700, Dan Carpenter wrote:
> On Thu, Aug 05, 2010 at 10:26:38PM +0200, Julia Lawall wrote:
> > ---
> > This patch doesn't change the semantics of the code. But it might not be
> > what is intended.
> >
>
> I think there may have been some if statements which were removed before
> the code was merged into the kernel? Here is another one from that same
> function. Someone can roll this in with your patch.
>
Thanks Dan. We will send a more complete patch series for this file once
net-next is open again.
^ permalink raw reply
* Re: [PATCH 32/42] drivers/net/bnx2x: Adjust confusing if indentation
From: Eilon Greenstein @ 2010-08-08 19:13 UTC (permalink / raw)
To: Julia Lawall
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org, yanivr
In-Reply-To: <Pine.LNX.4.64.1008052226210.31692@ask.diku.dk>
On Thu, 2010-08-05 at 13:26 -0700, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> Outdent the code following the if.
>
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @r disable braces4@
> position p1,p2;
> statement S1,S2;
> @@
>
> (
> if (...) { ... }
> |
> if (...) S1@p1 S2@p2
> )
>
> @script:python@
> p1 << r.p1;
> p2 << r.p2;
> @@
>
> if (p1[0].column == p2[0].column):
> cocci.print_main("branch",p1)
> cocci.print_secs("after",p2)
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
> ---
> This patch doesn't change the semantics of the code. But it might not be
> what is intended.
This is indeed just bad alignment, thanks for the fix
^ permalink raw reply
* Latest iproute2 breaks "ip route get" command
From: Fabio Comolli @ 2010-08-08 17:02 UTC (permalink / raw)
To: netdev
Good morning.
The following logs should explain the problem. In short, the "ip route
get" command with iproute2 v. 2.6.35 does not output anything (and
exits with a 0). This breaks (for example) vpnc.
If I use iproute2 v. 2.6.34 everything is OK. This is with a 2.6.35 kernel.
Note: this happens not only using the default Archlinux package but
also if I download and compile the sources.
Please let me know if you need more details.
Best regards,
Fabio
---------------------------------------------------------------------------------------------------------------------------------------------
[root@ratbert] - [/var/cache/pacman/pkg] nslookup www.google.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
www.google.com canonical name = www.l.google.com.
Name: www.l.google.com
Address: 72.14.234.104
[root@ratbert] - [/var/cache/pacman/pkg] ip route get 72.14.234.104
72.14.234.104 via 192.168.1.1 dev wlan0 src 192.168.1.69
cache mtu 1500 advmss 1460 hoplimit 64
[root@ratbert] - [/var/cache/pacman/pkg] pacman -U
iproute2-2.6.35-1-i686.pkg.tar.xz
resolving dependencies...
looking for inter-conflicts...
Targets (1): iproute2-2.6.35-1
Total Download Size: 0.00 MB
Total Installed Size: 1.27 MB
Proceed with installation? [Y/n]
checking package integrity...
(1/1) checking for file conflicts
[############################################################] 100%
(1/1) upgrading iproute2
[############################################################] 100%
[root@ratbert] - [/var/cache/pacman/pkg] ip route get 72.14.234.104
[root@ratbert] - [/var/cache/pacman/pkg]
-------------------------------------------------------------------------------------------------------------------------------------------------
^ permalink raw reply
* [PATCH] pcnet_cs: Use pr_fmt and pr_<level>
From: Joe Perches @ 2010-08-08 14:50 UTC (permalink / raw)
To: Wolfram Sang; +Cc: netdev, linux-pcmcia, Dominik Brodowski, David Miller
In-Reply-To: <1281270725-25282-1-git-send-email-w.sang@pengutronix.de>
It looks as if the printks in get_ax88190 are
incorrect and were duplicated and superceded by a
test in pcnet_config, so I removed them.
Changed the level of the ax88190 test to KERN_NOTICE
to match the other message styles in pcnet_config.
Compiled but untested.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/pcmcia/pcnet_cs.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index e127923..0542fa4 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -28,6 +28,8 @@
======================================================================*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -440,8 +442,6 @@ static hw_info_t *get_ax88190(struct pcmcia_device *link)
dev->dev_addr[i] = j & 0xff;
dev->dev_addr[i+1] = j >> 8;
}
- printk(KERN_NOTICE "pcnet_cs: this is an AX88190 card!\n");
- printk(KERN_NOTICE "pcnet_cs: use axnet_cs instead.\n");
return NULL;
}
@@ -574,15 +574,15 @@ static int pcnet_config(struct pcmcia_device *link)
if ((if_port == 1) || (if_port == 2))
dev->if_port = if_port;
else
- printk(KERN_NOTICE "pcnet_cs: invalid if_port requested\n");
+ pr_notice("invalid if_port requested\n");
} else {
dev->if_port = 0;
}
if ((link->conf.ConfigBase == 0x03c0) &&
(link->manf_id == 0x149) && (link->card_id == 0xc1ab)) {
- printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n");
- printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n");
+ pr_notice("this is an AX88190 card!\n");
+ pr_notice("use axnet_cs instead.\n");
goto failed;
}
@@ -597,8 +597,8 @@ static int pcnet_config(struct pcmcia_device *link)
local_hw_info = get_hwired(link);
if (local_hw_info == NULL) {
- printk(KERN_NOTICE "pcnet_cs: unable to read hardware net"
- " address for io base %#3lx\n", dev->base_addr);
+ pr_notice("unable to read hardware net address for io base %#3lx\n",
+ dev->base_addr);
goto failed;
}
@@ -640,7 +640,7 @@ static int pcnet_config(struct pcmcia_device *link)
SET_NETDEV_DEV(dev, &link->dev);
if (register_netdev(dev) != 0) {
- printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n");
+ pr_notice("register_netdev() failed\n");
goto failed;
}
@@ -649,16 +649,16 @@ static int pcnet_config(struct pcmcia_device *link)
netdev_info(dev, "NE2000 (DL100%d rev %02x): ",
(info->flags & IS_DL10022) ? 22 : 19, id);
if (info->pna_phy)
- printk("PNA, ");
+ pr_cont("PNA, ");
} else {
netdev_info(dev, "NE2000 Compatible: ");
}
- printk("io %#3lx, irq %d,", dev->base_addr, dev->irq);
+ pr_cont("io %#3lx, irq %d,", dev->base_addr, dev->irq);
if (info->flags & USE_SHMEM)
- printk (" mem %#5lx,", dev->mem_start);
+ pr_cont(" mem %#5lx,", dev->mem_start);
if (info->flags & HAS_MISC_REG)
- printk(" %s xcvr,", if_names[dev->if_port]);
- printk(" hw_addr %pM\n", dev->dev_addr);
+ pr_cont(" %s xcvr,", if_names[dev->if_port]);
+ pr_cont(" hw_addr %pM\n", dev->dev_addr);
return 0;
failed:
^ permalink raw reply related
* [PATCH] xfrm: fix a possible leak of dev reference count.
From: Zhang JieJing @ 2010-08-08 13:34 UTC (permalink / raw)
To: netdev; +Cc: Dan Carpenter, Zhang Jiejing
call dev_put(dev) on error path.
Signed-off-by: JieJing.Zhang <kzjeef@gmail.com>
---
net/ipv4/xfrm4_policy.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 1705476..d2a4873 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -81,8 +81,10 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst,
struct net_device *dev,
dev_hold(dev);
xdst->u.rt.idev = in_dev_get(dev);
- if (!xdst->u.rt.idev)
+ if (!xdst->u.rt.idev) {
+ dev_put(dev);
return -ENODEV;
+ }
xdst->u.rt.peer = rt->peer;
if (rt->peer)
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH 11/18] pcmcia: do not use io_req_t when calling pcmcia_request_io()
From: Komuro @ 2010-08-08 13:07 UTC (permalink / raw)
To: Dominik Brodowski
Cc: alsa-devel, linux-usb, linux-serial, netdev, linux-pcmcia,
linux-wireless, laforge, linux-ide, linux-mtd, Dominik Brodowski,
Michael Buesch
In-Reply-To: <1281046014-7585-11-git-send-email-linux@dominikbrodowski.net>
Hi,
>
>- link->io.IOAddrLines =10;
>- link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
>+ link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
link->io_lines should be set here?
>@@ -840,14 +839,15 @@ xirc2ps_config(struct pcmcia_device * link)
> }
> printk(KNOT_XIRC "no ports available\n");
> } else {
>- link->io.NumPorts1 = 16;
>+ link->io_lines = 10;
>+ link->resource[0]->end = 16;
Best Regards
Komuro
^ 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