* Re: [PATCH -mm] ath5k: remove sysctl(2) support
From: Jiri Slaby @ 2007-08-23 20:22 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: jeff, linville, netdev
In-Reply-To: <20070823083351.GA31289@localhost.sw.ru>
Alexey Dobriyan napsal(a):
> sysctl(2) is supported but frozen.
I've posted similar patch yesterday:
http://marc.info/?l=linux-mm-commits&m=118782442602108&w=2
> Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru>
> ---
>
> drivers/net/wireless/ath5k_base.c | 21 ++++++---------------
> 1 file changed, 6 insertions(+), 15 deletions(-)
>
> --- a/drivers/net/wireless/ath5k_base.c
> +++ b/drivers/net/wireless/ath5k_base.c
> @@ -2438,21 +2438,12 @@ static struct pci_driver ath_pci_drv_id = {
> .resume = ath_pci_resume,
> };
>
> -/*
> - * Static (i.e. global) sysctls. Note that the hal sysctls
> - * are located under ours by sharing the setting for DEV_ATH.
> - */
> -enum {
> - DEV_ATH = 9, /* XXX known by hal */
> -};
> -
> static int mincalibrate = 1;
> static int maxcalibrate = INT_MAX / 1000;
> -#define CTL_AUTO -2 /* cannot be CTL_ANY or CTL_NONE */
>
> static ctl_table ath_static_sysctls[] = {
> #if AR_DEBUG
> - { .ctl_name = CTL_AUTO,
> + {
> .procname = "debug",
> .mode = 0644,
> .data = &ath_debug,
> @@ -2460,28 +2451,28 @@ static ctl_table ath_static_sysctls[] = {
> .proc_handler = proc_dointvec
> },
> #endif
> - { .ctl_name = CTL_AUTO,
> + {
> .procname = "countrycode",
> .mode = 0444,
> .data = &countrycode,
> .maxlen = sizeof(countrycode),
> .proc_handler = proc_dointvec
> },
> - { .ctl_name = CTL_AUTO,
> + {
> .procname = "outdoor",
> .mode = 0444,
> .data = &outdoor,
> .maxlen = sizeof(outdoor),
> .proc_handler = proc_dointvec
> },
> - { .ctl_name = CTL_AUTO,
> + {
> .procname = "xchanmode",
> .mode = 0444,
> .data = &xchanmode,
> .maxlen = sizeof(xchanmode),
> .proc_handler = proc_dointvec
> },
> - { .ctl_name = CTL_AUTO,
> + {
> .procname = "calibrate",
> .mode = 0644,
> .data = &ath_calinterval,
> @@ -2493,7 +2484,7 @@ static ctl_table ath_static_sysctls[] = {
> { 0 }
> };
> static ctl_table ath_ath_table[] = {
> - { .ctl_name = DEV_ATH,
> + {
> .procname = "ath",
> .mode = 0555,
> .child = ath_static_sysctls
Anyway thanks!
--
Jiri Slaby (jirislaby@gmail.com)
Faculty of Informatics, Masaryk University
^ permalink raw reply
* Re: [RFC 1/1] Net: add ath5k wireless driver
From: John W. Linville @ 2007-08-23 20:56 UTC (permalink / raw)
To: Jiri Slaby
Cc: Andrew Morton, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
jgarzik-e+AXbWqSrlAAvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <17440296431036922992-2EuRcrBQ8V0@public.gmane.org>
On Sun, Aug 12, 2007 at 05:33:16PM +0200, Jiri Slaby wrote:
> add ath5k wireless driver
>
> Signed-off-by: Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Review still pending, but I went ahead and added this on the 'ath5k'
branch of wireless-dev. It is available on 'everything' as well.
Thanks,
John
--
John W. Linville
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
^ permalink raw reply
* [ofa-general] [PATCH RFC] iw_cxgb3: Support "iwarp-only" interfaces to avoid 4-tuple conflicts with the host stack.
From: Steve Wise @ 2007-08-23 21:39 UTC (permalink / raw)
To: rdreier; +Cc: netdev, ewg, general, linux-kernel
Roland/All,
Here is the first swipe at keeping iwarp connections on their own ip
addresses to avoid conflicts with the host stack.
- this is a request for comments
- it is not yet tested fully (tested a prototype of the initial concept)
- still needs serialization/locking
- stays in our RDMA sandbox ;-)
For background reading (if you dare), see:
http://www.mail-archive.com/general@lists.openfabrics.org/msg05162.html
and
http://www.mail-archive.com/netdev@vger.kernel.org/msg44312.html
Also: I'm on vacation starting tomorrow until Tuesday 9/4. I'll address
comments when I return...
Steve.
---
iw_cxgb3: Support "iwarp-only" interfaces to avoid 4-tuple conflicts with
the host stack.
Design:
The sysadmin creates "for iwarp use only" alias interfaces of the form
"devname:iw*" where devname is the native interface name (eg eth0) for the
iwarp netdev device. The alias label can be anything starting with "iw".
The "iw" immediately after the ':' is the key used by the iwarp driver.
EG:
ifconfig eth0 192.168.70.123 up
ifconfig eth0:iw1 192.168.71.123 up
ifconfig eth0:iw2 192.168.72.123 up
In the above example, 192.168.70/24 is for TCP traffic, while
192.168.71/24 and 192.168.72/24 are for iWARP/RDMA use.
The rdma-only interface must be on its own subnet. This allows routing
all rdma traffic onto this interface.
The iWARP driver must translate all listens on address 0.0.0.0 to the
set of rdma-only ip addresses. This prevents incoming connects to the
TCP ipaddresses from going up the rdma stack.
Implementation Details:
- The iwarp driver registers for inetaddr events via
register_inetaddr_notifier(). This allows tracking the iwarp-only
addresses/subnets as they get added and deleted. The iwarp driver
maintains a list of the current iwarp-only addresses.
- The iwarp driver builds the list of iwarp-only addresses for its devices
at module insert time. This is needed because the inetaddr notifier
callbacks don't "replay" address-add events when someone registers.
So the driver must build the initial list at module load time.
- When a listen is done on address 0.0.0.0, then the iwarp driver must
translate that into a set of listens on the iwarp-only addresses.
- When a new iwarp-only address is added or removed, the iwarp driver
must traverse the set of listening endpoints and update them accordingly.
This allows an application to bind to 0.0.0.0 prior to the iwarp-only
interfaces being configured. It also allows changing the iwarp-only set
of addresses and getting the expected behavior for apps already bound
to 0.0.0.0.
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
---
drivers/infiniband/hw/cxgb3/iwch.c | 116 +++++++++++++++++
drivers/infiniband/hw/cxgb3/iwch.h | 10 +
drivers/infiniband/hw/cxgb3/iwch_cm.c | 229 ++++++++++++++++++++++++++-------
drivers/infiniband/hw/cxgb3/iwch_cm.h | 11 +-
4 files changed, 318 insertions(+), 48 deletions(-)
diff --git a/drivers/infiniband/hw/cxgb3/iwch.c b/drivers/infiniband/hw/cxgb3/iwch.c
index 0315c9d..da57b77 100644
--- a/drivers/infiniband/hw/cxgb3/iwch.c
+++ b/drivers/infiniband/hw/cxgb3/iwch.c
@@ -63,6 +63,115 @@ struct cxgb3_client t3c_client = {
static LIST_HEAD(dev_list);
static DEFINE_MUTEX(dev_mutex);
+static void insert_ifa(struct iwch_dev *rnicp, struct in_ifaddr *ifa)
+{
+ struct iwch_addrlist *addr;
+
+ addr = kmalloc(sizeof *addr, GFP_KERNEL);
+ if (!addr) {
+ printk(KERN_ERR MOD "%s - failed to alloc memory!\n",
+ __FUNCTION__);
+ return;
+ }
+ addr->ifa = ifa;
+ list_add_tail(&addr->entry, &rnicp->addrlist);
+}
+
+static void remove_ifa(struct iwch_dev *rnicp, struct in_ifaddr *ifa)
+{
+ struct iwch_addrlist *addr, *tmp;
+
+ list_for_each_entry_safe(addr, tmp, &rnicp->addrlist, entry) {
+ if (addr->ifa == ifa) {
+ list_del_init(&addr->entry);
+ kfree(addr);
+ return;
+ }
+ }
+}
+
+static int netdev_is_ours(struct iwch_dev *rnicp, struct net_device *netdev)
+{
+ int i;
+
+ for (i = 0; i < rnicp->rdev.port_info.nports; i++)
+ if (netdev == rnicp->rdev.port_info.lldevs[i])
+ return 1;
+ return 0;
+}
+
+static inline int is_iwarp_label(char *label)
+{
+ char *colon;
+
+ colon = strchr(label, ':');
+ if (colon && !strncmp(colon+1, "iw", 2))
+ return 1;
+ return 0;
+}
+
+static int nb_callback(struct notifier_block *self, unsigned long event,
+ void *ctx)
+{
+ struct in_ifaddr *ifa = ctx;
+ struct iwch_dev *rnicp = container_of(self, struct iwch_dev, nb);
+
+ printk(KERN_INFO "%s rnicp %p event %lx\n", __FUNCTION__, rnicp, event);
+
+ switch (event) {
+ case NETDEV_UP:
+ if (netdev_is_ours(rnicp, ifa->ifa_dev->dev) &&
+ is_iwarp_label(ifa->ifa_label)) {
+ printk(KERN_INFO "label %s addr 0x%x added\n",
+ ifa->ifa_label, ifa->ifa_address);
+ insert_ifa(rnicp, ifa);
+ iwch_listeners_add_addr(rnicp, ifa->ifa_address);
+ }
+ break;
+ case NETDEV_DOWN:
+ if (netdev_is_ours(rnicp, ifa->ifa_dev->dev) &&
+ is_iwarp_label(ifa->ifa_label)) {
+ printk(KERN_INFO "label %s addr 0x%x deleted\n",
+ ifa->ifa_label, ifa->ifa_address);
+ iwch_listeners_del_addr(rnicp, ifa->ifa_address);
+ remove_ifa(rnicp, ifa);
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static void delete_addrlist(struct iwch_dev *rnicp)
+{
+ struct iwch_addrlist *addr, *tmp;
+
+ list_for_each_entry_safe(addr, tmp, &rnicp->addrlist, entry) {
+ list_del_init(&addr->entry);
+ kfree(addr);
+ }
+}
+
+static void populate_addrlist(struct iwch_dev *rnicp)
+{
+ int i;
+ struct in_device *indev;
+
+ for (i = 0; i < rnicp->rdev.port_info.nports; i++) {
+ indev = in_dev_get(rnicp->rdev.port_info.lldevs[i]);
+ if (!indev)
+ continue;
+ for_ifa(indev)
+ if (is_iwarp_label(ifa->ifa_label)) {
+ printk(KERN_INFO "label %s addr 0x%x added\n",
+ ifa->ifa_label, ifa->ifa_address);
+ insert_ifa(rnicp, ifa);
+ }
+ endfor_ifa(indev);
+ }
+}
+
static void rnic_init(struct iwch_dev *rnicp)
{
PDBG("%s iwch_dev %p\n", __FUNCTION__, rnicp);
@@ -70,6 +179,11 @@ static void rnic_init(struct iwch_dev *r
idr_init(&rnicp->qpidr);
idr_init(&rnicp->mmidr);
spin_lock_init(&rnicp->lock);
+ INIT_LIST_HEAD(&rnicp->addrlist);
+ INIT_LIST_HEAD(&rnicp->listeners);
+ rnicp->nb.notifier_call = nb_callback;
+ populate_addrlist(rnicp);
+ register_inetaddr_notifier(&rnicp->nb);
rnicp->attr.vendor_id = 0x168;
rnicp->attr.vendor_part_id = 7;
@@ -148,6 +262,8 @@ static void close_rnic_dev(struct t3cdev
mutex_lock(&dev_mutex);
list_for_each_entry_safe(dev, tmp, &dev_list, entry) {
if (dev->rdev.t3cdev_p == tdev) {
+ unregister_inetaddr_notifier(&dev->nb);
+ delete_addrlist(dev);
list_del(&dev->entry);
iwch_unregister_device(dev);
cxio_rdev_close(&dev->rdev);
diff --git a/drivers/infiniband/hw/cxgb3/iwch.h b/drivers/infiniband/hw/cxgb3/iwch.h
index caf4e60..4f9081e 100644
--- a/drivers/infiniband/hw/cxgb3/iwch.h
+++ b/drivers/infiniband/hw/cxgb3/iwch.h
@@ -36,6 +36,8 @@ #include <linux/mutex.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/idr.h>
+#include <linux/notifier.h>
+#include <linux/inetdevice.h>
#include <rdma/ib_verbs.h>
@@ -101,6 +103,11 @@ struct iwch_rnic_attributes {
u32 cq_overflow_detection;
};
+struct iwch_addrlist {
+ struct list_head entry;
+ struct in_ifaddr *ifa;
+};
+
struct iwch_dev {
struct ib_device ibdev;
struct cxio_rdev rdev;
@@ -111,6 +118,9 @@ struct iwch_dev {
struct idr mmidr;
spinlock_t lock;
struct list_head entry;
+ struct notifier_block nb;
+ struct list_head addrlist;
+ struct list_head listeners;
};
static inline struct iwch_dev *to_iwch_dev(struct ib_device *ibdev)
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index 20ba372..4cca2a2 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -1127,23 +1127,129 @@ static int act_open_rpl(struct t3cdev *t
return CPL_RET_BUF_DONE;
}
-static int listen_start(struct iwch_listen_ep *ep)
+static struct iwch_listen_entry *alloc_listener(struct iwch_listen_ep *ep,
+ __be32 addr)
+{
+ struct iwch_dev *h = to_iwch_dev(ep->com.cm_id->device);
+ struct iwch_listen_entry *le;
+
+ le = kmalloc(sizeof *le, GFP_KERNEL);
+ if (!le) {
+ printk(KERN_ERR MOD "%s - failed to alloc memory!\n",
+ __FUNCTION__);
+ return NULL;
+ }
+ le->stid = cxgb3_alloc_stid(h->rdev.t3cdev_p,
+ &t3c_client, ep);
+ if (le->stid == -1) {
+ printk(KERN_ERR MOD "%s - cannot alloc stid.\n",
+ __FUNCTION__);
+ kfree(le);
+ return NULL;
+ }
+ return le;
+}
+
+static void dealloc_listener(struct iwch_listen_ep *ep,
+ struct iwch_listen_entry *le)
+{
+ cxgb3_free_stid(ep->com.tdev, le->stid);
+ kfree(le);
+}
+
+static void dealloc_listener_list(struct iwch_listen_ep *ep)
+{
+ struct iwch_listen_entry *le, *tmp;
+
+ list_for_each_entry_safe(le, tmp, &ep->listeners, entry) {
+ list_del_init(&le->entry);
+ dealloc_listener(ep, le);
+ }
+}
+
+static int alloc_listener_list(struct iwch_listen_ep *ep)
+{
+ struct iwch_dev *h = to_iwch_dev(ep->com.cm_id->device);
+ struct iwch_addrlist *addr;
+ struct iwch_listen_entry *le;
+ int added=0;
+ int err = 0;
+
+ list_for_each_entry(addr, &h->addrlist, entry) {
+ if (ep->com.local_addr.sin_addr.s_addr == 0 ||
+ ep->com.local_addr.sin_addr.s_addr ==
+ addr->ifa->ifa_address) {
+ le = alloc_listener(ep, addr->ifa->ifa_address);
+ if (!le)
+ break;
+ list_add_tail(&le->entry, &ep->listeners);
+ added++;
+ }
+ }
+ if (ep->com.local_addr.sin_addr.s_addr != 0 && !added)
+ err = -EADDRNOTAVAIL;
+ goto out;
+ dealloc_listener_list(ep);
+out:
+ return err;
+}
+
+static int listen_stop_one(struct t3cdev *tdev, unsigned int stid)
{
struct sk_buff *skb;
- struct cpl_pass_open_req *req;
+ struct cpl_close_listserv_req *req;
+
+ PDBG("%s stid %u\n", __FUNCTION__, stid);
+ skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
+ if (!skb) {
+ printk(KERN_ERR MOD "%s - failed to alloc skb\n", __FUNCTION__);
+ return -ENOMEM;
+ }
+ req = (struct cpl_close_listserv_req *) skb_put(skb, sizeof(*req));
+ req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+ req->cpu_idx = 0;
+ OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, stid));
+ skb->priority = 1;
+ cxgb3_ofld_send(tdev, skb);
+ return 0;
+}
+
+static void listen_stop(struct iwch_listen_ep *ep)
+{
+ struct iwch_listen_entry *le, *tmp;
+ int err;
PDBG("%s ep %p\n", __FUNCTION__, ep);
+ list_for_each_entry_safe(le, tmp, &ep->listeners, entry) {
+ err = listen_stop_one(ep->com.tdev, le->stid);
+ if (err) {
+ ep->com.rpl_err = err;
+ ep->com.rpl_done = 1;
+ break;
+ }
+ }
+ return;
+}
+
+static int listen_start_one(struct t3cdev *tdev, unsigned int stid,
+ __be32 addr, __be16 port)
+{
+ struct sk_buff *skb;
+ struct cpl_pass_open_req *req;
+
+ PDBG("%s stid %u addr %x port %x\n", __FUNCTION__, stid, ntohl(addr),
+ ntohs(port));
skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
if (!skb) {
- printk(KERN_ERR MOD "t3c_listen_start failed to alloc skb!\n");
+ printk(KERN_ERR MOD "%s - failed to alloc skb\n", __FUNCTION__);
return -ENOMEM;
}
req = (struct cpl_pass_open_req *) skb_put(skb, sizeof(*req));
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
- OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, ep->stid));
- req->local_port = ep->com.local_addr.sin_port;
- req->local_ip = ep->com.local_addr.sin_addr.s_addr;
+ OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, stid));
+ req->local_port = port;
+ req->local_ip = addr;
req->peer_port = 0;
req->peer_ip = 0;
req->peer_netmask = 0;
@@ -1152,10 +1258,30 @@ static int listen_start(struct iwch_list
req->opt1 = htonl(V_CONN_POLICY(CPL_CONN_POLICY_ASK));
skb->priority = 1;
- cxgb3_ofld_send(ep->com.tdev, skb);
+ cxgb3_ofld_send(tdev, skb);
return 0;
}
+static void listen_start(struct iwch_listen_ep *ep)
+{
+ struct iwch_listen_entry *le, *tmp;
+ int err;
+
+ PDBG("%s ep %p\n", __FUNCTION__, ep);
+ list_for_each_entry_safe(le, tmp, &ep->listeners, entry) {
+ err = listen_start_one(ep->com.tdev, le->stid, le->addr,
+ ep->com.local_addr.sin_port);
+ if (err)
+ goto fail;
+ }
+ return;
+fail:
+ listen_stop(ep);
+ ep->com.rpl_err = err;
+ ep->com.rpl_done = 1;
+ return;
+}
+
static int pass_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
{
struct iwch_listen_ep *ep = ctx;
@@ -1170,39 +1296,56 @@ static int pass_open_rpl(struct t3cdev *
return CPL_RET_BUF_DONE;
}
-static int listen_stop(struct iwch_listen_ep *ep)
-{
- struct sk_buff *skb;
- struct cpl_close_listserv_req *req;
-
- PDBG("%s ep %p\n", __FUNCTION__, ep);
- skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
- if (!skb) {
- printk(KERN_ERR MOD "%s - failed to alloc skb\n", __FUNCTION__);
- return -ENOMEM;
- }
- req = (struct cpl_close_listserv_req *) skb_put(skb, sizeof(*req));
- req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
- req->cpu_idx = 0;
- OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid));
- skb->priority = 1;
- cxgb3_ofld_send(ep->com.tdev, skb);
- return 0;
-}
-
static int close_listsrv_rpl(struct t3cdev *tdev, struct sk_buff *skb,
void *ctx)
{
struct iwch_listen_ep *ep = ctx;
struct cpl_close_listserv_rpl *rpl = cplhdr(skb);
- PDBG("%s ep %p\n", __FUNCTION__, ep);
- ep->com.rpl_err = status2errno(rpl->status);
- ep->com.rpl_done = 1;
- wake_up(&ep->com.waitq);
+ PDBG("%s ep %p stid %u\n", __FUNCTION__, ep, GET_TID(rpl));
+ if (!ep->com.rpl_done) {
+ ep->com.rpl_err = status2errno(rpl->status);
+ ep->com.rpl_done = 1;
+ wake_up(&ep->com.waitq);
+ }
return CPL_RET_BUF_DONE;
}
+void iwch_listeners_add_addr(struct iwch_dev *rnicp, __be32 addr)
+{
+ struct iwch_listen_ep *listen_ep;
+ struct iwch_listen_entry *le;
+
+ list_for_each_entry(listen_ep, &rnicp->listeners, entry) {
+ if (listen_ep->com.local_addr.sin_addr.s_addr)
+ continue;
+ le = alloc_listener(listen_ep, addr);
+ if (le) {
+ list_add_tail(&le->entry, &listen_ep->listeners);
+ listen_start_one(listen_ep->com.tdev, le->stid, addr,
+ listen_ep->com.local_addr.sin_port);
+ }
+ }
+}
+
+void iwch_listeners_del_addr(struct iwch_dev *rnicp, __be32 addr)
+{
+ struct iwch_listen_ep *listen_ep;
+ struct iwch_listen_entry *le, *tmp;
+
+ list_for_each_entry(listen_ep, &rnicp->listeners, entry) {
+ if (listen_ep->com.local_addr.sin_addr.s_addr)
+ continue;
+ list_for_each_entry_safe(le, tmp, &listen_ep->listeners,
+ entry)
+ if (le->addr == addr) {
+ listen_stop_one(listen_ep->com.tdev, le->stid);
+ list_del_init(&le->entry);
+ dealloc_listener(listen_ep, le);
+ }
+ }
+}
+
static void accept_cr(struct iwch_ep *ep, __be32 peer_ip, struct sk_buff *skb)
{
struct cpl_pass_accept_rpl *rpl;
@@ -1887,31 +2030,23 @@ int iwch_create_listen(struct iw_cm_id *
ep->com.cm_id = cm_id;
ep->backlog = backlog;
ep->com.local_addr = cm_id->local_addr;
+ INIT_LIST_HEAD(&ep->listeners);
- /*
- * Allocate a server TID.
- */
- ep->stid = cxgb3_alloc_stid(h->rdev.t3cdev_p, &t3c_client, ep);
- if (ep->stid == -1) {
- printk(KERN_ERR MOD "%s - cannot alloc atid.\n", __FUNCTION__);
- err = -ENOMEM;
+ err = alloc_listener_list(ep);
+ if (err)
goto fail2;
- }
state_set(&ep->com, LISTEN);
- err = listen_start(ep);
- if (err)
- goto fail3;
+ listen_start(ep);
- /* wait for pass_open_rpl */
+ /* wait for last pass_open_rpl */
wait_event(ep->com.waitq, ep->com.rpl_done);
err = ep->com.rpl_err;
if (!err) {
cm_id->provider_data = ep;
goto out;
}
-fail3:
- cxgb3_free_stid(ep->com.tdev, ep->stid);
+ dealloc_listener_list(ep);
fail2:
cm_id->rem_ref(cm_id);
put_ep(&ep->com);
@@ -1931,10 +2066,10 @@ int iwch_destroy_listen(struct iw_cm_id
state_set(&ep->com, DEAD);
ep->com.rpl_done = 0;
ep->com.rpl_err = 0;
- err = listen_stop(ep);
+ listen_stop(ep);
wait_event(ep->com.waitq, ep->com.rpl_done);
- cxgb3_free_stid(ep->com.tdev, ep->stid);
err = ep->com.rpl_err;
+ dealloc_listener_list(ep);
cm_id->rem_ref(cm_id);
put_ep(&ep->com);
return err;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.h b/drivers/infiniband/hw/cxgb3/iwch_cm.h
index 6107e7c..2aafc07 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.h
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.h
@@ -162,9 +162,16 @@ struct iwch_ep_common {
int rpl_err;
};
+struct iwch_listen_entry {
+ struct list_head entry;
+ unsigned int stid;
+ __be32 addr;
+};
+
struct iwch_listen_ep {
+ struct list_head entry;
struct iwch_ep_common com;
- unsigned int stid;
+ struct list_head listeners;
int backlog;
};
@@ -222,6 +229,8 @@ int iwch_resume_tid(struct iwch_ep *ep);
void __free_ep(struct kref *kref);
void iwch_rearp(struct iwch_ep *ep);
int iwch_ep_redirect(void *ctx, struct dst_entry *old, struct dst_entry *new, struct l2t_entry *l2t);
+void iwch_listeners_add_addr(struct iwch_dev *rnicp, __be32 addr);
+void iwch_listeners_del_addr(struct iwch_dev *rnicp, __be32 addr);
int __init iwch_cm_init(void);
void __exit iwch_cm_term(void);
^ permalink raw reply related
* Re: [PATCH 0/3] cxgb3 driver update
From: Divy Le Ray @ 2007-08-23 22:03 UTC (permalink / raw)
To: Al Viro; +Cc: Jeff Garzik, netdev, linux-kernel, Steve Wise
In-Reply-To: <20070823070216.GI21089@ftp.linux.org.uk>
Hi Al,
> Speaking of cxgb3, could you explain what the hell is
> static int do_term(struct t3cdev *dev, struct sk_buff *skb)
> {
> unsigned int hwtid = ntohl(skb->priority) >> 8 & 0xfffff;
> doing? AFAIK, skb->priority is not net-endian...
>
the RDMA connection id is saved in the skb's priority field for TERM
messages
because it is not in the CPL message that comes up from the hardware.
Yet the RDMA driver needs it, so sge.c::process_responses() overloads
the skb's priority and csum with these values.
>
> Another odd place is
> int t3_seeprom_write(struct adapter *adapter, u32 addr, u32 data)
> {
> u16 val;
> int attempts = EEPROM_MAX_POLL;
> unsigned int base = adapter->params.pci.vpd_cap_addr;
>
> if ((addr >= EEPROMSIZE && addr != EEPROM_STAT_ADDR) || (addr
> & 3))
> return -EINVAL;
>
> pci_write_config_dword(adapter->pdev, base + PCI_VPD_DATA,
> cpu_to_le32(data));
> with callers like
> int t3_seeprom_wp(struct adapter *adapter, int enable)
> {
> return t3_seeprom_write(adapter, EEPROM_STAT_ADDR, enable ?
> 0xc : 0);
>
> IOW, you really get little-endian values passed to
> pci_write_config_dword()
> and it expects a host-endian as the last argument...
>
It looks like a bug. Thanks for spotting this.
Cheers,
Divy
^ permalink raw reply
* [ofa-general] Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: jamal @ 2007-08-23 22:04 UTC (permalink / raw)
To: David Miller
Cc: jagana, peter.p.waskiewicz.jr, herbert, gaagaan, Robert.Olsson,
kumarkr, rdreier, mcarlson, jeff, general, mchan, tgraf, netdev,
johnpol, shemminger, kaber, sri
In-Reply-To: <20070822.132145.90824527.davem@davemloft.net>
On Wed, 2007-22-08 at 13:21 -0700, David Miller wrote:
> From: Rick Jones <rick.jones2@hp.com>
> Date: Wed, 22 Aug 2007 10:09:37 -0700
>
> > Should it be any more or less worrysome than small packet
> > performance (eg the TCP_RR stuff I posted recently) being rather
> > worse with TSO enabled than with it disabled?
>
> That, like any such thing shown by the batching changes, is a bug
> to fix.
Possibly a bug - but you really should turn off TSO if you are doing
huge interactive transactions (which is fair because there is a clear
demarcation).
The litmus test is the same as any change that is supposed to improve
net performance - it has to demonstrate it is not intrusive and that it
improves (consistently) performance. The standard metrics are
{throughput, cpu-utilization, latency} i.e as long as one improves and
others remain zero, it would make sense. Yes, i am religious for
batching after all the invested sweat (and i continue to work on it
hoping to demystify) - the theory makes a lot of sense.
cheers,
jamal
^ permalink raw reply
* [PATCH 2.6.23 RESEND] cxgb3 - Fix dev->priv usage
From: Divy Le Ray @ 2007-08-23 22:06 UTC (permalink / raw)
To: jeff; +Cc: netdev, linux-kernel, swise
From: Divy Le Ray <divy@chelsio.com>
cxgb3 used netdev_priv() and dev->priv for different purposes.
In 2.6.23, netdev_priv() == dev->priv, cxgb3 needs a fix.
This patch is a partial backport of Dave Miller's changes in the
net-2.6.24 git branch.
Without this fix, cxgb3 crashes on 2.6.23.
Signed-off-by: Divy Le Ray <divy@chelsio.com>
---
drivers/net/cxgb3/adapter.h | 10 +++
drivers/net/cxgb3/cxgb3_main.c | 126 +++++++++++++++++++++----------------
drivers/net/cxgb3/cxgb3_offload.c | 6 +-
drivers/net/cxgb3/sge.c | 23 ++++---
drivers/net/cxgb3/t3cdev.h | 3 -
5 files changed, 100 insertions(+), 68 deletions(-)
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index ab72563..c1dc344 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -50,7 +50,9 @@ typedef irqreturn_t(*intr_handler_t) (int, void *);
struct vlan_group;
+struct adapter;
struct port_info {
+ struct adapter *adapter;
struct vlan_group *vlan_grp;
const struct port_type_info *port_type;
u8 port_id;
@@ -246,6 +248,14 @@ static inline void t3_write_reg(struct adapter *adapter, u32 reg_addr, u32 val)
writel(val, adapter->regs + reg_addr);
}
+/* Get the t3cdev associated with a net_device */
+static inline struct t3cdev *dev2t3cdev(struct net_device *dev)
+{
+ const struct port_info *pi = netdev_priv(dev);
+
+ return (struct t3cdev *)pi->adapter;
+}
+
static inline struct port_info *adap2pinfo(struct adapter *adap, int idx)
{
return netdev_priv(adap->port[idx]);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dc5d269..f3bf128 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -358,11 +358,14 @@ static int init_dummy_netdevs(struct adapter *adap)
for (j = 0; j < pi->nqsets - 1; j++) {
if (!adap->dummy_netdev[dummy_idx]) {
- nd = alloc_netdev(0, "", ether_setup);
+ struct port_info *p;
+
+ nd = alloc_netdev(sizeof(*p), "", ether_setup);
if (!nd)
goto free_all;
- nd->priv = adap;
+ p = netdev_priv(nd);
+ p->adapter = adap;
nd->weight = 64;
set_bit(__LINK_STATE_START, &nd->state);
adap->dummy_netdev[dummy_idx] = nd;
@@ -482,7 +485,8 @@ static ssize_t attr_store(struct device *d, struct device_attribute *attr,
#define CXGB3_SHOW(name, val_expr) \
static ssize_t format_##name(struct net_device *dev, char *buf) \
{ \
- struct adapter *adap = dev->priv; \
+ struct port_info *pi = netdev_priv(dev); \
+ struct adapter *adap = pi->adapter; \
return sprintf(buf, "%u\n", val_expr); \
} \
static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
@@ -493,7 +497,8 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
static ssize_t set_nfilters(struct net_device *dev, unsigned int val)
{
- struct adapter *adap = dev->priv;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adap = pi->adapter;
int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0;
if (adap->flags & FULL_INIT_DONE)
@@ -515,7 +520,8 @@ static ssize_t store_nfilters(struct device *d, struct device_attribute *attr,
static ssize_t set_nservers(struct net_device *dev, unsigned int val)
{
- struct adapter *adap = dev->priv;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adap = pi->adapter;
if (adap->flags & FULL_INIT_DONE)
return -EBUSY;
@@ -556,9 +562,10 @@ static struct attribute_group cxgb3_attr_group = {.attrs = cxgb3_attrs };
static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
char *buf, int sched)
{
- ssize_t len;
+ struct port_info *pi = netdev_priv(to_net_dev(d));
+ struct adapter *adap = pi->adapter;
unsigned int v, addr, bpt, cpt;
- struct adapter *adap = to_net_dev(d)->priv;
+ ssize_t len;
addr = A_TP_TX_MOD_Q1_Q0_RATE_LIMIT - sched / 2;
rtnl_lock();
@@ -581,10 +588,11 @@ static ssize_t tm_attr_show(struct device *d, struct device_attribute *attr,
static ssize_t tm_attr_store(struct device *d, struct device_attribute *attr,
const char *buf, size_t len, int sched)
{
+ struct port_info *pi = netdev_priv(to_net_dev(d));
+ struct adapter *adap = pi->adapter;
+ unsigned int val;
char *endp;
ssize_t ret;
- unsigned int val;
- struct adapter *adap = to_net_dev(d)->priv;
if (!capable(CAP_NET_ADMIN))
return -EPERM;
@@ -858,8 +866,9 @@ static void schedule_chk_task(struct adapter *adap)
static int offload_open(struct net_device *dev)
{
- struct adapter *adapter = dev->priv;
- struct t3cdev *tdev = T3CDEV(dev);
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
+ struct t3cdev *tdev = dev2t3cdev(dev);
int adap_up = adapter->open_device_map & PORT_MASK;
int err = 0;
@@ -924,10 +933,10 @@ static int offload_close(struct t3cdev *tdev)
static int cxgb_open(struct net_device *dev)
{
- int err;
- struct adapter *adapter = dev->priv;
struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
int other_ports = adapter->open_device_map & PORT_MASK;
+ int err;
if (!adapter->open_device_map && (err = cxgb_up(adapter)) < 0)
return err;
@@ -951,17 +960,17 @@ static int cxgb_open(struct net_device *dev)
static int cxgb_close(struct net_device *dev)
{
- struct adapter *adapter = dev->priv;
- struct port_info *p = netdev_priv(dev);
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
- t3_port_intr_disable(adapter, p->port_id);
+ t3_port_intr_disable(adapter, pi->port_id);
netif_stop_queue(dev);
- p->phy.ops->power_down(&p->phy, 1);
+ pi->phy.ops->power_down(&pi->phy, 1);
netif_carrier_off(dev);
- t3_mac_disable(&p->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
+ t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
spin_lock(&adapter->work_lock); /* sync with update task */
- clear_bit(p->port_id, &adapter->open_device_map);
+ clear_bit(pi->port_id, &adapter->open_device_map);
spin_unlock(&adapter->work_lock);
if (!(adapter->open_device_map & PORT_MASK))
@@ -976,13 +985,13 @@ static int cxgb_close(struct net_device *dev)
static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
{
- struct adapter *adapter = dev->priv;
- struct port_info *p = netdev_priv(dev);
- struct net_device_stats *ns = &p->netstats;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
+ struct net_device_stats *ns = &pi->netstats;
const struct mac_stats *pstats;
spin_lock(&adapter->stats_lock);
- pstats = t3_mac_update_stats(&p->mac);
+ pstats = t3_mac_update_stats(&pi->mac);
spin_unlock(&adapter->stats_lock);
ns->tx_bytes = pstats->tx_octets;
@@ -1015,14 +1024,16 @@ static struct net_device_stats *cxgb_get_stats(struct net_device *dev)
static u32 get_msglevel(struct net_device *dev)
{
- struct adapter *adapter = dev->priv;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
return adapter->msg_enable;
}
static void set_msglevel(struct net_device *dev, u32 val)
{
- struct adapter *adapter = dev->priv;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
adapter->msg_enable = val;
}
@@ -1096,8 +1107,9 @@ static int get_eeprom_len(struct net_device *dev)
static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
u32 fw_vers = 0;
- struct adapter *adapter = dev->priv;
t3_get_fw_version(adapter, &fw_vers);
@@ -1136,8 +1148,8 @@ static unsigned long collect_sge_port_stats(struct adapter *adapter,
static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
u64 *data)
{
- struct adapter *adapter = dev->priv;
struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
const struct mac_stats *s;
spin_lock(&adapter->stats_lock);
@@ -1205,7 +1217,8 @@ static inline void reg_block_dump(struct adapter *ap, void *buf,
static void get_regs(struct net_device *dev, struct ethtool_regs *regs,
void *buf)
{
- struct adapter *ap = dev->priv;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *ap = pi->adapter;
/*
* Version scheme:
@@ -1246,8 +1259,9 @@ static int restart_autoneg(struct net_device *dev)
static int cxgb3_phys_id(struct net_device *dev, u32 data)
{
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
int i;
- struct adapter *adapter = dev->priv;
if (data == 0)
data = 2;
@@ -1408,8 +1422,8 @@ static int set_rx_csum(struct net_device *dev, u32 data)
static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
{
- const struct adapter *adapter = dev->priv;
- const struct port_info *pi = netdev_priv(dev);
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
const struct qset_params *q = &adapter->params.sge.qset[pi->first_qset];
e->rx_max_pending = MAX_RX_BUFFERS;
@@ -1425,10 +1439,10 @@ static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
{
- int i;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
struct qset_params *q;
- struct adapter *adapter = dev->priv;
- const struct port_info *pi = netdev_priv(dev);
+ int i;
if (e->rx_pending > MAX_RX_BUFFERS ||
e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS ||
@@ -1457,7 +1471,8 @@ static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
{
- struct adapter *adapter = dev->priv;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
struct qset_params *qsp = &adapter->params.sge.qset[0];
struct sge_qset *qs = &adapter->sge.qs[0];
@@ -1471,7 +1486,8 @@ static int set_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
{
- struct adapter *adapter = dev->priv;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
struct qset_params *q = adapter->params.sge.qset;
c->rx_coalesce_usecs = q->coalesce_usecs;
@@ -1481,8 +1497,9 @@ static int get_coalesce(struct net_device *dev, struct ethtool_coalesce *c)
static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
u8 * data)
{
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
int i, err = 0;
- struct adapter *adapter = dev->priv;
u8 *buf = kmalloc(EEPROMSIZE, GFP_KERNEL);
if (!buf)
@@ -1501,10 +1518,11 @@ static int get_eeprom(struct net_device *dev, struct ethtool_eeprom *e,
static int set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
u8 * data)
{
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
+ u32 aligned_offset, aligned_len, *p;
u8 *buf;
int err = 0;
- u32 aligned_offset, aligned_len, *p;
- struct adapter *adapter = dev->priv;
if (eeprom->magic != EEPROM_MAGIC)
return -EINVAL;
@@ -1592,9 +1610,10 @@ static int in_range(int val, int lo, int hi)
static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
{
- int ret;
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
u32 cmd;
- struct adapter *adapter = dev->priv;
+ int ret;
if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
return -EFAULT;
@@ -1923,10 +1942,10 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
{
- int ret, mmd;
- struct adapter *adapter = dev->priv;
- struct port_info *pi = netdev_priv(dev);
struct mii_ioctl_data *data = if_mii(req);
+ struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
+ int ret, mmd;
switch (cmd) {
case SIOCGMIIPHY:
@@ -1994,9 +2013,9 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
{
- int ret;
- struct adapter *adapter = dev->priv;
struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
+ int ret;
if (new_mtu < 81) /* accommodate SACK */
return -EINVAL;
@@ -2013,8 +2032,8 @@ static int cxgb_change_mtu(struct net_device *dev, int new_mtu)
static int cxgb_set_mac_addr(struct net_device *dev, void *p)
{
- struct adapter *adapter = dev->priv;
struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
struct sockaddr *addr = p;
if (!is_valid_ether_addr(addr->sa_data))
@@ -2050,8 +2069,8 @@ static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p)
static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
{
- struct adapter *adapter = dev->priv;
struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
pi->vlan_grp = grp;
if (adapter->params.rev > 0)
@@ -2070,8 +2089,8 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
#ifdef CONFIG_NET_POLL_CONTROLLER
static void cxgb_netpoll(struct net_device *dev)
{
- struct adapter *adapter = dev->priv;
struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
int qidx;
for (qidx = pi->first_qset; qidx < pi->first_qset + pi->nqsets; qidx++) {
@@ -2433,6 +2452,7 @@ static int __devinit init_one(struct pci_dev *pdev,
adapter->port[i] = netdev;
pi = netdev_priv(netdev);
+ pi->adapter = adapter;
pi->rx_csum_offload = 1;
pi->nqsets = 1;
pi->first_qset = i;
@@ -2442,7 +2462,6 @@ static int __devinit init_one(struct pci_dev *pdev,
netdev->irq = pdev->irq;
netdev->mem_start = mmio_start;
netdev->mem_end = mmio_start + mmio_len - 1;
- netdev->priv = adapter;
netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
netdev->features |= NETIF_F_LLTX;
if (pci_using_dac)
@@ -2467,7 +2486,7 @@ static int __devinit init_one(struct pci_dev *pdev,
SET_ETHTOOL_OPS(netdev, &cxgb_ethtool_ops);
}
- pci_set_drvdata(pdev, adapter->port[0]);
+ pci_set_drvdata(pdev, adapter);
if (t3_prep_adapter(adapter, ai, 1) < 0) {
err = -ENODEV;
goto out_free_dev;
@@ -2547,11 +2566,10 @@ out_release_regions:
static void __devexit remove_one(struct pci_dev *pdev)
{
- struct net_device *dev = pci_get_drvdata(pdev);
+ struct adapter *adapter = pci_get_drvdata(pdev);
- if (dev) {
+ if (adapter) {
int i;
- struct adapter *adapter = dev->priv;
t3_sge_stop(adapter);
sysfs_remove_group(&adapter->port[0]->dev.kobj,
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
index e620ed4..83d3555 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -925,7 +925,7 @@ void cxgb_neigh_update(struct neighbour *neigh)
struct net_device *dev = neigh->dev;
if (dev && (is_offloading(dev))) {
- struct t3cdev *tdev = T3CDEV(dev);
+ struct t3cdev *tdev = dev2t3cdev(dev);
BUG_ON(!tdev);
t3_l2t_update(tdev, neigh);
@@ -973,9 +973,9 @@ void cxgb_redirect(struct dst_entry *old, struct dst_entry *new)
"device ignored.\n", __FUNCTION__);
return;
}
- tdev = T3CDEV(olddev);
+ tdev = dev2t3cdev(olddev);
BUG_ON(!tdev);
- if (tdev != T3CDEV(newdev)) {
+ if (tdev != dev2t3cdev(newdev)) {
printk(KERN_WARNING "%s: Redirect to different "
"offload device ignored.\n", __FUNCTION__);
return;
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index a2cfd68..58a5f60 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1073,7 +1073,7 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
{
unsigned int ndesc, pidx, credits, gen, compl;
const struct port_info *pi = netdev_priv(dev);
- struct adapter *adap = dev->priv;
+ struct adapter *adap = pi->adapter;
struct sge_qset *qs = dev2qset(dev);
struct sge_txq *q = &qs->txq[TXQ_ETH];
@@ -1326,7 +1326,8 @@ static void restart_ctrlq(unsigned long data)
struct sk_buff *skb;
struct sge_qset *qs = (struct sge_qset *)data;
struct sge_txq *q = &qs->txq[TXQ_CTRL];
- struct adapter *adap = qs->netdev->priv;
+ const struct port_info *pi = netdev_priv(qs->netdev);
+ struct adapter *adap = pi->adapter;
spin_lock(&q->lock);
again:reclaim_completed_tx_imm(q);
@@ -1531,7 +1532,8 @@ static void restart_offloadq(unsigned long data)
struct sk_buff *skb;
struct sge_qset *qs = (struct sge_qset *)data;
struct sge_txq *q = &qs->txq[TXQ_OFLD];
- struct adapter *adap = qs->netdev->priv;
+ const struct port_info *pi = netdev_priv(qs->netdev);
+ struct adapter *adap = pi->adapter;
spin_lock(&q->lock);
again:reclaim_completed_tx(adap, q);
@@ -1675,7 +1677,8 @@ static inline void deliver_partial_bundle(struct t3cdev *tdev,
*/
static int ofld_poll(struct net_device *dev, int *budget)
{
- struct adapter *adapter = dev->priv;
+ const struct port_info *pi = netdev_priv(dev);
+ struct adapter *adapter = pi->adapter;
struct sge_qset *qs = dev2qset(dev);
struct sge_rspq *q = &qs->rspq;
int work_done, limit = min(*budget, dev->quota), avail = limit;
@@ -2075,7 +2078,8 @@ static inline int is_pure_response(const struct rsp_desc *r)
*/
static int napi_rx_handler(struct net_device *dev, int *budget)
{
- struct adapter *adap = dev->priv;
+ const struct port_info *pi = netdev_priv(dev);
+ struct adapter *adap = pi->adapter;
struct sge_qset *qs = dev2qset(dev);
int effective_budget = min(*budget, dev->quota);
@@ -2205,7 +2209,8 @@ static inline int handle_responses(struct adapter *adap, struct sge_rspq *q)
irqreturn_t t3_sge_intr_msix(int irq, void *cookie)
{
struct sge_qset *qs = cookie;
- struct adapter *adap = qs->netdev->priv;
+ const struct port_info *pi = netdev_priv(qs->netdev);
+ struct adapter *adap = pi->adapter;
struct sge_rspq *q = &qs->rspq;
spin_lock(&q->lock);
@@ -2224,7 +2229,8 @@ irqreturn_t t3_sge_intr_msix(int irq, void *cookie)
irqreturn_t t3_sge_intr_msix_napi(int irq, void *cookie)
{
struct sge_qset *qs = cookie;
- struct adapter *adap = qs->netdev->priv;
+ const struct port_info *pi = netdev_priv(qs->netdev);
+ struct adapter *adap = pi->adapter;
struct sge_rspq *q = &qs->rspq;
spin_lock(&q->lock);
@@ -2508,7 +2514,8 @@ static void sge_timer_cb(unsigned long data)
{
spinlock_t *lock;
struct sge_qset *qs = (struct sge_qset *)data;
- struct adapter *adap = qs->netdev->priv;
+ const struct port_info *pi = netdev_priv(qs->netdev);
+ struct adapter *adap = pi->adapter;
if (spin_trylock(&qs->txq[TXQ_ETH].lock)) {
reclaim_completed_tx(adap, &qs->txq[TXQ_ETH]);
diff --git a/drivers/net/cxgb3/t3cdev.h b/drivers/net/cxgb3/t3cdev.h
index fa4099b..77fcc1a 100644
--- a/drivers/net/cxgb3/t3cdev.h
+++ b/drivers/net/cxgb3/t3cdev.h
@@ -42,9 +42,6 @@
#define T3CNAMSIZ 16
-/* Get the t3cdev associated with a net_device */
-#define T3CDEV(netdev) (struct t3cdev *)(netdev->priv)
-
struct cxgb3_client;
enum t3ctype {
^ permalink raw reply related
* Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: jamal @ 2007-08-23 22:25 UTC (permalink / raw)
To: David Miller
Cc: rick.jones2, krkumar2, gaagaan, general, herbert, jagana, jeff,
johnpol, kaber, mcarlson, mchan, netdev, peter.p.waskiewicz.jr,
rdreier, Robert.Olsson, shemminger, sri, tgraf, xma
In-Reply-To: <1187906650.4279.16.camel@localhost>
On Thu, 2007-23-08 at 18:04 -0400, jamal wrote:
> The litmus test is the same as any change that is supposed to improve
> net performance - it has to demonstrate it is not intrusive and that it
> improves (consistently) performance. The standard metrics are
> {throughput, cpu-utilization, latency} i.e as long as one improves and
> others remain zero, it would make sense. Yes, i am religious for
> batching after all the invested sweat (and i continue to work on it
> hoping to demystify) - the theory makes a lot of sense.
Before someone jumps and strangles me ;-> By "litmus test" i meant as
applied to batching. [TSO already passed - iirc, it has been
demostranted to really not add much to throughput (cant improve much
over closeness to wire speed) but improve CPU utilization].
cheers,
jamal
^ permalink raw reply
* [patch 02/28] NET: Share correct feature code between bridging and bonding
From: Greg KH @ 2007-08-23 22:25 UTC (permalink / raw)
To: linux-kernel, stable, David Miller
Cc: Justin Forbes, Zwane Mwaikambo, Theodore Ts'o, Randy Dunlap,
Dave Jones, Chuck Wolber, Chris Wedgwood, Michael Krufky,
Chuck Ebbert, Domenico Andreoli, torvalds, akpm, alan, netdev,
Herbert Xu
In-Reply-To: <20070823221811.GA18559@kroah.com>
[-- Attachment #1: net-share-correct-feature-code-between-bridging-and-bonding.patch --]
[-- Type: text/plain, Size: 6843 bytes --]
-stable review patch. If anyone has any objections, please let us know.
------------------
[NET]: Share correct feature code between bridging and bonding
http://bugzilla.kernel.org/show_bug.cgi?id=8797 shows that the
bonding driver may produce bogus combinations of the checksum
flags and SG/TSO.
For example, if you bond devices with NETIF_F_HW_CSUM and
NETIF_F_IP_CSUM you'll end up with a bonding device that
has neither flag set. If both have TSO then this produces
an illegal combination.
The bridge device on the other hand has the correct code to
deal with this.
In fact, the same code can be used for both. So this patch
moves that logic into net/core/dev.c and uses it for both
bonding and bridging.
In the process I've made small adjustments such as only
setting GSO_ROBUST if at least one constituent device
supports it.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/net/bonding/bond_main.c | 30 +++++++++---------------------
include/linux/netdevice.h | 2 ++
net/bridge/br_device.c | 3 ++-
net/bridge/br_if.c | 28 ++++------------------------
net/core/dev.c | 38 ++++++++++++++++++++++++++++++++++++++
5 files changed, 55 insertions(+), 46 deletions(-)
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1233,43 +1233,31 @@ int bond_sethwaddr(struct net_device *bo
return 0;
}
-#define BOND_INTERSECT_FEATURES \
- (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO)
+#define BOND_VLAN_FEATURES \
+ (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \
+ NETIF_F_HW_VLAN_FILTER)
/*
* Compute the common dev->feature set available to all slaves. Some
- * feature bits are managed elsewhere, so preserve feature bits set on
- * master device that are not part of the examined set.
+ * feature bits are managed elsewhere, so preserve those feature bits
+ * on the master device.
*/
static int bond_compute_features(struct bonding *bond)
{
- unsigned long features = BOND_INTERSECT_FEATURES;
struct slave *slave;
struct net_device *bond_dev = bond->dev;
+ unsigned long features = bond_dev->features & ~BOND_VLAN_FEATURES;
unsigned short max_hard_header_len = ETH_HLEN;
int i;
bond_for_each_slave(bond, slave, i) {
- features &= (slave->dev->features & BOND_INTERSECT_FEATURES);
+ features = netdev_compute_features(features,
+ slave->dev->features);
if (slave->dev->hard_header_len > max_hard_header_len)
max_hard_header_len = slave->dev->hard_header_len;
}
- if ((features & NETIF_F_SG) &&
- !(features & NETIF_F_ALL_CSUM))
- features &= ~NETIF_F_SG;
-
- /*
- * features will include NETIF_F_TSO (NETIF_F_UFO) iff all
- * slave devices support NETIF_F_TSO (NETIF_F_UFO), which
- * implies that all slaves also support scatter-gather
- * (NETIF_F_SG), which implies that features also includes
- * NETIF_F_SG. So no need to check whether we have an
- * illegal combination of NETIF_F_{TSO,UFO} and
- * !NETIF_F_SG
- */
-
- features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES);
+ features |= (bond_dev->features & BOND_VLAN_FEATURES);
bond_dev->features = features;
bond_dev->hard_header_len = max_hard_header_len;
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1032,6 +1032,8 @@ extern void dev_seq_stop(struct seq_file
extern void linkwatch_run_queue(void);
+extern int netdev_compute_features(unsigned long all, unsigned long one);
+
static inline int net_gso_ok(int features, int gso_type)
{
int feature = gso_type << NETIF_F_GSO_SHIFT;
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -179,5 +179,6 @@ void br_dev_setup(struct net_device *dev
dev->priv_flags = IFF_EBRIDGE;
dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
- NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST;
+ NETIF_F_GSO_SOFTWARE | NETIF_F_NO_CSUM |
+ NETIF_F_GSO_ROBUST | NETIF_F_LLTX;
}
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -360,35 +360,15 @@ int br_min_mtu(const struct net_bridge *
void br_features_recompute(struct net_bridge *br)
{
struct net_bridge_port *p;
- unsigned long features, checksum;
+ unsigned long features;
- checksum = br->feature_mask & NETIF_F_ALL_CSUM ? NETIF_F_NO_CSUM : 0;
- features = br->feature_mask & ~NETIF_F_ALL_CSUM;
+ features = br->feature_mask;
list_for_each_entry(p, &br->port_list, list) {
- unsigned long feature = p->dev->features;
-
- if (checksum & NETIF_F_NO_CSUM && !(feature & NETIF_F_NO_CSUM))
- checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
- if (checksum & NETIF_F_HW_CSUM && !(feature & NETIF_F_HW_CSUM))
- checksum ^= NETIF_F_HW_CSUM | NETIF_F_IP_CSUM;
- if (!(feature & NETIF_F_IP_CSUM))
- checksum = 0;
-
- if (feature & NETIF_F_GSO)
- feature |= NETIF_F_GSO_SOFTWARE;
- feature |= NETIF_F_GSO;
-
- features &= feature;
+ features = netdev_compute_features(features, p->dev->features);
}
- if (!(checksum & NETIF_F_ALL_CSUM))
- features &= ~NETIF_F_SG;
- if (!(features & NETIF_F_SG))
- features &= ~NETIF_F_GSO_MASK;
-
- br->dev->features = features | checksum | NETIF_F_LLTX |
- NETIF_F_GSO_ROBUST;
+ br->dev->features = features;
}
/* called with RTNL */
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3635,6 +3635,44 @@ static int __init netdev_dma_register(vo
static int __init netdev_dma_register(void) { return -ENODEV; }
#endif /* CONFIG_NET_DMA */
+/**
+ * netdev_compute_feature - compute conjunction of two feature sets
+ * @all: first feature set
+ * @one: second feature set
+ *
+ * Computes a new feature set after adding a device with feature set
+ * @one to the master device with current feature set @all. Returns
+ * the new feature set.
+ */
+int netdev_compute_features(unsigned long all, unsigned long one)
+{
+ /* if device needs checksumming, downgrade to hw checksumming */
+ if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM))
+ all ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
+
+ /* if device can't do all checksum, downgrade to ipv4 */
+ if (all & NETIF_F_HW_CSUM && !(one & NETIF_F_HW_CSUM))
+ all ^= NETIF_F_HW_CSUM | NETIF_F_IP_CSUM;
+
+ if (one & NETIF_F_GSO)
+ one |= NETIF_F_GSO_SOFTWARE;
+ one |= NETIF_F_GSO;
+
+ /* If even one device supports robust GSO, enable it for all. */
+ if (one & NETIF_F_GSO_ROBUST)
+ all |= NETIF_F_GSO_ROBUST;
+
+ all &= one | NETIF_F_LLTX;
+
+ if (!(all & NETIF_F_ALL_CSUM))
+ all &= ~NETIF_F_SG;
+ if (!(all & NETIF_F_SG))
+ all &= ~NETIF_F_GSO_MASK;
+
+ return all;
+}
+EXPORT_SYMBOL(netdev_compute_features);
+
/*
* Initialize the DEV module. At boot time this walks the device list and
* unhooks any devices that fail to initialise (normally hardware not
--
^ permalink raw reply
* Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: David Miller @ 2007-08-23 22:30 UTC (permalink / raw)
To: hadi
Cc: rick.jones2, krkumar2, gaagaan, general, herbert, jagana, jeff,
johnpol, kaber, kumarkr, mcarlson, mchan, netdev,
peter.p.waskiewicz.jr, rdreier, Robert.Olsson, shemminger, sri,
tgraf, xma
In-Reply-To: <1187906650.4279.16.camel@localhost>
From: jamal <hadi@cyberus.ca>
Date: Thu, 23 Aug 2007 18:04:10 -0400
> Possibly a bug - but you really should turn off TSO if you are doing
> huge interactive transactions (which is fair because there is a clear
> demarcation).
I don't see how this can matter.
TSO only ever does anything if you accumulate more than one MSS
worth of data.
And when that does happen, all it does is take whats in the send queue
and send as much as possible at once. The packets are already built
in big chunks, so there is no extra work to do.
The card is going to send the things back to back and as fast as
in the non-TSO case as well.
It doesn't change application scheduling, and it absolutely does not
penalize small sends by the application unless we have a bug
somewhere.
So I see no reason to disable TSO for any reason other than hardware
implementation deficiencies. And for the drivers I am familiar with
they do make smart default TSO enabling decisions based upon how well
the chip does TSO.
^ permalink raw reply
* [ofa-general] Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: Rick Jones @ 2007-08-23 22:35 UTC (permalink / raw)
To: hadi
Cc: jagana, herbert, gaagaan, Robert.Olsson, netdev, rdreier,
peter.p.waskiewicz.jr, mcarlson, kaber, jeff, general, mchan,
tgraf, johnpol, shemminger, David Miller, sri
In-Reply-To: <1187907903.4279.28.camel@localhost>
jamal wrote:
> [TSO already passed - iirc, it has been
> demostranted to really not add much to throughput (cant improve much
> over closeness to wire speed) but improve CPU utilization].
In the one gig space sure, but in the 10 Gig space, TSO on/off does make a
difference for throughput.
rick jones
^ permalink raw reply
* [ofa-general] Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: jamal @ 2007-08-23 22:38 UTC (permalink / raw)
To: David Miller
Cc: jagana, peter.p.waskiewicz.jr, herbert, gaagaan, Robert.Olsson,
netdev, rdreier, mcarlson, jeff, general, mchan, tgraf, johnpol,
shemminger, kaber, sri
In-Reply-To: <20070823.153047.99173582.davem@davemloft.net>
On Thu, 2007-23-08 at 15:30 -0700, David Miller wrote:
> From: jamal <hadi@cyberus.ca>
> Date: Thu, 23 Aug 2007 18:04:10 -0400
>
> > Possibly a bug - but you really should turn off TSO if you are doing
> > huge interactive transactions (which is fair because there is a clear
> > demarcation).
>
> I don't see how this can matter.
>
> TSO only ever does anything if you accumulate more than one MSS
> worth of data.
I stand corrected then.
cheers,
jamal
^ permalink raw reply
* [ofa-general] Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: jamal @ 2007-08-23 22:41 UTC (permalink / raw)
To: Rick Jones
Cc: jagana, herbert, gaagaan, Robert.Olsson, netdev, rdreier,
peter.p.waskiewicz.jr, mcarlson, kaber, jeff, general, mchan,
tgraf, johnpol, shemminger, David Miller, sri
In-Reply-To: <46CE0BA1.60206@hp.com>
On Thu, 2007-23-08 at 15:35 -0700, Rick Jones wrote:
> jamal wrote:
> > [TSO already passed - iirc, it has been
> > demostranted to really not add much to throughput (cant improve much
> > over closeness to wire speed) but improve CPU utilization].
>
> In the one gig space sure, but in the 10 Gig space, TSO on/off does make a
> difference for throughput.
I am still so 1Gige;-> I stand corrected again ;->
cheers,
jamal
^ permalink raw reply
* Re: BUG: unable to handle kernel NULL pointer dereference - linux-2.6.22
From: Michal Piotrowski @ 2007-08-23 23:40 UTC (permalink / raw)
To: poison; +Cc: linux-kernel, Netdev
In-Reply-To: <200708210256.58818.rc.poison@gmail.com>
[Adding netdev to CC]
On 21/08/07, poison <rc.poison@gmail.com> wrote:
> Hello,
> after running a few instances of bittorent-curses on 2.6.22 - 2.6.22.3 it
> takes about 15min to 2hrs for my System to hang. 2.6.21.7 is definately fine,
> 2.6.21 probably (ran for 4hrs without hanging).
> If I'm lucky the Oops below makes it to my syslog (unfortunately SysRq-{p,s,i}
> doesn't work when it hangs, neither can I ssh into it):
>
> Aug 18 19:47:41 draco kernel: BUG: unable to handle kernel NULL pointer
> dereference at virtual address 00000000
> Aug 18 19:47:41 draco kernel: printing eip:
> Aug 18 19:47:41 draco kernel: c038fcba
> Aug 18 19:47:41 draco kernel: *pdpt = 0000000033830001
> Aug 18 19:47:41 draco kernel: *pde = 0000000000000000
> Aug 18 19:47:41 draco kernel: Oops: 0002 [#1]
> Aug 18 19:47:41 draco kernel: SMP
> Aug 18 19:47:41 draco kernel: Modules linked in: snd_hda_intel snd_emu10k1
> cls_u32 sch_sfq sch_htb snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq
> snd_pcm_oss snd_mixer_oss rfcomm hidp l2cap nfsd exportfs lockd sunrpc
> coretemp hwmon eeprom snd_rawmidi snd_ac97_codec hci_usb ac97_bus
> snd_seq_device snd_util_mem snd_pcm bluetooth snd_hwdep snd_timer snd
> snd_page_alloc i2c_i801 emu10k1_gp gameport i2c_core sg
> Aug 18 19:47:41 draco kernel: CPU: 0
> Aug 18 19:47:41 draco kernel: EIP: 0060:[<c038fcba>] Not tainted VLI
> Aug 18 19:47:41 draco kernel: EFLAGS: 00210202 (2.6.22.2poison #14)
> Aug 18 19:47:41 draco kernel: EIP is at tcp_sendmsg+0x40a/0xb70
> Aug 18 19:47:41 draco kernel: eax: 00000000 ebx: ec5b807c ecx: c04b43a0
> edx: ec5b807c
> Aug 18 19:47:41 draco kernel: esi: ec5b8000 edi: 00000100 ebp: ec524180
> esp: f3a11d30
> Aug 18 19:47:41 draco kernel: ds: 007b es: 007b fs: 00d8 gs: 0033 ss:
> 0068
> Aug 18 19:47:41 draco kernel: Process bittorrent-curs (pid: 3974, ti=f3a10000
> task=f3a0e000 task.ti=f3a10000)
> Aug 18 19:47:41 draco kernel: Stack: ffffffff ebe562f5 0000000b 00000000
> f3a11d94 00000000 ec5b807c 00000000
> Aug 18 19:47:41 draco kernel: 00000001 00100100 f3a11f40 00000000
> 00000040 00000200 00000200 000004b6
> Aug 18 19:47:41 draco kernel: 08604707 00200200 f3e5c798 eeaa4b40
> 00000000 f3a0e000 000001f5 00100100
> Aug 18 19:47:41 draco kernel: Call Trace:
> Aug 18 19:47:41 draco kernel: [<c03ac267>] inet_sendmsg+0x37/0x70
> Aug 18 19:47:41 draco kernel: [<c03511ef>] sock_sendmsg+0xbf/0xf0
> Aug 18 19:47:41 draco kernel: [<c012fe60>] autoremove_wake_function+0x0/0x50
> Aug 18 19:47:41 draco kernel: [<c01188f0>] default_wake_function+0x0/0x10
> Aug 18 19:47:41 draco last message repeated 3 times
> Aug 18 19:47:41 draco kernel: [<c015589d>] find_extend_vma+0x1d/0x70
> Aug 18 19:47:41 draco kernel: [<c03515cf>] sys_sendto+0x12f/0x180
> Aug 18 19:47:41 draco kernel: [<c0139dfc>] futex_wake+0xac/0xd0
> Aug 18 19:47:41 draco kernel: [<c013a4dd>] do_futex+0x6bd/0xbd0
> Aug 18 19:47:41 draco kernel: [<c0351653>] sys_send+0x33/0x40
> Aug 18 19:47:41 draco kernel: [<c03525c2>] sys_socketcall+0x142/0x280
> Aug 18 19:47:41 draco kernel: [<c0205d20>] copy_to_user+0x30/0x60
> Aug 18 19:47:41 draco kernel: [<c0102a92>] syscall_call+0x7/0xb
> Aug 18 19:47:41 draco kernel: =======================
> Aug 18 19:47:41 draco kernel: Code: 85 fb 06 00 00 80 ca 10 8b 83 94 00 00 00
> 88 53 68 f0 81 00 00 00 01 00 8b 44 24 18 ff 40 08 8b 54 24 18 8b 42 04 89 13
> 89 43 04 <89> 18 89 5a 04 8b 8e 2c 01 00 00 85 c9 0f 84 19 06 00 00 8b 83
> Aug 18 19:47:41 draco kernel: EIP: [<c038fcba>] tcp_sendmsg+0x40a/0xb70 SS:ESP
> 0068:f3a11d30
> Aug 18 19:47:51 draco kernel:
> Aug 18 19:47:51 draco kernel: Pid: 3812, comm: X
> Aug 18 19:47:51 draco kernel: EIP: 0060:[<c014a4c2>] CPU: 0
> Aug 18 19:47:51 draco kernel: EIP is at __get_free_pages+0x22/0x40
> Aug 18 19:47:51 draco kernel: EFLAGS: 00003246 Not tainted
> (2.6.22.2poison #14)
> Aug 18 19:47:51 draco kernel: EAX: 000000d0 EBX: 000000d0 ECX: c0496b40 EDX:
> 00000000
> Aug 18 19:47:51 draco kernel: ESI: 00000000 EDI: f5ba1be4 EBP: f49a4d80 DS:
> 007b ES: 007b FS: 00d8
> Aug 18 19:47:51 draco kernel: CR0: 8005003b CR2: b7384000 CR3: 37165000 CR4:
> 000006f0
> Aug 18 19:47:51 draco kernel: [<c01734b6>] __pollwait+0xa6/0x100
> Aug 18 19:47:51 draco kernel: [<c03c9597>] unix_poll+0x17/0xa0
> Aug 18 19:47:51 draco kernel: [<c03500bc>] sock_poll+0xc/0x10
> Aug 18 19:47:51 draco kernel: [<c0172bec>] do_select+0x25c/0x490
> Aug 18 19:47:51 draco kernel: [<c0173410>] __pollwait+0x0/0x100
> Aug 18 19:47:51 draco kernel: [<c01188f0>] default_wake_function+0x0/0x10
> Aug 18 19:47:51 draco last message repeated 19 times
> Aug 18 19:47:51 draco kernel: [<c0172fe8>] core_sys_select+0x1c8/0x2f0
> Aug 18 19:47:51 draco kernel: [<c0166a30>] do_readv_writev+0x120/0x190
> Aug 18 19:47:51 draco kernel: [<c03503c0>] sock_aio_write+0x0/0x110
> Aug 18 19:47:51 draco kernel: [<c017355d>] sys_select+0x4d/0x1b0
> Aug 18 19:47:51 draco kernel: [<c0166adc>] vfs_writev+0x3c/0x50
> Aug 18 19:47:51 draco kernel: [<c0166f97>] sys_writev+0x47/0x80
> Aug 18 19:47:51 draco kernel: [<c0102a92>] syscall_call+0x7/0xb
> Aug 18 19:47:51 draco kernel: =======================
> ---
>
> It's also attached together with one from a tainted 2.6.22.3
>
> The error is reproducable for me by running 4 bittorent instances and wating.
> 2.6.22 lives no longer than 2hrs, so when bisecting I assumed it was good
> after 4hrs ... so I may as well have taken a wrong turn. Result here:
>
> 00ed8e3dda47f8421b11da17e353d7db8c878121 is first bad commit
> commit 00ed8e3dda47f8421b11da17e353d7db8c878121
> Author: Dmitriy Monakhov <dmonakhov@sw.ru>
> Date: Sun Mar 11 15:36:19 2007 +0300
>
> driver core: fix device_add error path
>
> - At the moment we jump here device was't added to
> dev->class->devices list yet.
>
> Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> :040000 040000 bc29a0e7ec67055b2cad30ef3e0d19b8fe0c0981
> 8b1eee1c34d5b5db827a4d0c8a8363eb827338f3 M dr
> ivers
> ---
>
> gcc -v
> Reading specs from /usr/lib/gcc/i486-slackware-linux/4.1.2/specs
> Target: i486-slackware-linux
> Configured
> with: ../gcc-4.1.2/configure --prefix=/usr --enable-shared --enable-languages=ada,c,c++,fortran,java,objc --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --with-arch=i486 --target=i486-slackware-linux --host=i486-slackware-linux
> Thread model: posix
> gcc version 4.1.
> ---
>
> All traffic went over an USB NIC (D-Link DUB-E100) using the asix driver.
> I have no idea what further information could be useful, so shout =)
>
> ---
> If you only have a hammer, you tend to see every problem as a nail.
> -- Maslow
>
>
Regards,
Michal
--
LOG
http://www.stardust.webpages.pl/log/
^ permalink raw reply
* 2.6.22.5 forcedeth timeout hang
From: Mr. Berkley Shands @ 2007-08-23 23:48 UTC (permalink / raw)
To: linux-kernel, Net Dev
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
100% reproducible hang on xmit timeout.
Just do a "make -j4 modules" on an nfs mounted kernel source.
attached is the messages log
berkley
--
// E. F. Berkley Shands, MSc//
** Exegy Inc.**
349 Marshall Road, Suite 100
St. Louis , MO 63119
Direct: (314) 218-3600 X450
Cell: (314) 303-2546
Office: (314) 218-3600
Fax: (314) 218-3601
The Usual Disclaimer follows...
This e-mail and any documents accompanying it may contain legally privileged and/or confidential information belonging to Exegy, Inc. Such information may be protected from disclosure by law. The information is intended for use by only the addressee. If you are not the intended recipient, you are hereby notified that any disclosure or use of the information is strictly prohibited. If you have received this e-mail in error, please immediately contact the sender by e-mail or phone regarding instructions for return or destruction and do not use or disclose the content to others.
[-- Attachment #2: messages --]
[-- Type: text/plain, Size: 13870 bytes --]
Aug 23 18:34:55 crash kernel: [30819.690155] NETDEV WATCHDOG: eth1: transmit timed out
Aug 23 18:34:55 crash kernel: [30819.690162] eth1: Got tx_timeout. irq: 00000036
Aug 23 18:34:55 crash kernel: [30819.690164] eth1: Ring at 16e086000
Aug 23 18:34:55 crash kernel: [30819.690166] eth1: Dumping tx registers
Aug 23 18:34:55 crash kernel: [30819.690171] 0: 00000036 000000ff 00000003 024e03ca 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690176] 20: 06255300 ff701365 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690181] 40: 0420e20e 0000a855 00002e20 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690186] 60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690192] 80: 003b0f3c 00000001 00040000 007f0020 0000061c 00000001 00200000 00007f87
Aug 23 18:34:55 crash kernel: [30819.690197] a0: 0014050f 00000016 5781e000 0000020a 00000001 00000000 a800cccd 0000fcf5
Aug 23 18:34:55 crash kernel: [30819.690203] c0: 10000002 00000001 00000001 00000001 00000001 00000001 00000001 00000001
Aug 23 18:34:55 crash kernel: [30819.690207] e0: 00000001 00000001 00000001 00000001 00000001 00000001 00000001 00000001
Aug 23 18:34:55 crash kernel: [30819.690213] 100: 6e086800 6e086000 007f00ff 00008000 00010032 00000000 0000002c 6e0874c0
Aug 23 18:34:55 crash kernel: [30819.690220] 120: 6e086360 1ca37240 a000ffeb 00000000 00000000 6e0874cc 6e08636c 0fe08000
Aug 23 18:34:55 crash kernel: [30819.690225] 140: 00304120 80002600 00000001 00000001 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690229] 160: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690235] 180: 00000016 00000008 0194796d 00008103 0000002a 00003800 0194000f 00000003
Aug 23 18:34:55 crash kernel: [30819.690241] 1a0: 00000016 00000008 0194796d 00008103 0000002a 00003800 0194000f 00000003
Aug 23 18:34:55 crash kernel: [30819.690246] 1c0: 00000016 00000008 0194796d 00008103 0000002a 00003800 0194000f 00000003
Aug 23 18:34:55 crash kernel: [30819.690252] 1e0: 00000016 00000008 0194796d 00008103 0000002a 00003800 0194000f 00000003
Aug 23 18:34:55 crash kernel: [30819.690257] 200: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690261] 220: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690266] 240: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690271] 260: 00000000 00000000 fe020001 00000100 00000000 00000000 7e020001 00000100
Aug 23 18:34:55 crash kernel: [30819.690276] 280: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690280] 2a0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
Aug 23 18:34:55 crash kernel: [30819.690285] 2c0: 00000000 00000000 00000000 00000000 00000000 00000001 00000001 00000001
Aug 23 18:34:55 crash kernel: [30819.690287] eth1: Dumping tx ring
Aug 23 18:34:55 crash kernel: [30819.690292] 000: 00000000 8fd00892 20000052 // 00000000 88115c92 20000052 // 00000000 875ae892 20000052 // 00000000 8a660492 20000052
Aug 23 18:34:55 crash kernel: [30819.690298] 004: 00000001 61fdb492 20000052 // 00000000 8bf3f892 20000052 // 00000000 8daa7092 20000052 // 00000000 8fa29892 20000052
Aug 23 18:34:55 crash kernel: [30819.690304] 008: 00000001 0d558892 20000052 // 00000000 8e0bf892 20000052 // 00000000 8fd00492 20000052 // 00000000 8d160092 20000052
Aug 23 18:34:55 crash kernel: [30819.690310] 00c: 00000001 27698092 20000052 // 00000000 7fc6cc92 20000052 // 00000000 8d03ec92 20000052 // 00000000 88085492 20000052
Aug 23 18:34:55 crash kernel: [30819.690317] 010: 00000000 850ee492 20000052 // 00000000 8bba8c92 20000052 // 00000001 56108492 20000052 // 00000000 7f0ed892 20000052
Aug 23 18:34:55 crash kernel: [30819.690323] 014: 00000001 509a0492 20000052 // 00000000 87b60892 20000052 // 00000000 87b62092 20000052 // 00000000 8f0d5892 20000052
Aug 23 18:34:55 crash kernel: [30819.690329] 018: 00000000 87c7b492 20000052 // 00000000 8ee76092 20000052 // 00000001 4fb8e892 20000052 // 00000000 7fc6c492 20000052
Aug 23 18:34:55 crash kernel: [30819.690335] 01c: 00000001 541bc492 20000052 // 00000000 85572492 20000052 // 00000000 8ee77492 20000052 // 00000000 8bbab492 20000052
Aug 23 18:34:55 crash kernel: [30819.690341] 020: 00000001 1b4b3492 20000052 // 00000001 541bc892 20000052 // 00000000 7fc6e092 20000052 // 00000000 8fd01092 20000052
Aug 23 18:34:55 crash kernel: [30819.690347] 024: 00000001 0d530c92 20000052 // 00000000 8bbaa092 20000052 // 00000000 8d03e892 20000052 // 00000000 7deac0b2 00000000
Aug 23 18:34:55 crash kernel: [30819.690352] 028: 00000000 8257dba0 00000000 // 00000000 895d0000 200005ee // 00000000 8d03e4b2 00000000 // 00000000 895d013c 22000bdc
Aug 23 18:34:55 crash kernel: [30819.690357] 02c: 00000000 8eba30b2 00000000 // 00000000 895d0c74 00000000 // 00000000 895d1000 22000bdc // 00000000 875aecb2 00000000
Aug 23 18:34:55 crash kernel: [30819.690363] 030: 00000000 895d17ac 00000000 // 00000000 86f62000 22000bdc // 00000000 8a6618b2 00000000 // 00000000 86f622e4 22000bdc
Aug 23 18:34:55 crash kernel: [30819.690368] 034: 00000000 855734b2 00000000 // 00000000 86f62e1c 00000000 // 00000000 86f63000 22000bdc // 00000001 65b95cb2 00000000
Aug 23 18:34:55 crash kernel: [30819.690374] 038: 00000000 86f63954 00000000 // 00000000 7fb6e000 22000bdc // 00000000 850ee0b2 00000000 // 00000000 7fb6e48c 22000bdc
Aug 23 18:34:55 crash kernel: [30819.690379] 03c: 00000000 8d1604b2 00000000 // 00000000 7fb6efc4 00000000 // 00000000 7fb6f000 22000bdc // 00000000 8d03f8b2 00000000
Aug 23 18:34:55 crash kernel: [30819.690384] 040: 00000000 7fb6fafc 00000000 // 00000000 8b7c0000 220005ee // 00000001 1000e8b2 00000000 // 00000000 8b7c0098 2200007a
Aug 23 18:34:55 crash kernel: [30819.690390] 044: 00000000 8e0bf0b2 00000000 // 00000000 8b7c00c0 22000fde // 00000000 8d03e0b2 00000000 // 00000000 8b7c0fa8 00000000
Aug 23 18:34:55 crash kernel: [30819.690395] 048: 00000000 8b7c1000 22000bdc // 00000000 87b600b2 00000000 // 00000000 8b7c1ae0 00000000 // 00000000 8dc38000 22000bdc
Aug 23 18:34:55 crash kernel: [30819.690401] 04c: 00000001 4fb8e0b2 00000000 // 00000000 8dc38618 00000000 // 00000000 8dc39000 22000bdc // 00000000 8fa294b2 00000000
Aug 23 18:34:55 crash kernel: [30819.690406] 050: 00000000 8dc39150 22000bdc // 00000001 620870b2 00000000 // 00000000 8dc39c88 00000000 // 00000000 85ad8000 22000bdc
Aug 23 18:34:55 crash kernel: [30819.690411] 054: 00000000 875af8b2 00000000 // 00000000 85ad87c0 00000000 // 00000000 85ad9000 22000bdc // 00000000 881150b2 00000000
Aug 23 18:34:55 crash kernel: [30819.690417] 058: 00000000 85ad92f8 22000bdc // 00000001 62f8e8b2 00000000 // 00000000 85ad9e30 00000000 // 00000000 887d8000 22000bdc
Aug 23 18:34:55 crash kernel: [30819.690422] 05c: 00000000 8ee764b2 00000000 // 00000000 887d8968 00000000 // 00000000 887d9000 22000bdc // 00000000 8d160cb2 00000000
Aug 23 18:34:55 crash kernel: [30819.690428] 060: 00000000 887d94a0 220005ee // 00000000 8a6600b2 00000000 // 00000000 887d9a3c 2200023e // 00000001 6427e4b2 00000000
Aug 23 18:34:55 crash kernel: [30819.690433] 064: 00000000 887d9c28 00000000 // 00000000 87e80000 22000fde // 00000000 875af0b2 00000000 // 00000000 87e80b10 00000000
Aug 23 18:34:55 crash kernel: [30819.690439] 068: 00000000 87e81000 22000bb4 // 00000000 850ee892 22000052 // 00000001 1000ec92 22000052 // 00000000 7deac492 22000052
Aug 23 18:34:55 crash kernel: [30819.690445] 06c: 00000000 8daa7c92 22000052 // 00000001 1b4b3092 22000052 // 00000000 8bbaa492 22000052 // 00000000 8fa29c92 22000052
Aug 23 18:34:55 crash kernel: [30819.690451] 070: 00000000 850ed492 22000052 // 00000000 875ae092 22000052 // 00000000 7fc6e492 22000052 // 00000000 8d03fc92 22000052
Aug 23 18:34:55 crash kernel: [30819.690457] 074: 00000000 8bf3f492 22000052 // 00000000 8daa7892 22000052 // 00000001 509a0c92 22000052 // 00000000 8eba3892 22000052
Aug 23 18:34:55 crash kernel: [30819.690463] 078: 00000000 8eba3c92 22000052 // 00000000 8a661492 22000052 // 00000000 8f0d5092 22000052 // 00000000 850eec92 22000052
Aug 23 18:34:55 crash kernel: [30819.690469] 07c: 00000000 7f0ed492 22000052 // 00000000 88115492 22000052 // 00000000 87c7a48a 2200005a // 00000000 8ee7708a 2200005a
Aug 23 18:34:55 crash kernel: [30819.690475] 080: 00000001 6233848a 2200005a // 00000001 4fb8688a 2200005a // 00000000 8557288a 2200005a // 00000000 87c7b88a 2200005a
Aug 23 18:34:55 crash kernel: [30819.690481] 084: 00000000 8a660c8a 2200005a // 00000000 8557208a 2200005a // 00000000 8ee7788a 2200005a // 00000001 4fb8608a 2200005a
Aug 23 18:34:55 crash kernel: [30819.690487] 088: 00000001 62f8e48a 2200005a // 00000001 567cb88a 2200005a // 00000000 7f0edcaa 00000000 // 00000000 8257dba0 00000000
Aug 23 18:34:55 crash kernel: [30819.690492] 08c: 00000000 895d0000 200005ee // 00000001 6ebb8802 20000066 // 00000001 620874aa 00000000 // 00000000 8257dba0 00000000
Aug 23 18:34:55 crash kernel: [30819.690498] 090: 00000000 895d0000 200005ee // 00000001 63945a02 20000066 // 00000001 61a9b4aa 00000000 // 00000000 8257dba0 00000000
Aug 23 18:34:55 crash kernel: [30819.690504] 094: 00000000 895d0000 200005ee // 00000001 259b9202 20000066 // 00000001 339e6002 20000040 // 00000001 61a9b8aa 00000000
Aug 23 18:34:55 crash kernel: [30819.690510] 098: 00000000 8257dba0 00000000 // 00000000 895d0000 220005ee // 00000001 259b9a02 20000066 // 00000001 2f34ea02 20000040
Aug 23 18:34:55 crash kernel: [30819.690516] 09c: 00000001 6ebb8402 22000066 // 00000001 63945402 20000040 // 00000001 4f226a02 22000066 // 00000001 2e04f402 20000066
Aug 23 18:34:55 crash kernel: [30819.690521] 0a0: 00000001 4fb8ecaa 00000000 // 00000000 8257dba0 00000000 // 00000000 895d0000 200005ee // 00000001 2f34ec02 20000066
Aug 23 18:34:55 crash kernel: [30819.690528] 0a4: 00000001 341f6402 20000066 // 00000001 339e6e02 20000066 // 00000001 341f6e02 20000066 // 00000001 2e04f202 20000066
Aug 23 18:34:55 crash kernel: [30819.690533] 0a8: 00000001 0d5304aa 00000000 // 00000000 8257dba0 00000000 // 00000000 895d0000 200005ee // 00000001 fc4588be 00000000
Aug 23 18:34:55 crash kernel: [30819.690539] 0ac: 00000001 29eba7d6 200000b2 // 00000002 6e3b60be 00000000 // 00000001 29eba7d6 200000b2 // 00000001 4f226c02 20000040
Aug 23 18:34:55 crash kernel: [30819.690544] 0b0: 00000001 6509fe02 22000040 // 00000000 8bba90ca 00000000 // 00000001 38bf4d7c 22000040 // 00000000 8bba94ca 00000000
Aug 23 18:34:55 crash kernel: [30819.690551] 0b4: 00000001 38bf4d7c 22000040 // 00000001 6de0d002 22000040 // 00000002 0f793202 22000040 // 00000001 6de0de02 22000040
Aug 23 18:34:55 crash kernel: [30819.690557] 0b8: 00000002 2482b202 22000040 // 00000001 6de0d802 22000066 // 00000001 6ebb8e02 20000040 // 00000002 4a3e4202 22000040
Aug 23 18:34:55 crash kernel: [30819.690562] 0bc: 00000001 6ebb8a02 22000040 // 00000000 8bba98be 00000000 // 00000001 271400e9 2200005c // 00000000 8832e8be 00000000
Aug 23 18:34:55 crash kernel: [30819.690568] 0c0: 00000001 271400e9 2000005c // 00000001 341f6002 20000040 // 00000000 8d03f0aa 00000000 // 00000000 8257dba0 00000000
Aug 23 18:34:55 crash kernel: [30819.690574] 0c4: 00000000 895d0000 220005ee // 00000001 2e04fa02 20000040 // 00000001 2e04fc02 22000040 // 00000001 339e6402 22000040
Aug 23 18:34:55 crash kernel: [30819.690580] 0c8: 00000001 339e6602 22000040 // 00000001 339e6a02 22000040 // 00000002 391e4c02 22000040 // 00000002 1ca37202 22000040
Aug 23 18:34:55 crash kernel: [30819.690586] 0cc: 00000000 7fc6c092 22000052 // 00000000 7fc6c092 20000052 // 00000001 1a702492 20000052 // 00000000 87c7bc92 20000052
Aug 23 18:34:55 crash kernel: [30819.690592] 0d0: 00000000 8ee76892 20000052 // 00000000 85573892 20000052 // 00000001 622efc92 20000052 // 00000000 7fc6d492 20000052
Aug 23 18:34:55 crash kernel: [30819.690599] 0d4: 00000001 4bbb7492 20000052 // 00000000 85573c92 20000052 // 00000000 8bf3f092 20000052 // 00000001 0d558492 20000052
Aug 23 18:34:55 crash kernel: [30819.690605] 0d8: 00000000 875afc92 20000052 // 00000000 87b60492 20000052 // 00000000 8bba9c92 20000052 // 00000000 8fa29092 20000052
Aug 23 18:34:55 crash kernel: [30819.690611] 0dc: 00000001 541bc092 20000052 // 00000000 85573092 20000052 // 00000000 87b62892 20000052 // 00000000 87c7ac92 20000052
Aug 23 18:34:55 crash kernel: [30819.690617] 0e0: 00000000 8bba8492 20000052 // 00000000 8bbab092 20000052 // 00000001 60e3c492 20000052 // 00000000 8832e092 20000052
Aug 23 18:34:55 crash kernel: [30819.690623] 0e4: 00000000 8a661092 20000052 // 00000000 8bbab892 20000052 // 00000001 0d558092 20000052 // 00000000 800bc092 20000052
Aug 23 18:34:55 crash kernel: [30819.690629] 0e8: 00000000 8daa7492 20000052 // 00000001 4fb86492 20000052 // 00000001 0d558c92 20000052 // 00000000 87b63892 20000052
Aug 23 18:34:55 crash kernel: [30819.690635] 0ec: 00000000 7deacc92 20000052 // 00000000 8a660892 20000052 // 00000000 850ed892 20000052 // 00000000 8f0d5c92 20000052
Aug 23 18:34:55 crash kernel: [30819.690641] 0f0: 00000001 0d530892 20000052 // 00000000 7fc6e892 20000052 // 00000000 889c9092 20000052 // 00000000 8bbaac92 20000052
Aug 23 18:34:55 crash kernel: [30819.690647] 0f4: 00000001 61fdb892 20000052 // 00000000 8a661c92 20000052 // 00000000 7f0ed092 20000052 // 00000000 8fd01892 20000052
Aug 23 18:34:55 crash kernel: [30819.690653] 0f8: 00000000 87b62c92 20000052 // 00000000 87b62492 20000052 // 00000001 62338892 20000052 // 00000000 7fc6d092 20000052
Aug 23 18:34:55 crash kernel: [30819.690659] 0fc: 00000001 1a702892 20000052 // 00000001 614ca492 20000052 // 00000000 8bba8092 20000052 // 00000000 889c9c92 20000052
^ permalink raw reply
* [PATCH 14/30] net: Kill some unneeded allocation return value casts in libertas
From: Jesper Juhl @ 2007-08-24 0:03 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA, Jesper Juhl
In-Reply-To: <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
kmalloc() and friends return void*, no need to cast it.
Signed-off-by: Jesper Juhl <jesper.juhl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/wireless/libertas/debugfs.c | 2 +-
drivers/net/wireless/libertas/ethtool.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 715cbda..6ade63e 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -1839,7 +1839,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
char *p2;
struct debug_data *d = (struct debug_data *)f->private_data;
- pdata = (char *)kmalloc(cnt, GFP_KERNEL);
+ pdata = kmalloc(cnt, GFP_KERNEL);
if (pdata == NULL)
return 0;
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 96f1974..7dad493 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -60,8 +60,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
// mutex_lock(&priv->mutex);
- adapter->prdeeprom =
- (char *)kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL);
+ adapter->prdeeprom = kmalloc(eeprom->len+sizeof(regctrl), GFP_KERNEL);
if (!adapter->prdeeprom)
return -ENOMEM;
memcpy(adapter->prdeeprom, ®ctrl, sizeof(regctrl));
--
1.5.2.2
^ permalink raw reply related
* [PATCH 16/30] net: Avoid pointless allocation casts in BSD compression module
From: Jesper Juhl @ 2007-08-24 0:06 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: netdev, davem, Jesper Juhl
In-Reply-To: <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl@gmail.com>
The general kernel memory allocation functions return void pointers
and there is no need to cast their return values.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/net/bsd_comp.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c
index 202d4a4..88edb98 100644
--- a/drivers/net/bsd_comp.c
+++ b/drivers/net/bsd_comp.c
@@ -406,8 +406,7 @@ static void *bsd_alloc (unsigned char *options, int opt_len, int decomp)
* Allocate space for the dictionary. This may be more than one page in
* length.
*/
- db->dict = (struct bsd_dict *) vmalloc (hsize *
- sizeof (struct bsd_dict));
+ db->dict = vmalloc(hsize * sizeof(struct bsd_dict));
if (!db->dict)
{
bsd_free (db);
@@ -426,8 +425,7 @@ static void *bsd_alloc (unsigned char *options, int opt_len, int decomp)
*/
else
{
- db->lens = (unsigned short *) vmalloc ((maxmaxcode + 1) *
- sizeof (db->lens[0]));
+ db->lens = vmalloc((maxmaxcode + 1) * sizeof(db->lens[0]));
if (!db->lens)
{
bsd_free (db);
--
1.5.2.2
^ permalink raw reply related
* Problem with implementation of TCP_DEFER_ACCEPT?
From: TJ @ 2007-08-24 0:08 UTC (permalink / raw)
To: netdev
I'd welcome the views of those familiar with TCP_DEFER_ACCEPT on a
recent issue I've worked on where connections between a Juniper DX (aka
redline) load-balancer and Apache 2.2 cluster caused random connection
failures.
Today, after 2 weeks debugging the issue, we confirmed the problem was
related to TCP_DEFER_ACCEPT. Part of the issue is caused by Juniper's
implementation of persistent connections, but there remains a question
as to whether the Linux kernel is correctly handling handshakes when a
listening socket has TCP_DEFER_ACCEPT enabled.
Upon reflection, and after having worked with the RFCs this past few
weeks, I'm finding myself doubting the kernel's TCP_DEFER_ACCEPT
implementation.
Also, I'm unable to locate an RFC or other specification for
TCP_DEFER_ACCEPT aka BSD's SO_ACCEPTFILTER - can you point me to one?
The complete background and observations of the original problem and the
workaround are available here:
https://bugs.launchpad.net/ubuntu/+bug/134274
My specific concerns are explained in the following comments, for which
I'd appreciate your views.
----------------------------------------------------
An RFC 793 standard TCP handshake requires three packets:
client SYN > server LISTENING
client < SYN ACK server SYN_RECEIVED
client ACK > server ESTABLISHED
client PSH ACK + data > server
TCP_DEFER_ACCEPT is designed to increase performance by reducing the
number of TCP packets exchanged before the client can pass data:
client SYN > server LISTENING
client < SYN ACK server SYN_RECEIVED
client PSH ACK + data > server ESTABLISHED
At present with TCP_DEFER_ACCEPT the kernel treats the RFC 793 handshake
as invalid; dropping the ACK from the client without replying so the
client doesn't know the server has in fact set it's internal ACKed flag.
If the client doesn't send a packet containing data before the SYN_ACK
time-outs finally expire the connection will be dropped.
For a client obeying RFC 793 what we see is:
client SYN > server LISTENING
client < SYN ACK server SYN_RECEIVED (time-out 3s)
server: inet_rsk(req)->acked = 1
client ACK > server (discarded)
client < SYN ACK (DUP) server (time-out 6s)
client ACK (DUP) > server (discarded)
client < SYN ACK (DUP) server (time-out 12s)
client ACK (DUP) > server (discarded)
client < SYN ACK (DUP) server (time-out 24s)
client ACK (DUP) > server (discarded)
client < SYN ACK (DUP) server (time-out 48s)
client ACK (DUP) > server (discarded)
client < SYN ACK (DUP) server (time-out 96s)
client ACK (DUP) > server (discarded)
server: half-open socket closed.
With each client ACK being dropped by the kernel's TCP_DEFER_ACCEPT
mechanism eventually the handshake fails after the 'SYN ACK' retries and
time-outs expire.
There is a case for arguing the kernel should be operating in an
enhanced handshaking mode when TCP_DEFER_ACCEPT is enabled, not an
alternative mode, and therefore should accept *both* RFC 793 and
TCP_DEFER_ACCEPT. I've been unable to find a specification or RFC for
implementing TCP_DEFER_ACCEPT aka BSD's SO_ACCEPTFILTER to give me firm
guidance.
It seems incorrect to penalise a client that is trying to complete the
handshake according to the RFC 793 specification, especially as the
client has no way of knowing ahead of time whether or not the server is
operating deferred accept.
-------------------------------------------
net/ipv4/tcp_minisocks.c::tcp_check_req() implements the
TCP_DEFER_ACCEPT check:
/* If TCP_DEFER_ACCEPT is set, drop bare ACK. */
if (inet_csk(sk)->icsk_accept_queue.rskq_defer_accept &&
TCP_SKB_CB(skb)->end_seq == tcp_rsk(req)->rcv_isn + 1) {
inet_rsk(req)->acked = 1;
return NULL;
}
--------------------------------------------
Thanks
TJ.
Ubuntu ACPI Kernel Team
^ permalink raw reply
* [PATCH 2/3] [IPROUTE2] ip: xfrm: Fix policy and state flags.
From: Masahide NAKAMURA @ 2007-08-24 2:05 UTC (permalink / raw)
To: Stephen Hemminger, netdev; +Cc: Masahide NAKAMURA
o Support policy flag with string format.
Note that kernel defines only one name "localok" for the flag
and it has not had any effect currently.
o Support state flag value XFRM_STATE_NOPMTUDISC.
o Fix to show detailed flags value when "-s" option is used.
o Fix minor typo.
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
---
ip/ipxfrm.c | 18 +++++++++++++---
ip/xfrm.h | 1 +
ip/xfrm_policy.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
ip/xfrm_state.c | 6 +++-
4 files changed, 72 insertions(+), 8 deletions(-)
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index d9b0e3b..359a2d2 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -745,12 +745,13 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
fprintf(fp, "flag ");
XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_NOECN, "noecn");
XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_DECAP_DSCP, "decap-dscp");
+ XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_NOPMTUDISC, "nopmtudisc");
XFRM_FLAG_PRINT(fp, flags, XFRM_STATE_WILDRECV, "wildrecv");
if (flags)
fprintf(fp, "%x", flags);
- if (show_stats > 0)
- fprintf(fp, " (0x%s)", strxf_mask8(flags));
}
+ if (show_stats > 0)
+ fprintf(fp, " (0x%s)", strxf_mask8(xsinfo->flags));
fprintf(fp, "%s", _SL_);
xfrm_xfrma_print(tb, xsinfo->family, fp, buf);
@@ -845,10 +846,19 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
}
fprintf(fp, " ");
- if (show_stats > 0) {
+ if (show_stats > 0)
fprintf(fp, "share %s ", strxf_share(xpinfo->share));
- fprintf(fp, "flag 0x%s", strxf_mask8(xpinfo->flags));
+
+ if (show_stats > 0 || xpinfo->flags) {
+ __u8 flags = xpinfo->flags;
+
+ fprintf(fp, "flag ");
+ XFRM_FLAG_PRINT(fp, flags, XFRM_POLICY_LOCALOK, "localok");
+ if (flags)
+ fprintf(fp, "%x", flags);
}
+ if (show_stats > 0)
+ fprintf(fp, " (0x%s)", strxf_mask8(xpinfo->flags));
fprintf(fp, "%s", _SL_);
if (show_stats > 0)
diff --git a/ip/xfrm.h b/ip/xfrm.h
index 71345b9..335c2a5 100644
--- a/ip/xfrm.h
+++ b/ip/xfrm.h
@@ -98,6 +98,7 @@ struct xfrm_filter {
__u32 index_mask;
__u8 action_mask;
__u32 priority_mask;
+ __u8 policy_flags_mask;
__u8 ptype;
__u8 ptype_mask;
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index f4488ac..419ca67 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -54,10 +54,10 @@ static void usage(void) __attribute__((noreturn));
static void usage(void)
{
fprintf(stderr, "Usage: ip xfrm policy { add | update } dir DIR SELECTOR [ index INDEX ] [ ptype PTYPE ]\n");
- fprintf(stderr, " [ action ACTION ] [ priority PRIORITY ] [ LIMIT-LIST ] [ TMPL-LIST ]\n");
+ fprintf(stderr, " [ action ACTION ] [ priority PRIORITY ] [ flag FLAG-LIST ] [ LIMIT-LIST ] [ TMPL-LIST ]\n");
fprintf(stderr, "Usage: ip xfrm policy { delete | get } dir DIR [ SELECTOR | index INDEX ] [ ptype PTYPE ]\n");
fprintf(stderr, "Usage: ip xfrm policy { deleteall | list } [ dir DIR ] [ SELECTOR ]\n");
- fprintf(stderr, " [ index INDEX ] [ action ACTION ] [ priority PRIORITY ]\n");
+ fprintf(stderr, " [ index INDEX ] [ action ACTION ] [ priority PRIORITY ] [ flag FLAG-LIST ]\n");
fprintf(stderr, "Usage: ip xfrm policy flush [ ptype PTYPE ]\n");
fprintf(stderr, "Usage: ip xfrm count\n");
fprintf(stderr, "PTYPE := [ main | sub ](default=main)\n");
@@ -74,6 +74,9 @@ static void usage(void)
//fprintf(stderr, "PRIORITY - priority value(default=0)\n");
+ fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
+ fprintf(stderr, "FLAG := [ localok ]\n");
+
fprintf(stderr, "LIMIT-LIST := [ LIMIT-LIST ] | [ limit LIMIT ]\n");
fprintf(stderr, "LIMIT := [ [time-soft|time-hard|time-use-soft|time-use-hard] SECONDS ] |\n");
fprintf(stderr, " [ [byte-soft|byte-hard] SIZE ] | [ [packet-soft|packet-hard] NUMBER ]\n");
@@ -135,6 +138,39 @@ static int xfrm_policy_ptype_parse(__u8 *ptype, int *argcp, char ***argvp)
return 0;
}
+static int xfrm_policy_flag_parse(__u8 *flags, int *argcp, char ***argvp)
+{
+ int argc = *argcp;
+ char **argv = *argvp;
+ int len = strlen(*argv);
+
+ if (len > 2 && strncmp(*argv, "0x", 2) == 0) {
+ __u8 val = 0;
+
+ if (get_u8(&val, *argv, 16))
+ invarg("\"FLAG\" is invalid", *argv);
+ *flags = val;
+ } else {
+ while (1) {
+ if (strcmp(*argv, "localok") == 0)
+ *flags |= XFRM_POLICY_LOCALOK;
+ else {
+ PREV_ARG(); /* back track */
+ break;
+ }
+
+ if (!NEXT_ARG_OK())
+ break;
+ NEXT_ARG();
+ }
+ }
+
+ *argcp = argc;
+ *argvp = argv;
+
+ return 0;
+}
+
static int xfrm_tmpl_parse(struct xfrm_user_tmpl *tmpl,
int *argcp, char ***argvp)
{
@@ -245,6 +281,10 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv)
NEXT_ARG();
if (get_u32(&req.xpinfo.priority, *argv, 0))
invarg("\"PRIORITY\" is invalid", *argv);
+ } else if (strcmp(*argv, "flag") == 0) {
+ NEXT_ARG();
+ xfrm_policy_flag_parse(&req.xpinfo.flags, &argc,
+ &argv);
} else if (strcmp(*argv, "limit") == 0) {
NEXT_ARG();
xfrm_lifetime_cfg_parse(&req.xpinfo.lft, &argc, &argv);
@@ -357,6 +397,10 @@ static int xfrm_policy_filter_match(struct xfrm_userpolicy_info *xpinfo,
if ((xpinfo->priority^filter.xpinfo.priority)&filter.priority_mask)
return 0;
+ if (filter.policy_flags_mask)
+ if ((xpinfo->flags & filter.xpinfo.flags) == 0)
+ return 0;
+
return 1;
}
@@ -684,6 +728,13 @@ static int xfrm_policy_list_or_deleteall(int argc, char **argv, int deleteall)
filter.priority_mask = XFRM_FILTER_MASK_FULL;
+ } else if (strcmp(*argv, "flag") == 0) {
+ NEXT_ARG();
+ xfrm_policy_flag_parse(&filter.xpinfo.flags, &argc,
+ &argv);
+
+ filter.policy_flags_mask = XFRM_FILTER_MASK_FULL;
+
} else {
if (selp)
invarg("unknown", *argv);
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 2b68f49..29604a5 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -62,7 +62,7 @@ static void usage(void)
fprintf(stderr, " [ min SPI max SPI ]\n");
fprintf(stderr, "Usage: ip xfrm state { delete | get } ID\n");
fprintf(stderr, "Usage: ip xfrm state { deleteall | list } [ ID ] [ mode MODE ] [ reqid REQID ]\n");
- fprintf(stderr, " [ flag FLAG_LIST ]\n");
+ fprintf(stderr, " [ flag FLAG-LIST ]\n");
fprintf(stderr, "Usage: ip xfrm state flush [ proto XFRM_PROTO ]\n");
fprintf(stderr, "Usage: ip xfrm state count \n");
@@ -82,7 +82,7 @@ static void usage(void)
//fprintf(stderr, "REQID - number(default=0)\n");
fprintf(stderr, "FLAG-LIST := [ FLAG-LIST ] FLAG\n");
- fprintf(stderr, "FLAG := [ noecn | decap-dscp | wildrecv ]\n");
+ fprintf(stderr, "FLAG := [ noecn | decap-dscp | nopmtudisc | wildrecv ]\n");
fprintf(stderr, "ENCAP := ENCAP-TYPE SPORT DPORT OADDR\n");
fprintf(stderr, "ENCAP-TYPE := espinudp | espinudp-nonike\n");
@@ -203,6 +203,8 @@ static int xfrm_state_flag_parse(__u8 *flags, int *argcp, char ***argvp)
*flags |= XFRM_STATE_NOECN;
else if (strcmp(*argv, "decap-dscp") == 0)
*flags |= XFRM_STATE_DECAP_DSCP;
+ else if (strcmp(*argv, "nopmtudisc") == 0)
+ *flags |= XFRM_STATE_NOPMTUDISC;
else if (strcmp(*argv, "wildrecv") == 0)
*flags |= XFRM_STATE_WILDRECV;
else {
--
1.4.4.2
^ permalink raw reply related
* [PATCH 3/3] [IPROUTE2] ip: xfrm: Fix flush message.
From: Masahide NAKAMURA @ 2007-08-24 2:05 UTC (permalink / raw)
To: Stephen Hemminger, netdev; +Cc: Masahide NAKAMURA
Fix xfrm state or policy flush message.
And minor updates are included:
o Use static buffer to show unknown value as string.
o Show policy type (ptype) only when kernel specified it.
o Clean-up xfrm_monitor.
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
---
ip/ipxfrm.c | 48 +++++++++++++--------
ip/xfrm.h | 1 +
ip/xfrm_monitor.c | 122 +++++++++++++++++++++++++++++++++++++---------------
ip/xfrm_state.c | 1 -
4 files changed, 117 insertions(+), 55 deletions(-)
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index 359a2d2..80dbb52 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -114,6 +114,7 @@ struct typeent {
static const struct typeent xfrmproto_types[]= {
{ "esp", IPPROTO_ESP }, { "ah", IPPROTO_AH }, { "comp", IPPROTO_COMP },
{ "route2", IPPROTO_ROUTING }, { "hao", IPPROTO_DSTOPTS },
+ { "ipsec-any", IPSEC_PROTO_ANY },
{ NULL, -1 }
};
@@ -135,6 +136,7 @@ int xfrm_xfrmproto_getbyname(char *name)
const char *strxf_xfrmproto(__u8 proto)
{
+ static char str[16];
int i;
for (i = 0; ; i++) {
@@ -146,7 +148,8 @@ const char *strxf_xfrmproto(__u8 proto)
return t->t_name;
}
- return NULL;
+ sprintf(str, "%u", proto);
+ return str;
}
static const struct typeent algo_types[]= {
@@ -172,6 +175,7 @@ int xfrm_algotype_getbyname(char *name)
const char *strxf_algotype(int type)
{
+ static char str[32];
int i;
for (i = 0; ; i++) {
@@ -183,7 +187,8 @@ const char *strxf_algotype(int type)
return t->t_name;
}
- return NULL;
+ sprintf(str, "%d", type);
+ return str;
}
const char *strxf_mask8(__u8 mask)
@@ -251,6 +256,25 @@ const char *strxf_proto(__u8 proto)
return p;
}
+const char *strxf_ptype(__u8 ptype)
+{
+ static char str[16];
+
+ switch (ptype) {
+ case XFRM_POLICY_TYPE_MAIN:
+ strcpy(str, "main");
+ break;
+ case XFRM_POLICY_TYPE_SUB:
+ strcpy(str, "sub");
+ break;
+ default:
+ sprintf(str, "%u", ptype);
+ break;
+ }
+
+ return str;
+}
+
void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
__u8 mode, __u32 reqid, __u16 family, int force_spi,
FILE *fp, const char *prefix, const char *title)
@@ -776,7 +800,6 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
const char *title)
{
char buf[STRBUF_SIZE];
- __u8 ptype = XFRM_POLICY_TYPE_MAIN;
memset(buf, '\0', sizeof(buf));
@@ -821,31 +844,18 @@ void xfrm_policy_info_print(struct xfrm_userpolicy_info *xpinfo,
fprintf(fp, "index %u ", xpinfo->index);
fprintf(fp, "priority %u ", xpinfo->priority);
- fprintf(fp, "ptype ");
-
if (tb[XFRMA_POLICY_TYPE]) {
struct xfrm_userpolicy_type *upt;
+ fprintf(fp, "ptype ");
+
if (RTA_PAYLOAD(tb[XFRMA_POLICY_TYPE]) < sizeof(*upt))
fprintf(fp, "(ERROR truncated)");
upt = (struct xfrm_userpolicy_type *)RTA_DATA(tb[XFRMA_POLICY_TYPE]);
- ptype = upt->type;
+ fprintf(fp, "%s ", strxf_ptype(upt->type));
}
- switch (ptype) {
- case XFRM_POLICY_TYPE_MAIN:
- fprintf(fp, "main");
- break;
- case XFRM_POLICY_TYPE_SUB:
- fprintf(fp, "sub");
- break;
- default:
- fprintf(fp, "%u", ptype);
- break;
- }
- fprintf(fp, " ");
-
if (show_stats > 0)
fprintf(fp, "share %s ", strxf_share(xpinfo->share));
diff --git a/ip/xfrm.h b/ip/xfrm.h
index 335c2a5..930bb3f 100644
--- a/ip/xfrm.h
+++ b/ip/xfrm.h
@@ -127,6 +127,7 @@ const char *strxf_mask8(__u8 mask);
const char *strxf_mask32(__u32 mask);
const char *strxf_share(__u8 share);
const char *strxf_proto(__u8 proto);
+const char *strxf_ptype(__u8 ptype);
void xfrm_id_info_print(xfrm_address_t *saddr, struct xfrm_id *id,
__u8 mode, __u32 reqid, __u16 family, int force_spi,
FILE *fp, const char *prefix, const char *title);
diff --git a/ip/xfrm_monitor.c b/ip/xfrm_monitor.c
index bdbf4a6..dc12fca 100644
--- a/ip/xfrm_monitor.c
+++ b/ip/xfrm_monitor.c
@@ -50,12 +50,6 @@ static int xfrm_acquire_print(const struct sockaddr_nl *who,
struct rtattr * tb[XFRMA_MAX+1];
__u16 family;
- if (n->nlmsg_type != XFRM_MSG_ACQUIRE) {
- fprintf(stderr, "Not an acquire: %08x %08x %08x\n",
- n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
- return 0;
- }
-
len -= NLMSG_LENGTH(sizeof(*xacq));
if (len < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
@@ -108,6 +102,74 @@ static int xfrm_acquire_print(const struct sockaddr_nl *who,
return 0;
}
+static int xfrm_state_flush_print(const struct sockaddr_nl *who,
+ struct nlmsghdr *n, void *arg)
+{
+ FILE *fp = (FILE*)arg;
+ struct xfrm_usersa_flush *xsf = NLMSG_DATA(n);
+ int len = n->nlmsg_len;
+ const char *str;
+
+ len -= NLMSG_SPACE(sizeof(*xsf));
+ if (len < 0) {
+ fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
+ return -1;
+ }
+
+ fprintf(fp, "Flushed state ");
+
+ str = strxf_xfrmproto(xsf->proto);
+ if (str)
+ fprintf(fp, "proto %s", str);
+ else
+ fprintf(fp, "proto %u", xsf->proto);
+ fprintf(fp, "%s", _SL_);
+
+ if (oneline)
+ fprintf(fp, "\n");
+ fflush(fp);
+
+ return 0;
+}
+
+static int xfrm_policy_flush_print(const struct sockaddr_nl *who,
+ struct nlmsghdr *n, void *arg)
+{
+ struct rtattr * tb[XFRMA_MAX+1];
+ FILE *fp = (FILE*)arg;
+ int len = n->nlmsg_len;
+
+ len -= NLMSG_SPACE(0);
+ if (len < 0) {
+ fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
+ return -1;
+ }
+
+ fprintf(fp, "Flushed policy ");
+
+ parse_rtattr(tb, XFRMA_MAX, NLMSG_DATA(n), len);
+
+ if (tb[XFRMA_POLICY_TYPE]) {
+ struct xfrm_userpolicy_type *upt;
+
+ fprintf(fp, "ptype ");
+
+ if (RTA_PAYLOAD(tb[XFRMA_POLICY_TYPE]) < sizeof(*upt))
+ fprintf(fp, "(ERROR truncated)");
+
+ upt = (struct xfrm_userpolicy_type *)RTA_DATA(tb[XFRMA_POLICY_TYPE]);
+ fprintf(fp, "%s ", strxf_ptype(upt->type));
+ }
+
+ fprintf(fp, "%s", _SL_);
+
+ if (oneline)
+ fprintf(fp, "\n");
+ fflush(fp);
+
+ return 0;
+}
+
static int xfrm_report_print(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
@@ -117,12 +179,6 @@ static int xfrm_report_print(const struct sockaddr_nl *who,
struct rtattr * tb[XFRMA_MAX+1];
__u16 family;
- if (n->nlmsg_type != XFRM_MSG_REPORT) {
- fprintf(stderr, "Not a report: %08x %08x %08x\n",
- n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
- return 0;
- }
-
len -= NLMSG_LENGTH(sizeof(*xrep));
if (len < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
@@ -201,42 +257,38 @@ static int xfrm_accept_msg(const struct sockaddr_nl *who,
if (timestamp)
print_timestamp(fp);
- if (n->nlmsg_type == XFRM_MSG_NEWSA ||
- n->nlmsg_type == XFRM_MSG_DELSA ||
- n->nlmsg_type == XFRM_MSG_UPDSA ||
- n->nlmsg_type == XFRM_MSG_EXPIRE) {
+ switch (n->nlmsg_type) {
+ case XFRM_MSG_NEWSA:
+ case XFRM_MSG_DELSA:
+ case XFRM_MSG_UPDSA:
+ case XFRM_MSG_EXPIRE:
xfrm_state_print(who, n, arg);
return 0;
- }
- if (n->nlmsg_type == XFRM_MSG_NEWPOLICY ||
- n->nlmsg_type == XFRM_MSG_DELPOLICY ||
- n->nlmsg_type == XFRM_MSG_UPDPOLICY ||
- n->nlmsg_type == XFRM_MSG_POLEXPIRE) {
+ case XFRM_MSG_NEWPOLICY:
+ case XFRM_MSG_DELPOLICY:
+ case XFRM_MSG_UPDPOLICY:
+ case XFRM_MSG_POLEXPIRE:
xfrm_policy_print(who, n, arg);
return 0;
- }
-
- if (n->nlmsg_type == XFRM_MSG_ACQUIRE) {
+ case XFRM_MSG_ACQUIRE:
xfrm_acquire_print(who, n, arg);
return 0;
- }
- if (n->nlmsg_type == XFRM_MSG_FLUSHSA) {
- /* XXX: Todo: show proto in xfrm_usersa_flush */
- fprintf(fp, "Flushed state\n");
+ case XFRM_MSG_FLUSHSA:
+ xfrm_state_flush_print(who, n, arg);
return 0;
- }
- if (n->nlmsg_type == XFRM_MSG_FLUSHPOLICY) {
- fprintf(fp, "Flushed policy\n");
+ case XFRM_MSG_FLUSHPOLICY:
+ xfrm_policy_flush_print(who, n, arg);
return 0;
- }
- if (n->nlmsg_type == XFRM_MSG_REPORT) {
+ case XFRM_MSG_REPORT:
xfrm_report_print(who, n, arg);
return 0;
- }
- if (n->nlmsg_type == XFRM_MSG_NEWAE) {
+ case XFRM_MSG_NEWAE:
xfrm_ae_print(who, n, arg);
return 0;
+ default:
+ break;
}
+
if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
n->nlmsg_type != NLMSG_DONE) {
fprintf(fp, "Unknown message: %08d 0x%08x 0x%08x\n",
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 29604a5..f51e8b6 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -1053,7 +1053,6 @@ static int xfrm_state_flush(int argc, char **argv)
if (show_stats > 1)
fprintf(stderr, "Flush state proto=%s\n",
- (req.xsf.proto == IPSEC_PROTO_ANY) ? "any" :
strxf_xfrmproto(req.xsf.proto));
if (rtnl_talk(&rth, &req.n, 0, 0, NULL, NULL, NULL) < 0)
--
1.4.4.2
^ permalink raw reply related
* [PATCH 1/3] [IPROUTE2] ip: xfrm: Clean-up for internal mask to filter.
From: Masahide NAKAMURA @ 2007-08-24 2:05 UTC (permalink / raw)
To: Stephen Hemminger, netdev; +Cc: Masahide NAKAMURA
Remove unused or redundant usage for xfrm_filter.
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
---
ip/xfrm_policy.c | 17 -----------------
ip/xfrm_state.c | 2 --
2 files changed, 0 insertions(+), 19 deletions(-)
diff --git a/ip/xfrm_policy.c b/ip/xfrm_policy.c
index c1086f1..f4488ac 100644
--- a/ip/xfrm_policy.c
+++ b/ip/xfrm_policy.c
@@ -222,16 +222,10 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv)
NEXT_ARG();
xfrm_policy_dir_parse(&req.xpinfo.dir, &argc, &argv);
-
- filter.dir_mask = XFRM_FILTER_MASK_FULL;
-
} else if (strcmp(*argv, "index") == 0) {
NEXT_ARG();
if (get_u32(&req.xpinfo.index, *argv, 0))
invarg("\"INDEX\" is invalid", *argv);
-
- filter.index_mask = XFRM_FILTER_MASK_FULL;
-
} else if (strcmp(*argv, "ptype") == 0) {
if (ptypep)
duparg("ptype", *argv);
@@ -239,9 +233,6 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv)
NEXT_ARG();
xfrm_policy_ptype_parse(&upt.type, &argc, &argv);
-
- filter.dir_mask = XFRM_FILTER_MASK_FULL;
-
} else if (strcmp(*argv, "action") == 0) {
NEXT_ARG();
if (strcmp(*argv, "allow") == 0)
@@ -250,16 +241,10 @@ static int xfrm_policy_modify(int cmd, unsigned flags, int argc, char **argv)
req.xpinfo.action = XFRM_POLICY_BLOCK;
else
invarg("\"action\" value is invalid\n", *argv);
-
- filter.action_mask = XFRM_FILTER_MASK_FULL;
-
} else if (strcmp(*argv, "priority") == 0) {
NEXT_ARG();
if (get_u32(&req.xpinfo.priority, *argv, 0))
invarg("\"PRIORITY\" is invalid", *argv);
-
- filter.priority_mask = XFRM_FILTER_MASK_FULL;
-
} else if (strcmp(*argv, "limit") == 0) {
NEXT_ARG();
xfrm_lifetime_cfg_parse(&req.xpinfo.lft, &argc, &argv);
@@ -888,8 +873,6 @@ static int xfrm_policy_flush(int argc, char **argv)
NEXT_ARG();
xfrm_policy_ptype_parse(&upt.type, &argc, &argv);
-
- filter.dir_mask = XFRM_FILTER_MASK_FULL;
} else
invarg("unknown", *argv);
diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index 54e1330..2b68f49 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -216,8 +216,6 @@ static int xfrm_state_flag_parse(__u8 *flags, int *argcp, char ***argvp)
}
}
- filter.state_flags_mask = XFRM_FILTER_MASK_FULL;
-
*argcp = argc;
*argvp = argv;
--
1.4.4.2
^ permalink raw reply related
* [PATCH 0/3] [IPROUTE2] ip command updates
From: Masahide NAKAMURA @ 2007-08-24 2:06 UTC (permalink / raw)
To: Stephen Hemminger, netdev
Hello,
There are updates for ip command. They are almost minor fixes
and are not changes about 2.6.23 new features.
Please apply if it is not too late for next release.
--
Masahide NAKAMURA
^ permalink raw reply
* Re: [PATCH 4/9] s2io, rename BIT macro
From: Richard Knutsson @ 2007-08-24 2:35 UTC (permalink / raw)
To: Jiri Slaby
Cc: Andrew Morton, linux-kernel, ram.vepa, santosh.rastapur,
sivakumar.subramani, sreenivasa.honnur, netdev
In-Reply-To: <27692164102679012429@wsc.cz>
Jiri Slaby wrote:
> s2io, rename BIT macro
>
> BIT macro will be global definiton of (1<<x)
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
>
> ---
>
[snip]
> cnt++;
> if (cnt == 5)
> diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
> index 92983ee..448f899 100644
> --- a/drivers/net/s2io.h
> +++ b/drivers/net/s2io.h
> @@ -14,7 +14,7 @@
> #define _S2IO_H
>
> #define TBD 0
> -#define BIT(loc) (0x8000000000000000ULL >> (loc))
> +#define s2BIT(loc) (0x8000000000000000ULL >> (loc))
> #define vBIT(val, loc, sz) (((u64)val) << (64-loc-sz))
> #define INV(d) ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| ((d>>24)&0xff)
>
>
Sorry for the late response, but would it not be better/easier to use
BIT() instead (or a global #define LLBIT(nr) (1ULL << (nr))) and just
recalculate the values?
Richard Knutsson
^ permalink raw reply
* [ofa-general] Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: Bill Fink @ 2007-08-24 3:18 UTC (permalink / raw)
To: Rick Jones
Cc: jagana, herbert, gaagaan, Robert.Olsson, mcarlson, rdreier,
peter.p.waskiewicz.jr, hadi, kaber, jeff, general, mchan, tgraf,
netdev, johnpol, shemminger, David Miller, sri
In-Reply-To: <46CE0BA1.60206@hp.com>
On Thu, 23 Aug 2007, Rick Jones wrote:
> jamal wrote:
> > [TSO already passed - iirc, it has been
> > demostranted to really not add much to throughput (cant improve much
> > over closeness to wire speed) but improve CPU utilization].
>
> In the one gig space sure, but in the 10 Gig space, TSO on/off does make a
> difference for throughput.
Not too much.
TSO enabled:
[root@lang2 ~]# ethtool -k eth2
Offload parameters for eth2:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: on
[root@lang2 ~]# nuttcp -w10m 192.168.88.16
11813.4375 MB / 10.00 sec = 9906.1644 Mbps 99 %TX 80 %RX
TSO disabled:
[root@lang2 ~]# ethtool -K eth2 tso off
[root@lang2 ~]# ethtool -k eth2
Offload parameters for eth2:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: off
[root@lang2 ~]# nuttcp -w10m 192.168.88.16
11818.2500 MB / 10.00 sec = 9910.0176 Mbps 100 %TX 78 %RX
Pretty negligible difference it seems.
This is with a 2.6.20.7 kernel, Myricom 10-GigE NICs, and 9000 byte
jumbo frames, in a LAN environment.
For grins, I also did a couple of tests with an MSS of 1460 to
emulate a standard 1500 byte Ethernet MTU.
TSO enabled:
[root@lang2 ~]# ethtool -k eth2
Offload parameters for eth2:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: on
[root@lang2 ~]# nuttcp -M1460 -w10m 192.168.88.16
5102.8503 MB / 10.06 sec = 4253.9124 Mbps 39 %TX 99 %RX
TSO disabled:
[root@lang2 ~]# ethtool -K eth2 tso off
[root@lang2 ~]# ethtool -k eth2
Offload parameters for eth2:
rx-checksumming: on
tx-checksumming: on
scatter-gather: on
tcp segmentation offload: off
[root@lang2 ~]# nuttcp -M1460 -w10m 192.168.88.16
5399.5625 MB / 10.00 sec = 4527.9070 Mbps 99 %TX 76 %RX
Here you can see there is a major difference in the TX CPU utilization
(99 % with TSO disabled versus only 39 % with TSO enabled), although
the TSO disabled case was able to squeeze out a little extra performance
from its extra CPU utilization. Interestingly, with TSO enabled, the
receiver actually consumed more CPU than with TSO disabled, so I guess
the receiver CPU saturation in that case (99 %) was what restricted
its performance somewhat (this was consistent across a few test runs).
-Bill
^ permalink raw reply
* [ofa-general] Re: [PATCH 0/9 Rev3] Implement batching skb API and support in IPoIB
From: Stephen Hemminger @ 2007-08-24 3:34 UTC (permalink / raw)
To: hadi
Cc: jagana, peter.p.waskiewicz.jr, herbert, gaagaan, Robert.Olsson,
netdev, rdreier, mcarlson, kaber, jeff, general, mchan, tgraf,
johnpol, David Miller, sri
In-Reply-To: <1187908702.4279.36.camel@localhost>
On Thu, 23 Aug 2007 18:38:22 -0400
jamal <hadi@cyberus.ca> wrote:
> On Thu, 2007-23-08 at 15:30 -0700, David Miller wrote:
> > From: jamal <hadi@cyberus.ca>
> > Date: Thu, 23 Aug 2007 18:04:10 -0400
> >
> > > Possibly a bug - but you really should turn off TSO if you are doing
> > > huge interactive transactions (which is fair because there is a clear
> > > demarcation).
> >
> > I don't see how this can matter.
> >
> > TSO only ever does anything if you accumulate more than one MSS
> > worth of data.
>
> I stand corrected then.
>
> cheers,
> jamal
>
For most normal Internet TCP connections, you will see only 2 or 3 packets per TSO
because of ACK clocking. If you turn off delayed ACK on the receiver it
will be even less.
A current hot topic of research is reducing the number of ACK's to make TCP
work better over asymmetric links like 3G.
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply
* (unknown)
From: Eugene Teo @ 2007-08-24 2:42 UTC (permalink / raw)
To: netdev
subscribe netdev
^ 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