* [PATCH iproute2] ip: speedup store_nlmsg()
From: Eric Dumazet @ 2009-10-23 4:37 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Linux Netdev List
ip link show command has O(N^2) complexity, because it loops until list end.
Adding pointer to last elements avoids this loop.
Before patch :
# time ip -o link | wc
15013 240212 2136365
real 0m0.738s
user 0m0.770s
sys 0m0.035s
# time ip link show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:1e:0b:ec:d3:dc brd ff:ff:ff:ff:ff:ff
real 0m0.565s
user 0m0.540s
sys 0m0.025s
After patch :
# time ip/ip -o link | wc
15013 210192 2031310
real 0m0.189s
user 0m0.221s
sys 0m0.032s
# time ip/ip link show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:1e:0b:ec:d3:dc brd ff:ff:ff:ff:ff:ff
real 0m0.032s
user 0m0.006s
sys 0m0.026s
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index cadc1a3..7674256 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -570,13 +570,16 @@ static int print_selected_addrinfo(int ifindex, struct nlmsg_list *ainfo, FILE *
return 0;
}
+struct nlmsg_list_info {
+ struct nlmsg_list *first;
+ struct nlmsg_list *last;
+};
static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
void *arg)
{
- struct nlmsg_list **linfo = (struct nlmsg_list**)arg;
+ struct nlmsg_list_info *linfo = (struct nlmsg_list_info *)arg;
struct nlmsg_list *h;
- struct nlmsg_list **lp;
h = malloc(n->nlmsg_len+sizeof(void*));
if (h == NULL)
@@ -585,8 +588,11 @@ static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
memcpy(&h->h, n, n->nlmsg_len);
h->next = NULL;
- for (lp = linfo; *lp; lp = &(*lp)->next) /* NOTHING */;
- *lp = h;
+ if (linfo->first)
+ linfo->last->next = h;
+ else
+ linfo->first = h;
+ linfo->last = h;
ll_remember_index(who, n, NULL);
return 0;
@@ -594,8 +600,8 @@ static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
static int ipaddr_list_or_flush(int argc, char **argv, int flush)
{
- struct nlmsg_list *linfo = NULL;
- struct nlmsg_list *ainfo = NULL;
+ struct nlmsg_list_info linfo = {0};
+ struct nlmsg_list_info ainfo = {0};
struct nlmsg_list *l, *n;
char *filter_dev = NULL;
int no_link = 0;
@@ -750,7 +756,7 @@ static int ipaddr_list_or_flush(int argc, char **argv, int flush)
if (filter.family && filter.family != AF_PACKET) {
struct nlmsg_list **lp;
- lp=&linfo;
+ lp = &linfo.first;
if (filter.oneline)
no_link = 1;
@@ -760,7 +766,7 @@ static int ipaddr_list_or_flush(int argc, char **argv, int flush)
struct ifinfomsg *ifi = NLMSG_DATA(&l->h);
struct nlmsg_list *a;
- for (a=ainfo; a; a=a->next) {
+ for (a = ainfo.first; a; a = a->next) {
struct nlmsghdr *n = &a->h;
struct ifaddrmsg *ifa = NLMSG_DATA(n);
@@ -807,12 +813,12 @@ static int ipaddr_list_or_flush(int argc, char **argv, int flush)
}
}
- for (l=linfo; l; l = n) {
+ for (l = linfo.first; l; l = n) {
n = l->next;
if (no_link || print_linkinfo(NULL, &l->h, stdout) == 0) {
struct ifinfomsg *ifi = NLMSG_DATA(&l->h);
if (filter.family != AF_PACKET)
- print_selected_addrinfo(ifi->ifi_index, ainfo, stdout);
+ print_selected_addrinfo(ifi->ifi_index, ainfo.first, stdout);
}
fflush(stdout);
free(l);
^ permalink raw reply related
* Re: [net-2.6 PATCH] e1000e: reset the PHY on 82577/82578 when going to Sx
From: David Miller @ 2009-10-23 4:22 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bruce.w.allan
In-Reply-To: <20091023025247.6750.89717.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 22 Oct 2009 19:53:00 -0700
> From: Bruce Allan <bruce.w.allan@intel.com>
>
> The PHY on 82577/82578 parts needs a soft reset when transitioning to Sx
> state in order for the PHY write which disables gigabit speed to take
> effect. Gigabit speed must be disabled in order for the PHY writes to
> registers on page 800 (the wakeup control registers) to work as expected
> otherwise the system might not wake via WoL.
>
> Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [PATCH iproute2] ip: Support IFLA_TXQLEN in ip link command
From: Eric Dumazet @ 2009-10-23 4:13 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Linux Netdev List
In-Reply-To: <4AE068EB.70005@gmail.com>
Eric Dumazet a écrit :
> We currently use an expensive ioctl() to get device txqueuelen, while
> rtnetlink gave it to us for free. This patch speeds up ip link operation
> when many devices are registered.
>
Here is a 2nd version od this patch, not displaying "qlen 0" useless info
[PATCH iproute2] ip: Support IFLA_TXQLEN in ip link show command
We currently use an expensive ioctl() to get device txqueuelen, while
rtnetlink gave it to us for free. This patch speeds up ip link operation
when many devices are registered.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 267ecb3..cadc1a3 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -131,26 +131,31 @@ static void print_operstate(FILE *f, __u8 state)
fprintf(f, "state %s ", oper_states[state]);
}
-static void print_queuelen(FILE *f, const char *name)
+static void print_queuelen(FILE *f, struct rtattr *tb[IFLA_MAX + 1])
{
- struct ifreq ifr;
- int s;
-
- s = socket(AF_INET, SOCK_STREAM, 0);
- if (s < 0)
- return;
-
- memset(&ifr, 0, sizeof(ifr));
- strcpy(ifr.ifr_name, name);
- if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
- fprintf(f, "ioctl(SIOCGIFXQLEN) failed: %s\n", strerror(errno));
+ int qlen;
+
+ if (tb[IFLA_TXQLEN])
+ qlen = *(int *)RTA_DATA(tb[IFLA_TXQLEN]);
+ else {
+ struct ifreq ifr;
+ int s = socket(AF_INET, SOCK_STREAM, 0);
+
+ if (s < 0)
+ return;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strcpy(ifr.ifr_name, (char *)RTA_DATA(tb[IFLA_IFNAME]));
+ if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
+ fprintf(f, "ioctl(SIOCGIFXQLEN) failed: %s\n", strerror(errno));
+ close(s);
+ return;
+ }
close(s);
- return;
+ qlen = ifr.ifr_qlen;
}
- close(s);
-
- if (ifr.ifr_qlen)
- fprintf(f, "qlen %d", ifr.ifr_qlen);
+ if (qlen)
+ fprintf(f, "qlen %d", qlen);
}
static void print_linktype(FILE *fp, struct rtattr *tb)
@@ -253,7 +258,7 @@ int print_linkinfo(const struct sockaddr_nl *who,
print_operstate(fp, *(__u8 *)RTA_DATA(tb[IFLA_OPERSTATE]));
if (filter.showqueue)
- print_queuelen(fp, (char*)RTA_DATA(tb[IFLA_IFNAME]));
+ print_queuelen(fp, tb);
if (!filter.family || filter.family == AF_PACKET) {
SPRINT_BUF(b1);
^ permalink raw reply related
* [PATCH] net: use WARN() for the WARN_ON in commit b6b39e8f3fbbb
From: Arjan van de Ven @ 2009-10-23 3:35 UTC (permalink / raw)
To: herbert, netdev
>From d63ae5a34f2ed0821870c9e4c797e4e095f0c58a Mon Sep 17 00:00:00 2001
From: Arjan van de Ven <arjan@linux.intel.com>
Date: Thu, 22 Oct 2009 20:32:24 -0700
Subject: [PATCH] net: use WARN() for the WARN_ON in commit b6b39e8f3fbbb
Commit b6b39e8f3fbbb (tcp: Try to catch MSG_PEEK bug) added a printk()
to the WARN_ON() that's in tcp.c. This patch changes this combination
to WARN(); the advantage of WARN() is that the printk message shows up
inside the message, so that kerneloops.org will collect the message.
In addition, this gets rid of an extra if() statement.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
net/ipv4/tcp.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 90b2e06..a0e56db 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1442,9 +1442,9 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
goto found_ok_skb;
if (tcp_hdr(skb)->fin)
goto found_fin_ok;
- if (WARN_ON(!(flags & MSG_PEEK)))
- printk(KERN_INFO "recvmsg bug 2: copied %X "
- "seq %X\n", *seq, TCP_SKB_CB(skb)->seq);
+ WARN(!(flags & MSG_PEEK), KERN_INFO "recvmsg bug 2: "
+ "copied %X seq %X\n", *seq,
+ TCP_SKB_CB(skb)->seq);
}
/* Well, if we have backlog, try to process it now yet. */
--
1.6.2.5
--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
^ permalink raw reply related
* [net-next-2.6 PATCH] e100: Fix to allow systems with FW based cards to resume from STD
From: Jeff Kirsher @ 2009-10-23 2:59 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, David Graham, Jeff Kirsher
From: David Graham <david.graham@intel.com>
Devices with loadable firmware must have their firmware reloaded
after the system resumes from sleep, but the request_firmare()
API is not available at this point in the resume flow because
tasks are not yet running, and the system will hang if it is
called. Work around this issue by only calling request_firmware()
for a device's first firmware load, and cache a copy of the pointer
to the firmware blob for that device, so that we may reload firmware
images even during resume.
Signed-off-by: David Graham <david.graham@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/e100.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index ff83efd..f428c5f 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -621,6 +621,7 @@ struct nic {
u16 eeprom_wc;
__le16 eeprom[256];
spinlock_t mdio_lock;
+ const struct firmware *fw;
};
static inline void e100_write_flush(struct nic *nic)
@@ -1222,9 +1223,9 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
static const struct firmware *e100_request_firmware(struct nic *nic)
{
const char *fw_name;
- const struct firmware *fw;
+ const struct firmware *fw = nic->fw;
u8 timer, bundle, min_size;
- int err;
+ int err = 0;
/* do not load u-code for ICH devices */
if (nic->flags & ich)
@@ -1240,12 +1241,20 @@ static const struct firmware *e100_request_firmware(struct nic *nic)
else /* No ucode on other devices */
return NULL;
- err = request_firmware(&fw, fw_name, &nic->pdev->dev);
+ /* If the firmware has not previously been loaded, request a pointer
+ * to it. If it was previously loaded, we are reinitializing the
+ * adapter, possibly in a resume from hibernate, in which case
+ * request_firmware() cannot be used.
+ */
+ if (!fw)
+ err = request_firmware(&fw, fw_name, &nic->pdev->dev);
+
if (err) {
DPRINTK(PROBE, ERR, "Failed to load firmware \"%s\": %d\n",
fw_name, err);
return ERR_PTR(err);
}
+
/* Firmware should be precisely UCODE_SIZE (words) plus three bytes
indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */
if (fw->size != UCODE_SIZE * 4 + 3) {
@@ -1268,7 +1277,10 @@ static const struct firmware *e100_request_firmware(struct nic *nic)
release_firmware(fw);
return ERR_PTR(-EINVAL);
}
- /* OK, firmware is validated and ready to use... */
+
+ /* OK, firmware is validated and ready to use. Save a pointer
+ * to it in the nic */
+ nic->fw = fw;
return fw;
}
^ permalink raw reply related
* [net-2.6 PATCH] e1000e: reset the PHY on 82577/82578 when going to Sx
From: Jeff Kirsher @ 2009-10-23 2:53 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, Bruce Allan, Jeff Kirsher
From: Bruce Allan <bruce.w.allan@intel.com>
The PHY on 82577/82578 parts needs a soft reset when transitioning to Sx
state in order for the PHY write which disables gigabit speed to take
effect. Gigabit speed must be disabled in order for the PHY writes to
registers on page 800 (the wakeup control registers) to work as expected
otherwise the system might not wake via WoL.
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/e1000e/ich8lan.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 99df2ab..aa0ab0e 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -2843,9 +2843,8 @@ void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw)
E1000_PHY_CTRL_GBE_DISABLE;
ew32(PHY_CTRL, phy_ctrl);
- /* Workaround SWFLAG unexpectedly set during S0->Sx */
if (hw->mac.type == e1000_pchlan)
- udelay(500);
+ e1000_phy_hw_reset_ich8lan(hw);
default:
break;
}
^ permalink raw reply related
* PATCH 23/10]Optimize the upload speed for PPP connection.
From: fangxiaozhi 00110321 @ 2009-10-23 1:48 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, zihan, greg, haegar
From: fangxiaozhi <huananhu@huawei.com>
1. This patch is based on the kernel of 2.6.32-rc4
2. In this patch, we enlarge the out buffer size to optimize the upload speed for the ppp connection. Then it can support the upload of HSUPA data cards.
Signed-off-by: fangxiaozhi <huananhu@huawei.com>
-----------------------------------------------------------------------------------------
--- a/drivers/net/ppp_async.c 2009-10-12 05:43:56.000000000 +0800
+++ b/drivers/net/ppp_async.c 2009-10-15 16:29:56.000000000 +0800
@@ -36,7 +36,7 @@
#define PPP_VERSION "2.4.2"
-#define OBUFSIZE 256
+#define OBUFSIZE 2048
/* Structure for storing local state. */
struct asyncppp {
******************************************************************************************
This email and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained here in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email
immediately and delete it!
*****************************************************************************************
^ permalink raw reply
* Re: [PATCH net-2.6] sfc: 10Xpress: Report support for pause frames
From: David Miller @ 2009-10-23 1:35 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
In-Reply-To: <1256250602.2785.25.camel@achroite>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Thu, 22 Oct 2009 23:30:02 +0100
> Sorry, I was mistaken - those earlier commits are only in net-next-2.6,
> so this is not needed for 2.6.32.
Ok, I'll move the patch over to net-next-2.6 then, thanks.
^ permalink raw reply
* Re: [PATCH net-2.6] sfc: 10Xpress: Report support for pause frames
From: David Miller @ 2009-10-23 1:31 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, linux-net-drivers
In-Reply-To: <1256250314.2785.22.camel@achroite>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Thu, 22 Oct 2009 23:25:14 +0100
> Commits 27fbc7d 'mdio: Expose pause frame advertising flags to ethtool'
> and c634263 'sfc: 10Xpress: Initialise pause advertising flags'
> added to our reported advertising flags.
>
> efx_mdio_set_settings() requires that all advertising flags are
> also present in the supported flags, so make sure that is true.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] isdn: fix possible circular locking dependency
From: David Miller @ 2009-10-23 1:28 UTC (permalink / raw)
To: xtfeng; +Cc: isdn, isdn4linux, tilman, netdev, linux-kernel
In-Reply-To: <1256202424-28314-1-git-send-email-xtfeng@gmail.com>
From: Xiaotian Feng <xtfeng@gmail.com>
Date: Thu, 22 Oct 2009 17:07:04 +0800
> There's a circular locking dependency:
...
> We don't need to lock nd->queue->xmit_lock to protect single
> isdn_net_lp_busy(). This can fix above lockdep warnings.
>
> Reported-and-tested-by: Tilman Schmidt <tilman@imap.cc>
> Signed-off-by: Xiaotian Feng <xtfeng@gmail.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH 0/3] netxen: bug fixes
From: David Miller @ 2009-10-23 1:28 UTC (permalink / raw)
To: dhananjay; +Cc: netdev
In-Reply-To: <1256189943-20477-1-git-send-email-dhananjay@netxen.com>
From: Dhananjay Phadke <dhananjay@netxen.com>
Date: Wed, 21 Oct 2009 22:39:00 -0700
> 3 bug fixes for 2.6.32. Please apply to net-2.6.
All applied, thank you.
^ permalink raw reply
* Re: [PATCH 2.6.32-rc5] r8169: fix Ethernet Hangup for RTL8110SC rev d
From: David Miller @ 2009-10-23 1:19 UTC (permalink / raw)
To: simon.wunderlich; +Cc: netdev, romieu, bernhard.schmidt
In-Reply-To: <66ae97b70910212348o6c32da21s906da4770ebc6f80@mail.gmail.com>
This patch looks fine, but I can't apply it because your email
client corrupted the patch, changing tab characters into
spaces, breaking up long lines, etc.
Please fix this up and resubmit, thanks. You can read
linux/Documentation/email-clients.txt for helpful tips.
^ permalink raw reply
* Re: [PATCH] vmxnet3: remove duplicated #include
From: Shreyas Bhatewara @ 2009-10-22 23:58 UTC (permalink / raw)
To: netdev; +Cc: Huang Weiyi, Shreyas Bhatewara, pv-drivers
In-Reply-To: <alpine.LRH.2.00.0910221631580.23769@sbhatewara-dev1.eng.vmware.com>
Remove duplicate headerfile includes from vmxnet3_int.h
Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Shreyas Bhatewara <sbhatewara@vmware.com>
Signed-off-by: Bhavesh Davda <davda@vmware.com>
---
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 6bb9157..c4f8f04 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -27,15 +27,11 @@
#ifndef _VMXNET3_INT_H
#define _VMXNET3_INT_H
-#include <linux/types.h>
#include <linux/ethtool.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
-#include <linux/ethtool.h>
#include <linux/compiler.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/ioport.h>
^ permalink raw reply related
* Re: NOHZ: local_softirq_pending 08
From: Tilman Schmidt @ 2009-10-22 23:37 UTC (permalink / raw)
To: Jarek Poplawski
Cc: David Miller, johannes, hidave.darkstar, linux-kernel, tglx,
linux-wireless, linux-ppp, netdev, paulus, isdn4linux,
i4ldeveloper, Karsten Keil
In-Reply-To: <4ADF5710.4030505@imap.cc>
[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]
On 21.10.2009 20:46, /me wrote:
>>>> I have encountered the message in the subject during a test of
>>>> the Gigaset CAPI driver, and would like to determine whether
>>>> it's a bug in the driver, a bug somewhere else, or no bug at
>>>> all. The test scenario was PPP over ISDN with pppd+capiplugin.
>>>> In an alternative scenario, also PPP over ISDN but with
>>>> smpppd+capidrv, the message did not occur.
>
> I'm sorry, I had confused the two cases. The message occurs in
> the smpppd+capidrv scenario, not with pppd+capiplugin.
>
>>>> Johannes' answer pointed me to the netif_rx() function.
>>>> The Gigaset driver itself doesn't call that function at all.
>>>> In the scenario where I saw the message, it was the SYNC_PPP
>>>> line discipline that did.
>
> This analysis was therefore wrong. It would be the netif_rx()
> call towards the end of isdn_ppp_push_higher() in
> drivers/isdn/i4l/isdn_ppp.c L1177.
Having noticed that, I cooked up the following patch which fixed
the messages for me. Comments? (Adding i4l people to the already
impressive CC list.)
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -1174,7 +1174,10 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff
#endif /* CONFIG_IPPP_FILTER */
skb->dev = dev;
skb_reset_mac_header(skb);
- netif_rx(skb);
+ if (in_interrupt())
+ netif_rx(skb);
+ else
+ netif_rx_ni(skb);
/* net_dev->local->stats.rx_packets++; done in isdn_net.c */
return;
--
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: 254 bytes --]
^ permalink raw reply
* Re: [PATCH net-2.6] sfc: 10Xpress: Report support for pause frames
From: Ben Hutchings @ 2009-10-22 22:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
In-Reply-To: <1256250314.2785.22.camel@achroite>
On Thu, 2009-10-22 at 23:25 +0100, Ben Hutchings wrote:
> Commits 27fbc7d 'mdio: Expose pause frame advertising flags to ethtool'
> and c634263 'sfc: 10Xpress: Initialise pause advertising flags'
> added to our reported advertising flags.
>
> efx_mdio_set_settings() requires that all advertising flags are
> also present in the supported flags, so make sure that is true.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> This fixes a regression in 2.6.32: after resetting a 10Xpress PHY we
> fail to reconfigure it if pause frames are enabled. Manually changing
> pause frame settings will also fail.
Sorry, I was mistaken - those earlier commits are only in net-next-2.6,
so this is not needed for 2.6.32.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCH net-2.6] sfc: 10Xpress: Report support for pause frames
From: Ben Hutchings @ 2009-10-22 22:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
Commits 27fbc7d 'mdio: Expose pause frame advertising flags to ethtool'
and c634263 'sfc: 10Xpress: Initialise pause advertising flags'
added to our reported advertising flags.
efx_mdio_set_settings() requires that all advertising flags are
also present in the supported flags, so make sure that is true.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
This fixes a regression in 2.6.32: after resetting a 10Xpress PHY we
fail to reconfigure it if pause frames are enabled. Manually changing
pause frame settings will also fail.
Ben.
drivers/net/sfc/tenxpress.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c
index 1a3495c..352cc56 100644
--- a/drivers/net/sfc/tenxpress.c
+++ b/drivers/net/sfc/tenxpress.c
@@ -752,6 +752,7 @@ tenxpress_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
mdio45_ethtool_gset_npage(&efx->mdio, ecmd, adv, lpa);
+ ecmd->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
if (efx->phy_type != PHY_TYPE_SFX7101) {
ecmd->supported |= (SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Full);
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related
* Re: Irq architecture for multi-core network driver.
From: David Daney @ 2009-10-22 22:24 UTC (permalink / raw)
To: Chris Friesen; +Cc: netdev, Linux Kernel Mailing List, linux-mips
In-Reply-To: <4AE0D72A.4090607@nortel.com>
Chris Friesen wrote:
> On 10/22/2009 03:40 PM, David Daney wrote:
>
>> The main problem I have encountered is how to fit the interrupt
>> management into the kernel framework. Currently the interrupt source
>> is connected to a single irq number. I request_irq, and then manage
>> the masking and unmasking on a per cpu basis by directly manipulating
>> the interrupt controller's affinity/routing registers. This goes
>> behind the back of all the kernel's standard interrupt management
>> routines. I am looking for a better approach.
>>
>> One thing that comes to mind is that I could assign a different
>> interrupt number per cpu to the interrupt signal. So instead of
>> having one irq I would have 32 of them. The driver would then do
>> request_irq for all 32 irqs, and could call enable_irq and disable_irq
>> to enable and disable them. The problem with this is that there isn't
>> really a single packets-ready signal, but instead 16 of them. So If I
>> go this route I would have 16(lines) x 32(cpus) = 512 interrupt
>> numbers just for the networking hardware, which seems a bit excessive.
>
> Does your hardware do flow-based queues? In this model you have
> multiple rx queues and the hardware hashes incoming packets to a single
> queue based on the addresses, ports, etc. This ensures that all the
> packets of a single connection always get processed in the order they
> arrived at the net device.
>
Indeed, this is exactly what we have.
> Typically in this model you have as many interrupts as queues
> (presumably 16 in your case). Each queue is assigned an interrupt and
> that interrupt is affined to a single core.
Certainly this is one mode of operation that should be supported, but I
would also like to be able to go for raw throughput and have as many
cores as possible reading from a single queue (like I currently have).
>
> The intel igb driver is an example of one that uses this sort of design.
>
Thanks, I will look at that driver.
David Daney
^ permalink raw reply
* Re: Irq architecture for multi-core network driver.
From: Chris Friesen @ 2009-10-22 22:05 UTC (permalink / raw)
To: David Daney; +Cc: netdev, Linux Kernel Mailing List, linux-mips
In-Reply-To: <4AE0D14B.1070307@caviumnetworks.com>
On 10/22/2009 03:40 PM, David Daney wrote:
> The main problem I have encountered is how to fit the interrupt
> management into the kernel framework. Currently the interrupt source
> is connected to a single irq number. I request_irq, and then manage
> the masking and unmasking on a per cpu basis by directly manipulating
> the interrupt controller's affinity/routing registers. This goes
> behind the back of all the kernel's standard interrupt management
> routines. I am looking for a better approach.
>
> One thing that comes to mind is that I could assign a different
> interrupt number per cpu to the interrupt signal. So instead of
> having one irq I would have 32 of them. The driver would then do
> request_irq for all 32 irqs, and could call enable_irq and disable_irq
> to enable and disable them. The problem with this is that there isn't
> really a single packets-ready signal, but instead 16 of them. So If I
> go this route I would have 16(lines) x 32(cpus) = 512 interrupt
> numbers just for the networking hardware, which seems a bit excessive.
Does your hardware do flow-based queues? In this model you have
multiple rx queues and the hardware hashes incoming packets to a single
queue based on the addresses, ports, etc. This ensures that all the
packets of a single connection always get processed in the order they
arrived at the net device.
Typically in this model you have as many interrupts as queues
(presumably 16 in your case). Each queue is assigned an interrupt and
that interrupt is affined to a single core.
The intel igb driver is an example of one that uses this sort of design.
Chris
^ permalink raw reply
* Re: [PATCH 5/5] ONLY-APPLY-IF-STILL-FAILING Revert 373c0a7e, 8aa7e847: Fix congestion_wait() sync/async vs read/write confusion
From: Jens Axboe @ 2009-10-22 21:49 UTC (permalink / raw)
To: Mel Gorman
Cc: Frans Pop, Jiri Kosina, Sven Geggus, Karol Lewandowski,
Tobias Oetiker, Rafael J. Wysocki, David Miller, Reinette Chatre,
Kalle Valo, David Rientjes, KOSAKI Motohiro, Mohamed Abbas,
John W. Linville, Pekka Enberg, Bartlomiej Zolnierkiewicz,
Greg Kroah-Hartman, Stephan von Krawczynski, Kernel Testers List,
netdev, linux-kernel, linux-mm@kvack.org
In-Reply-To: <1256221356-26049-6-git-send-email-mel@csn.ul.ie>
On Thu, Oct 22 2009, Mel Gorman wrote:
> Testing by Frans Pop indicates that in the 2.6.30..2.6.31 window at
> least that the commits 373c0a7e 8aa7e847 dramatically increased the
> number of GFP_ATOMIC failures that were occuring within a wireless
> driver. It was never isolated which of the changes was the exact problem
> and it's possible it has been fixed since. If problems are still
> occuring with GFP_ATOMIC in 2.6.31-rc5, then this patch should be
> applied to determine if the congestion_wait() callers are still broken.
I still think this is a complete red herring.
--
Jens Axboe
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* Re: [net-next-2.6 PATCH 2/3] ixgbe: Set MSI-X vectors to NOBALANCING and set affinity
From: Stephen Hemminger @ 2009-10-22 21:45 UTC (permalink / raw)
To: David Miller; +Cc: peter.p.waskiewicz.jr, jeffrey.t.kirsher, gospo, netdev
In-Reply-To: <20091022.035601.193700201.davem@davemloft.net>
On Thu, 22 Oct 2009 03:56:01 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
> Date: Thu, 22 Oct 2009 01:22:36 -0700
>
> > The first thing any performance guide says is to disable irqbalance
>
> Such guides are wrong, and that's the end of this discussion.
>
> These kinds of guides also say to do all kinds of crazy things with
> the socket sysctl settings. That's wrong too and we absolutely do not
> do things to accomodate nor support those guide suggestions.
>
> And we won't do that here.
>
> I'm especially not going to succumb in this case because Arjan has
> been more than responsive to making sure irqbalanced in userspace does
> the right thing for networking devices, even multiqueue ones.
>
> So we can make it do the right thing when flow director is present.
> In fact, the thing you want for flow director makes sense in the
> general case too.
irqbalance daemon already has IRQBALANCE_BANNED_INTERRUPTS
to work around this. It also has code to special case devices, if you
think ixgbe needs special treatment, why not do it there.
^ permalink raw reply
* Re: [Patch] sctp: remove deprecated SCTP_GET_*_OLD stuffs
From: Sam Ravnborg @ 2009-10-22 21:44 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: Amerigo Wang, linux-kernel, netdev, akpm
In-Reply-To: <4AE0C64A.9080400@hp.com>
On Thu, Oct 22, 2009 at 04:53:30PM -0400, Vlad Yasevich wrote:
> > diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
> > index be2334a..0991f1b 100644
> > --- a/include/net/sctp/user.h
> > +++ b/include/net/sctp/user.h
> > @@ -131,14 +131,6 @@ enum sctp_optname {
> > #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
> > SCTP_SOCKOPT_PEELOFF, /* peel off association. */
> > #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF
> > - SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */
> > -#define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD
> > - SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */
> > -#define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD
> > - SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */
> > -#define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD
> > - SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */
> > -#define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD
> > SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */
>
> After running the regression suite against this patch I find that we can't
> remove the enum values. Removing the enums changes the value for the remainder
> of the definitions and breaks binary compatibility for applications that use
> those trailing options.
>
> You should be ok with removing the #defines and actual code that uses them,
> but not the enums. You can even rename the enums, but we must preserve
> numeric ordering.
If we really depend on the actual value of an enum as in this case,
then e should assign them direct to better document this.
Sam
^ permalink raw reply
* Irq architecture for multi-core network driver.
From: David Daney @ 2009-10-22 21:40 UTC (permalink / raw)
To: netdev, Linux Kernel Mailing List; +Cc: linux-mips
My network controller is part of a multicore SOC family[1] with up to 32
cpu cores.
The the packets-ready signal from the network controller can trigger
an interrupt on any or all cpus and is configurable on a per cpu basis.
If more than one cpu has the interrupt enabled, they would all get the
interrupt, so if a single packet were to be ready, all cpus could be
interrupted and try to process it. The kernel interrupt management
functions don't seem to give me a good way to manage the interrupts.
More on this later.
My current approach is to add a NAPI instance for each cpu. I start
with the interrupt enabled on a single cpu, when the interrupt
triggers, I mask the interrupt on that cpu and schedule the
napi_poll. When the napi_poll function is entered, I look at the
packet backlog and if it is above a threshold , I enable the interrupt
on an additional cpu. The process then iterates until the number of cpu
running the napi_poll function can maintain the backlog under the
threshold. This all seems to work fairly well.
The main problem I have encountered is how to fit the interrupt
management into the kernel framework. Currently the interrupt source
is connected to a single irq number. I request_irq, and then manage
the masking and unmasking on a per cpu basis by directly manipulating
the interrupt controller's affinity/routing registers. This goes
behind the back of all the kernel's standard interrupt management
routines. I am looking for a better approach.
One thing that comes to mind is that I could assign a different
interrupt number per cpu to the interrupt signal. So instead of
having one irq I would have 32 of them. The driver would then do
request_irq for all 32 irqs, and could call enable_irq and disable_irq
to enable and disable them. The problem with this is that there isn't
really a single packets-ready signal, but instead 16 of them. So If I
go this route I would have 16(lines) x 32(cpus) = 512 interrupt
numbers just for the networking hardware, which seems a bit excessive.
A second possibility is to add something like:
int irq_add_affinity(unsigned int irq, cpumask_t cpumask);
int irq_remove_affinity(unsigned int irq, cpumask_t cpumask);
These would atomically add and remove cpus from an irq's affinity.
This is essentially what my current driver does, but it would be with
a new officially blessed kernel interface.
Any opinions about the best way forward are most welcome.
Thanks,
David Daney
[1]: See: arch/mips/cavium-octeon and drivers/staging/octeon. Yes the
staging driver is ugly, I am working to improve it.
^ permalink raw reply
* Re: [Patch] sctp: remove deprecated SCTP_GET_*_OLD stuffs
From: Vlad Yasevich @ 2009-10-22 20:53 UTC (permalink / raw)
To: Amerigo Wang; +Cc: linux-kernel, netdev, akpm
In-Reply-To: <20091015082849.4605.48311.sendpatchset@localhost.localdomain>
Amerigo Wang wrote:
> SCTP_GET_*_OLD stuffs are schedlued to be removed.
>
> Cc: Vlad Yasevich <vladislav.yasevich@hp.com>
> Signed-off-by: WANG Cong <amwang@redhat.com>
>
>
> ---
> diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
> index 04e6c81..0b0eee5 100644
> --- a/Documentation/feature-removal-schedule.txt
> +++ b/Documentation/feature-removal-schedule.txt
> @@ -302,18 +302,6 @@ Who: ocfs2-devel@oss.oracle.com
>
> ---------------------------
>
> -What: SCTP_GET_PEER_ADDRS_NUM_OLD, SCTP_GET_PEER_ADDRS_OLD,
> - SCTP_GET_LOCAL_ADDRS_NUM_OLD, SCTP_GET_LOCAL_ADDRS_OLD
> -When: June 2009
> -Why: A newer version of the options have been introduced in 2005 that
> - removes the limitions of the old API. The sctp library has been
> - converted to use these new options at the same time. Any user
> - space app that directly uses the old options should convert to using
> - the new options.
> -Who: Vlad Yasevich <vladislav.yasevich@hp.com>
> -
> ----------------------------
> -
> What: Ability for non root users to shm_get hugetlb pages based on mlock
> resource limits
> When: 2.6.31
> diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
> index be2334a..0991f1b 100644
> --- a/include/net/sctp/user.h
> +++ b/include/net/sctp/user.h
> @@ -131,14 +131,6 @@ enum sctp_optname {
> #define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
> SCTP_SOCKOPT_PEELOFF, /* peel off association. */
> #define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF
> - SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */
> -#define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD
> - SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */
> -#define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD
> - SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */
> -#define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD
> - SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */
> -#define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD
> SCTP_SOCKOPT_CONNECTX_OLD, /* CONNECTX old requests. */
After running the regression suite against this patch I find that we can't
remove the enum values. Removing the enums changes the value for the remainder
of the definitions and breaks binary compatibility for applications that use
those trailing options.
You should be ok with removing the #defines and actual code that uses them,
but not the enums. You can even rename the enums, but we must preserve
numeric ordering.
Can you resubmit a corrected patch.
-vlad
> #define SCTP_SOCKOPT_CONNECTX_OLD SCTP_SOCKOPT_CONNECTX_OLD
> SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index c8d0575..1732a70 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -4339,90 +4339,6 @@ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval
> return 0;
> }
>
> -static int sctp_getsockopt_peer_addrs_num_old(struct sock *sk, int len,
> - char __user *optval,
> - int __user *optlen)
> -{
> - sctp_assoc_t id;
> - struct sctp_association *asoc;
> - struct list_head *pos;
> - int cnt = 0;
> -
> - if (len < sizeof(sctp_assoc_t))
> - return -EINVAL;
> -
> - if (copy_from_user(&id, optval, sizeof(sctp_assoc_t)))
> - return -EFAULT;
> -
> - printk(KERN_WARNING "SCTP: Use of SCTP_GET_PEER_ADDRS_NUM_OLD "
> - "socket option deprecated\n");
> - /* For UDP-style sockets, id specifies the association to query. */
> - asoc = sctp_id2assoc(sk, id);
> - if (!asoc)
> - return -EINVAL;
> -
> - list_for_each(pos, &asoc->peer.transport_addr_list) {
> - cnt ++;
> - }
> -
> - return cnt;
> -}
> -
> -/*
> - * Old API for getting list of peer addresses. Does not work for 32-bit
> - * programs running on a 64-bit kernel
> - */
> -static int sctp_getsockopt_peer_addrs_old(struct sock *sk, int len,
> - char __user *optval,
> - int __user *optlen)
> -{
> - struct sctp_association *asoc;
> - int cnt = 0;
> - struct sctp_getaddrs_old getaddrs;
> - struct sctp_transport *from;
> - void __user *to;
> - union sctp_addr temp;
> - struct sctp_sock *sp = sctp_sk(sk);
> - int addrlen;
> -
> - if (len < sizeof(struct sctp_getaddrs_old))
> - return -EINVAL;
> -
> - len = sizeof(struct sctp_getaddrs_old);
> -
> - if (copy_from_user(&getaddrs, optval, len))
> - return -EFAULT;
> -
> - if (getaddrs.addr_num <= 0) return -EINVAL;
> -
> - printk(KERN_WARNING "SCTP: Use of SCTP_GET_PEER_ADDRS_OLD "
> - "socket option deprecated\n");
> -
> - /* For UDP-style sockets, id specifies the association to query. */
> - asoc = sctp_id2assoc(sk, getaddrs.assoc_id);
> - if (!asoc)
> - return -EINVAL;
> -
> - to = (void __user *)getaddrs.addrs;
> - list_for_each_entry(from, &asoc->peer.transport_addr_list,
> - transports) {
> - memcpy(&temp, &from->ipaddr, sizeof(temp));
> - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
> - addrlen = sctp_get_af_specific(sk->sk_family)->sockaddr_len;
> - if (copy_to_user(to, &temp, addrlen))
> - return -EFAULT;
> - to += addrlen ;
> - cnt ++;
> - if (cnt >= getaddrs.addr_num) break;
> - }
> - getaddrs.addr_num = cnt;
> - if (put_user(len, optlen))
> - return -EFAULT;
> - if (copy_to_user(optval, &getaddrs, len))
> - return -EFAULT;
> -
> - return 0;
> -}
>
> static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
> char __user *optval, int __user *optlen)
> @@ -4475,81 +4391,6 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
> return 0;
> }
>
> -static int sctp_getsockopt_local_addrs_num_old(struct sock *sk, int len,
> - char __user *optval,
> - int __user *optlen)
> -{
> - sctp_assoc_t id;
> - struct sctp_bind_addr *bp;
> - struct sctp_association *asoc;
> - struct sctp_sockaddr_entry *addr;
> - int cnt = 0;
> -
> - if (len < sizeof(sctp_assoc_t))
> - return -EINVAL;
> -
> - if (copy_from_user(&id, optval, sizeof(sctp_assoc_t)))
> - return -EFAULT;
> -
> - printk(KERN_WARNING "SCTP: Use of SCTP_GET_LOCAL_ADDRS_NUM_OLD "
> - "socket option deprecated\n");
> -
> - /*
> - * For UDP-style sockets, id specifies the association to query.
> - * If the id field is set to the value '0' then the locally bound
> - * addresses are returned without regard to any particular
> - * association.
> - */
> - if (0 == id) {
> - bp = &sctp_sk(sk)->ep->base.bind_addr;
> - } else {
> - asoc = sctp_id2assoc(sk, id);
> - if (!asoc)
> - return -EINVAL;
> - bp = &asoc->base.bind_addr;
> - }
> -
> - /* If the endpoint is bound to 0.0.0.0 or ::0, count the valid
> - * addresses from the global local address list.
> - */
> - if (sctp_list_single_entry(&bp->address_list)) {
> - addr = list_entry(bp->address_list.next,
> - struct sctp_sockaddr_entry, list);
> - if (sctp_is_any(sk, &addr->a)) {
> - rcu_read_lock();
> - list_for_each_entry_rcu(addr,
> - &sctp_local_addr_list, list) {
> - if (!addr->valid)
> - continue;
> -
> - if ((PF_INET == sk->sk_family) &&
> - (AF_INET6 == addr->a.sa.sa_family))
> - continue;
> -
> - if ((PF_INET6 == sk->sk_family) &&
> - inet_v6_ipv6only(sk) &&
> - (AF_INET == addr->a.sa.sa_family))
> - continue;
> -
> - cnt++;
> - }
> - rcu_read_unlock();
> - } else {
> - cnt = 1;
> - }
> - goto done;
> - }
> -
> - /* Protection on the bound address list is not needed,
> - * since in the socket option context we hold the socket lock,
> - * so there is no way that the bound address list can change.
> - */
> - list_for_each_entry(addr, &bp->address_list, list) {
> - cnt ++;
> - }
> -done:
> - return cnt;
> -}
>
> /* Helper function that copies local addresses to user and returns the number
> * of addresses copied.
> @@ -4637,112 +4478,6 @@ static int sctp_copy_laddrs(struct sock *sk, __u16 port, void *to,
> return cnt;
> }
>
> -/* Old API for getting list of local addresses. Does not work for 32-bit
> - * programs running on a 64-bit kernel
> - */
> -static int sctp_getsockopt_local_addrs_old(struct sock *sk, int len,
> - char __user *optval, int __user *optlen)
> -{
> - struct sctp_bind_addr *bp;
> - struct sctp_association *asoc;
> - int cnt = 0;
> - struct sctp_getaddrs_old getaddrs;
> - struct sctp_sockaddr_entry *addr;
> - void __user *to;
> - union sctp_addr temp;
> - struct sctp_sock *sp = sctp_sk(sk);
> - int addrlen;
> - int err = 0;
> - void *addrs;
> - void *buf;
> - int bytes_copied = 0;
> -
> - if (len < sizeof(struct sctp_getaddrs_old))
> - return -EINVAL;
> -
> - len = sizeof(struct sctp_getaddrs_old);
> - if (copy_from_user(&getaddrs, optval, len))
> - return -EFAULT;
> -
> - if (getaddrs.addr_num <= 0 ||
> - getaddrs.addr_num >= (INT_MAX / sizeof(union sctp_addr)))
> - return -EINVAL;
> -
> - printk(KERN_WARNING "SCTP: Use of SCTP_GET_LOCAL_ADDRS_OLD "
> - "socket option deprecated\n");
> -
> - /*
> - * For UDP-style sockets, id specifies the association to query.
> - * If the id field is set to the value '0' then the locally bound
> - * addresses are returned without regard to any particular
> - * association.
> - */
> - if (0 == getaddrs.assoc_id) {
> - bp = &sctp_sk(sk)->ep->base.bind_addr;
> - } else {
> - asoc = sctp_id2assoc(sk, getaddrs.assoc_id);
> - if (!asoc)
> - return -EINVAL;
> - bp = &asoc->base.bind_addr;
> - }
> -
> - to = getaddrs.addrs;
> -
> - /* Allocate space for a local instance of packed array to hold all
> - * the data. We store addresses here first and then put write them
> - * to the user in one shot.
> - */
> - addrs = kmalloc(sizeof(union sctp_addr) * getaddrs.addr_num,
> - GFP_KERNEL);
> - if (!addrs)
> - return -ENOMEM;
> -
> - /* If the endpoint is bound to 0.0.0.0 or ::0, get the valid
> - * addresses from the global local address list.
> - */
> - if (sctp_list_single_entry(&bp->address_list)) {
> - addr = list_entry(bp->address_list.next,
> - struct sctp_sockaddr_entry, list);
> - if (sctp_is_any(sk, &addr->a)) {
> - cnt = sctp_copy_laddrs_old(sk, bp->port,
> - getaddrs.addr_num,
> - addrs, &bytes_copied);
> - goto copy_getaddrs;
> - }
> - }
> -
> - buf = addrs;
> - /* Protection on the bound address list is not needed since
> - * in the socket option context we hold a socket lock and
> - * thus the bound address list can't change.
> - */
> - list_for_each_entry(addr, &bp->address_list, list) {
> - memcpy(&temp, &addr->a, sizeof(temp));
> - sctp_get_pf_specific(sk->sk_family)->addr_v4map(sp, &temp);
> - addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
> - memcpy(buf, &temp, addrlen);
> - buf += addrlen;
> - bytes_copied += addrlen;
> - cnt ++;
> - if (cnt >= getaddrs.addr_num) break;
> - }
> -
> -copy_getaddrs:
> - /* copy the entire address list into the user provided space */
> - if (copy_to_user(to, addrs, bytes_copied)) {
> - err = -EFAULT;
> - goto error;
> - }
> -
> - /* copy the leading structure back to user */
> - getaddrs.addr_num = cnt;
> - if (copy_to_user(optval, &getaddrs, len))
> - err = -EFAULT;
> -
> -error:
> - kfree(addrs);
> - return err;
> -}
>
> static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
> char __user *optval, int __user *optlen)
> @@ -5593,22 +5328,6 @@ SCTP_STATIC int sctp_getsockopt(struct sock *sk, int level, int optname,
> case SCTP_INITMSG:
> retval = sctp_getsockopt_initmsg(sk, len, optval, optlen);
> break;
> - case SCTP_GET_PEER_ADDRS_NUM_OLD:
> - retval = sctp_getsockopt_peer_addrs_num_old(sk, len, optval,
> - optlen);
> - break;
> - case SCTP_GET_LOCAL_ADDRS_NUM_OLD:
> - retval = sctp_getsockopt_local_addrs_num_old(sk, len, optval,
> - optlen);
> - break;
> - case SCTP_GET_PEER_ADDRS_OLD:
> - retval = sctp_getsockopt_peer_addrs_old(sk, len, optval,
> - optlen);
> - break;
> - case SCTP_GET_LOCAL_ADDRS_OLD:
> - retval = sctp_getsockopt_local_addrs_old(sk, len, optval,
> - optlen);
> - break;
> case SCTP_GET_PEER_ADDRS:
> retval = sctp_getsockopt_peer_addrs(sk, len, optval,
> optlen);
>
^ permalink raw reply
* Re: [PATCH 4/5] page allocator: Pre-emptively wake kswapd when high-order watermarks are hit
From: David Rientjes @ 2009-10-22 19:41 UTC (permalink / raw)
To: Mel Gorman
Cc: Frans Pop, Jiri Kosina, Sven Geggus, Karol Lewandowski,
Tobias Oetiker, Rafael J. Wysocki, David Miller, Reinette Chatre,
Kalle Valo, KOSAKI Motohiro, Mohamed Abbas, Jens Axboe,
John W. Linville, Pekka Enberg, Bartlomiej Zolnierkiewicz,
Greg Kroah-Hartman, Stephan von Krawczynski, Kernel Testers List,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
In-Reply-To: <1256221356-26049-5-git-send-email-mel-wPRd99KPJ+uzQB+pC5nmwQ@public.gmane.org>
On Thu, 22 Oct 2009, Mel Gorman wrote:
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 7f2aa3e..851df40 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1596,6 +1596,17 @@ try_next_zone:
> return page;
> }
>
> +static inline
> +void wake_all_kswapd(unsigned int order, struct zonelist *zonelist,
> + enum zone_type high_zoneidx)
> +{
> + struct zoneref *z;
> + struct zone *zone;
> +
> + for_each_zone_zonelist(zone, z, zonelist, high_zoneidx)
> + wakeup_kswapd(zone, order);
> +}
> +
> static inline int
> should_alloc_retry(gfp_t gfp_mask, unsigned int order,
> unsigned long pages_reclaimed)
> @@ -1730,18 +1741,18 @@ __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order,
> congestion_wait(BLK_RW_ASYNC, HZ/50);
> } while (!page && (gfp_mask & __GFP_NOFAIL));
>
> - return page;
> -}
> -
> -static inline
> -void wake_all_kswapd(unsigned int order, struct zonelist *zonelist,
> - enum zone_type high_zoneidx)
> -{
> - struct zoneref *z;
> - struct zone *zone;
> + /*
> + * If after a high-order allocation we are now below watermarks,
> + * pre-emptively kick kswapd rather than having the next allocation
> + * fail and have to wake up kswapd, potentially failing GFP_ATOMIC
> + * allocations or entering direct reclaim
> + */
> + if (unlikely(order) && page && !zone_watermark_ok(preferred_zone, order,
> + preferred_zone->watermark[ALLOC_WMARK_LOW],
> + zone_idx(preferred_zone), ALLOC_WMARK_LOW))
> + wake_all_kswapd(order, zonelist, high_zoneidx);
>
> - for_each_zone_zonelist(zone, z, zonelist, high_zoneidx)
> - wakeup_kswapd(zone, order);
> + return page;
> }
>
> static inline int
Hmm, is this really supposed to be added to __alloc_pages_high_priority()?
By the patch description I was expecting kswapd to be woken up
preemptively whenever the preferred zone is below ALLOC_WMARK_LOW and
we're known to have just allocated at a higher order, not just when
current was oom killed (when we should already be freeing a _lot_ of
memory soon) or is doing a higher order allocation during direct reclaim.
For the best coverage, it would have to be add the branch to the fastpath.
That seems fine for a debugging aid and to see if progress is being made
on the GFP_ATOMIC allocation issues, but doesn't seem like it should make
its way to mainline, the subsequent GFP_ATOMIC allocation could already be
happening and in the page allocator's slowpath at this point that this
wakeup becomes unnecessary.
If this is moved to the fastpath, why is this wake_all_kswapd() and not
wakeup_kswapd(preferred_zone, order)? Do we need to kick kswapd in all
zones even though they may be free just because preferred_zone is now
below the watermark?
Wouldn't it be better to do this on page_zone(page) instead of
preferred_zone anyway?
^ permalink raw reply
* [PATCH] DRIVERS: NET: USB: DM9601 driver can drive a device not supported yet, add support for it
From: Janusz Krzysztofik @ 2009-10-22 18:25 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: netdev
Hi,
I found that the current version of drivers/net/usb/dm9601.c can be used to
successfully drive a low-power, low-cost network adapter with USB ID
0a46:9000, based on a DM9000E chipset. As no device with this ID is yet
present in the kernel, I have created a patch that adds support for the device
to the dm9601 driver.
Created and tested against linux-2.6.32-rc5.
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
There seems to be plenty of those devices available on ebay recently, for example:
http://cgi.ebay.pl/USB-TO-Fast-Ethernet-Network-RJ45-Adapter-Converter-NIC_W0QQitemZ250458092252QQcmdZViewItemQQptZUK_Computing_Networking_SM?hash=item3a507732dc
--- linux-2.6.32-rc5/drivers/net/usb/dm9601.c.orig 2009-10-22 20:14:00.000000000 +0200
+++ linux-2.6.32-rc5/drivers/net/usb/dm9601.c 2009-10-22 20:14:04.000000000 +0200
@@ -649,6 +649,10 @@ static const struct usb_device_id produc
USB_DEVICE(0x0fe6, 0x8101), /* DM9601 USB to Fast Ethernet Adapter */
.driver_info = (unsigned long)&dm9601_info,
},
+ {
+ USB_DEVICE(0x0a46, 0x9000), /* DM9000E */
+ .driver_info = (unsigned long)&dm9601_info,
+ },
{}, // END
};
^ 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