Re: [PATCH 3/4] ehea: queue managment

2006-06-08 Thread Muli Ben-Yehuda
On Wed, Jun 07, 2006 at 10:29:50AM -0700, Stephen Hemminger wrote:

 Be careful about global namespace issues. Stick to one prefix like ehea_
 for all non static function names. Consider putting all in one file, or
 use #include to cause it to be one compilation unit.

I thought including .c files was discouraged (if not, it should be...)

Cheers,
Muli
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] workaround zd1201 interference problem

2006-06-08 Thread Pavel Machek
Hi!

 Well, I'll try _enable() alone, but it seems to me that _enable()
 command is needed to initialize radio properly. I do not think we can
 get much further without firmware sources...
 
 If you can formulate a proper and technical description of the issue 
 (and exactly what is needed to workaround it), I can contact ZyDAS for 
 you. They have been very helpful with ZD1211.

Okay, the issue is:

if you plug zd1201 into USB, it starts jamming radio,
immediately. Enable/disable, or iwlist wlan0 scan, or basically any
operation unjams the radio. This patch works it around:

diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 335eaf3..dcc7bc7 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -1835,8 +1835,8 @@ static int zd1201_probe(struct usb_inter
zd-dev-name);

usb_set_intfdata(interface, zd);
-   zd1201_enable(zd);
-   zd1201_disable(zd);
+   zd1201_enable(zd);  /* zd1201 likes to startup enabled, interfering 
*/
+   zd1201_disable(zd); /* with all the wifis in range */
return 0;
 
 err_net:


question is is that right solution, or is something different
needed to solve that problem properly?
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] workaround zd1201 interference problem

2006-06-08 Thread Pavel Machek
Hi!

  Well, I'll try _enable() alone, but it seems to me that _enable()
  command is needed to initialize radio properly. I do not think we can
  get much further without firmware sources...
  
  If you can formulate a proper and technical description of the issue 
  (and exactly what is needed to workaround it), I can contact ZyDAS for 
  you. They have been very helpful with ZD1211.
 
 Okay, the issue is:
 
 if you plug zd1201 into USB, it starts jamming radio,
 immediately. Enable/disable, or iwlist wlan0 scan, or basically any
 operation unjams the radio. This patch works it around:

Of course, the patch should have been:

 diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
 index 335eaf3..dcc7bc7 100644
 --- a/drivers/net/wireless/zd1201.c
 +++ b/drivers/net/wireless/zd1201.c
 @@ -1835,6 +1835,8 @@ static int zd1201_probe(struct usb_inter
zd-dev-name);

usb_set_intfdata(interface, zd);
 +  zd1201_enable(zd);  /* zd1201 likes to startup enabled, interfering 
*/
 +  zd1201_disable(zd); /* with all the wifis in range */
return 0;
  
  err_net:
 
 
 question is is that right solution, or is something different
 needed to solve that problem properly?
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/12] d80211: fix Oops when writing to add_ and remove_iface

2006-06-08 Thread Jiri Benc
When add_iface or remove_iface sysfs attribute is opened just before device
is unregistered and some data is written there afterwards, their handlers
try to access master net_device which is released at that point.

A similar problem can happen when ioctl is invoked during unregistering - it
is possible that interface the ioctl was called on is still there but master
interface has been already freed.

Fix these problems by:
- checking if the device is unregistered in sysfs handlers and
- releasing all interfaces under single rtnl lock.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c   |9 +++--
 net/d80211/ieee80211_i.h |6 ++
 net/d80211/ieee80211_sysfs.c |   17 +++--
 3 files changed, 28 insertions(+), 4 deletions(-)

25dd82745a86401267b9954098b99ba4a60a71f6
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 4fc2e7d..c983d70 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4225,6 +4225,8 @@ int ieee80211_register_hw(struct net_dev
result = ieee80211_if_add(dev, wlan%d, 1, sta_dev);
if (result == 0)
ieee80211_if_set_type(sta_dev, IEEE80211_IF_TYPE_STA);
+
+   local-reg_state = IEEE80211_DEV_REGISTERED;
rtnl_unlock();
 
return 0;
@@ -4290,14 +4292,17 @@ void ieee80211_unregister_hw(struct net_
del_timer_sync(local-scan_timer);
ieee80211_rx_bss_list_deinit(dev);
 
+   rtnl_lock();
+   local-reg_state = IEEE80211_DEV_UNREGISTERED;
if (local-apdev)
-   ieee80211_if_del(local-apdev);
+   ieee80211_if_del_mgmt(local-apdev);
 
list_for_each_safe(ptr, n, local-sub_if_list) {
struct ieee80211_sub_if_data *sdata =
list_entry(ptr, struct ieee80211_sub_if_data, list);
-   ieee80211_if_del(sdata-dev);
+   __ieee80211_if_del(local, sdata);
}
+   rtnl_unlock();
 
sta_info_stop(local);
ieee80211_dev_sysfs_del(local);
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 84cc50e..9fabf17 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -321,6 +321,12 @@ struct ieee80211_local {
int dev_index;
struct class_device class_dev;
 
+   enum {
+   IEEE80211_DEV_UNITIALIZED = 0,
+   IEEE80211_DEV_REGISTERED,
+   IEEE80211_DEV_UNREGISTERED,
+   } reg_state;
+
/* Tasklet and skb queue to process calls from IRQ mode. All frames
 * added to skb_queue will be processed, but frames in
 * skb_queue_unreliable may be dropped if the total length of these
diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c
index fb95e96..e799506 100644
--- a/net/d80211/ieee80211_sysfs.c
+++ b/net/d80211/ieee80211_sysfs.c
@@ -17,6 +17,15 @@ #include ieee80211_i.h
 
 #define to_ieee80211_local(class)  container_of(class, struct 
ieee80211_local, class_dev)
 
+static inline int rtnl_lock_local(struct ieee80211_local *local)
+{
+   rtnl_lock();
+   if (unlikely(local-reg_state != IEEE80211_DEV_REGISTERED)) {
+   rtnl_unlock();
+   return -ENODEV;
+   }
+   return 0;
+}
 
 static ssize_t store_add_iface(struct class_device *dev,
   const char *buf, size_t len)
@@ -29,7 +38,9 @@ static ssize_t store_add_iface(struct cl
return -EPERM;
if (len  IFNAMSIZ)
return -EINVAL;
-   rtnl_lock();
+   res = rtnl_lock_local(local);
+   if (res)
+   return res;
res = ieee80211_if_add(local-mdev, buf, 0, new_dev);
if (res == 0)
ieee80211_if_set_type(new_dev, IEEE80211_IF_TYPE_STA);
@@ -47,7 +58,9 @@ static ssize_t store_remove_iface(struct
return -EPERM;
if (len  IFNAMSIZ)
return -EINVAL;
-   rtnl_lock();
+   res = rtnl_lock_local(local);
+   if (res)
+   return res;
res = ieee80211_if_remove(local-mdev, buf, -1);
rtnl_unlock();
return res  0 ? res : len;
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] d80211: rate_control sysfs attributes

2006-06-08 Thread Jiri Benc
Add support for sysfs attributes for rate_control modules.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c|   13 -
 net/d80211/rate_control.c |   42 ++
 net/d80211/rate_control.h |   36 
 net/d80211/sta_info.c |4 
 4 files changed, 94 insertions(+), 1 deletions(-)

9acfab1d1a4e4a82dace4055a089d605d5efa97f
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 75aaa99..e4ac701 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4215,6 +4215,13 @@ int ieee80211_register_hw(struct net_dev
   algorithm\n, dev-name);
goto fail_rate;
}
+   result = rate_control_add_attrs(local, local-rate_ctrl_priv,
+   local-class_dev.kobj);
+   if (result  0) {
+   printk(KERN_DEBUG %s: Failed to register sysfs attributes 
+  for rate control\n, dev-name);
+   goto fail_rate_attrs;
+   }
 
/* TODO: add rtnl locking around device creation and qdisc install */
ieee80211_install_qdisc(dev);
@@ -4233,6 +4240,8 @@ int ieee80211_register_hw(struct net_dev
 
return 0;
 
+fail_rate_attrs:
+   rate_control_free(local);
 fail_rate:
ieee80211_sysfs_remove_netdevice(dev);
 fail_if_sysfs:
@@ -4308,6 +4317,8 @@ void ieee80211_unregister_hw(struct net_
rtnl_unlock();
 
sta_info_stop(local);
+   rate_control_remove_attrs(local, local-rate_ctrl_priv,
+ local-class_dev.kobj);
ieee80211_dev_sysfs_del(local);
 
for (i = 0; i  IEEE80211_FRAGMENT_MAX; i++)
@@ -4327,7 +4338,6 @@ void ieee80211_unregister_hw(struct net_
skb_queue_purge(local-skb_queue);
skb_queue_purge(local-skb_queue_unreliable);
 
-   rate_control_free(local);
ieee80211_dev_free_index(local);
 }
 
@@ -4341,6 +4351,7 @@ void ieee80211_free_hw(struct net_device
 
 void ieee80211_release_hw(struct ieee80211_local *local)
 {
+   rate_control_free(local);
kfree(local);
 }
 
diff --git a/net/d80211/rate_control.c b/net/d80211/rate_control.c
index e7e6791..33ba8e2 100644
--- a/net/d80211/rate_control.c
+++ b/net/d80211/rate_control.c
@@ -350,6 +350,46 @@ static int rate_control_simple_status_gl
return 0;
 }
 
+static ssize_t show_sta_tx_avg_rate_sum(const struct sta_info *sta, char *buf)
+{
+   struct sta_rate_control *srctrl = sta-rate_ctrl_priv;
+
+   return sprintf(buf, %d\n, srctrl-tx_avg_rate_sum);
+}
+
+static ssize_t show_sta_tx_avg_rate_num(const struct sta_info *sta, char *buf)
+{
+   struct sta_rate_control *srctrl = sta-rate_ctrl_priv;
+
+   return sprintf(buf, %d\n, srctrl-tx_avg_rate_num);
+}
+
+static struct sta_attribute sta_attr_tx_avg_rate_sum =
+   __ATTR(tx_avg_rate_sum, S_IRUSR, show_sta_tx_avg_rate_sum, NULL);
+static struct sta_attribute sta_attr_tx_avg_rate_num =
+   __ATTR(tx_avg_rate_num, S_IRUSR, show_sta_tx_avg_rate_num, NULL);
+
+static struct attribute *rate_control_simple_sta_attrs[] = {
+   sta_attr_tx_avg_rate_sum.attr,
+   sta_attr_tx_avg_rate_num.attr,
+   NULL,
+};
+
+static struct attribute_group rate_control_simple_sta_group = {
+   .name = rate_control_simple,
+   .attrs = rate_control_simple_sta_attrs,
+};
+
+static int rate_control_simple_add_sta_attrs(void *priv, struct kobject *kobj)
+{
+   return sysfs_create_group(kobj, rate_control_simple_sta_group);
+}
+
+static void rate_control_simple_remove_sta_attrs(void *priv,
+struct kobject *kobj)
+{
+   sysfs_remove_group(kobj, rate_control_simple_sta_group);
+}
 
 static struct rate_control_ops rate_control_simple = {
.name = simple,
@@ -363,6 +403,8 @@ static struct rate_control_ops rate_cont
.free = rate_control_simple_free,
.alloc_sta = rate_control_simple_alloc_sta,
.free_sta = rate_control_simple_free_sta,
+   .add_sta_attrs = rate_control_simple_add_sta_attrs,
+   .remove_sta_attrs = rate_control_simple_remove_sta_attrs,
 };
 
 
diff --git a/net/d80211/rate_control.h b/net/d80211/rate_control.h
index b509539..7705fb2 100644
--- a/net/d80211/rate_control.h
+++ b/net/d80211/rate_control.h
@@ -53,6 +53,11 @@ struct rate_control_ops {
void (*free)(void *priv);
void * (*alloc_sta)(void);
void (*free_sta)(void *priv);
+
+   int (*add_attrs)(void *priv, struct kobject *kobj);
+   void (*remove_attrs)(void *priv, struct kobject *kobj);
+   int (*add_sta_attrs)(void *priv, struct kobject *kobj);
+   void (*remove_sta_attrs)(void *priv, struct kobject *kobj);
 };
 
 
@@ -132,4 +137,35 @@ static inline void rate_control_free_sta
local-rate_ctrl-free_sta(priv);
 }
 
+static inline int rate_control_add_attrs(struct ieee80211_local *local,
+void 

[PATCH 11/12] d80211: encryption keys sysfs attributes

2006-06-08 Thread Jiri Benc
Add /sys/class/ieee80211/phyX/sta/*/key/* and /sys/class/net/X/keys/[0-3]/*
attributes.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c   |   33 ++
 net/d80211/ieee80211_i.h |   11 ++
 net/d80211/ieee80211_ioctl.c |  101 ---
 net/d80211/ieee80211_key.h   |2 
 net/d80211/ieee80211_sysfs.c |   12 ++
 net/d80211/ieee80211_sysfs_sta.c |  206 ++
 6 files changed, 326 insertions(+), 39 deletions(-)

9b2e2e2cc66e7fb3f1ae07d7e083ffa63dffbde7
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index e4ac701..1a03f07 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -84,15 +84,44 @@ ieee80211_key_data2conf(struct ieee80211
return conf;
 }
 
+struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
+ int idx, size_t key_len, gfp_t flags)
+{
+   struct ieee80211_key *key;
+   int res;
+
+   key = kzalloc(sizeof(struct ieee80211_key) + key_len, flags);
+   if (!key)
+   return NULL;
+   if (sdata)
+   res = kobject_set_name(key-kobj, %d, idx);
+   else
+   res = kobject_set_name(key-kobj, key);
+   if (res) {
+   kfree(key);
+   return NULL;
+   }
+   ieee80211_key_sysfs_set_kset(key, sdata ? sdata-key_kset : NULL);
+   kobject_init(key-kobj);
+   return key;
+}
 
 void ieee80211_key_free(struct ieee80211_key *key)
 {
-   if (key  key-alg == ALG_CCMP)
+   if (key)
+   kobject_put(key-kobj);
+}
+
+void ieee80211_key_release(struct kobject *kobj)
+{
+   struct ieee80211_key *key;
+
+   key = container_of(kobj, struct ieee80211_key, kobj);
+   if (key-alg == ALG_CCMP)
ieee80211_aes_key_free(key-u.ccmp.tfm);
kfree(key);
 }
 
-
 static int rate_list_match(int *rate_list, int rate)
 {
int i;
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 212d12f..c1d7422 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -294,6 +294,7 @@ struct ieee80211_sub_if_data {
 #define NUM_DEFAULT_KEYS 4
 struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
 struct ieee80211_key *default_key;
+   struct kset key_kset;
 
struct ieee80211_if_ap *bss; /* BSS that this device belongs to */
 
@@ -527,7 +528,10 @@ int ieee80211_if_config(struct net_devic
 struct ieee80211_key_conf *
 ieee80211_key_data2conf(struct ieee80211_local *local,
struct ieee80211_key *data);
+struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
+ int idx, size_t key_len, gfp_t flags);
 void ieee80211_key_free(struct ieee80211_key *key);
+void ieee80211_key_release(struct kobject *kobj);
 void ieee80211_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
   struct ieee80211_rx_status *status, u32 msg_type);
 void ieee80211_prepare_rates(struct net_device *dev);
@@ -633,5 +637,12 @@ int ieee80211_sta_kset_sysfs_register(st
 void ieee80211_sta_kset_sysfs_unregister(struct ieee80211_local *local);
 int ieee80211_sta_sysfs_add(struct sta_info *sta);
 void ieee80211_sta_sysfs_remove(struct sta_info *sta);
+int ieee80211_key_kset_sysfs_register(struct ieee80211_sub_if_data *sdata);
+void ieee80211_key_kset_sysfs_unregister(struct ieee80211_sub_if_data *sdata);
+void ieee80211_key_sysfs_set_kset(struct ieee80211_key *key, struct kset 
*kset);
+int ieee80211_key_sysfs_add(struct ieee80211_key *key);
+void ieee80211_key_sysfs_remove(struct ieee80211_key *key);
+int ieee80211_key_sysfs_add_default(struct ieee80211_sub_if_data *sdata);
+void ieee80211_key_sysfs_remove_default(struct ieee80211_sub_if_data *sdata);
 
 #endif /* IEEE80211_I_H */
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 562b9f3..7c2a847 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -470,7 +470,7 @@ static int ieee80211_set_encryption(stru
struct ieee80211_local *local = dev-ieee80211_ptr;
int ret = 0;
struct sta_info *sta;
-   struct ieee80211_key **key;
+   struct ieee80211_key *key, *old_key;
int try_hwaccel = 1;
 struct ieee80211_key_conf *keyconf;
 struct ieee80211_sub_if_data *sdata;
@@ -486,7 +486,7 @@ static int ieee80211_set_encryption(stru
   dev-name, idx);
return -EINVAL;
}
-   key = sdata-keys[idx];
+   key = sdata-keys[idx];
 
/* Disable hwaccel for default keys when the interface is not
 * the default one.
@@ -525,7 +525,7 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
return -ENOENT;
}
 
-   key = sta-key;
+   key = sta-key;
}
 
/* FIX:
@@ -571,8 

[PATCH 3/12] d80211: separate allocation of ieee80211_local

2006-06-08 Thread Jiri Benc
ieee80211_local has a separate class_device. That means it has reference
counting independent of master net_device and can be freed at a different
time, therefore these two structures cannot be allocated together.

Solve this by adding ieee80211_ptr pointer to net_device structure (similar
to other pointers already presented there) and using it as a pointer to
independently allocated ieee80211_local.

This also allows is_ieee80211_device function to be nice finally.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 include/linux/netdevice.h|1 
 net/d80211/ieee80211.c   |  100 +-
 net/d80211/ieee80211_dev.c   |   17 +++
 net/d80211/ieee80211_i.h |9 +++-
 net/d80211/ieee80211_iface.c |   20 
 net/d80211/ieee80211_ioctl.c |   92 +++
 net/d80211/ieee80211_proc.c  |6 +--
 net/d80211/ieee80211_scan.c  |   10 ++--
 net/d80211/ieee80211_sta.c   |   58 
 net/d80211/ieee80211_sysfs.c |   26 ---
 net/d80211/rate_control.c|4 +-
 net/d80211/rate_control.h|4 +-
 net/d80211/wme.c |   26 +--
 13 files changed, 206 insertions(+), 167 deletions(-)

3085d33e38881f0987329c4258514f60ffe824af
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f4169bb..037e63a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -371,6 +371,7 @@ #define NETIF_F_UFO 8192
void*ip6_ptr;   /* IPv6 specific data */
void*ec_ptr;/* Econet specific data */
void*ax25_ptr;  /* AX.25 specific data */
+   void*ieee80211_ptr; /* IEEE 802.11 specific data */
 
 /*
  * Cache line mostly used on receive path (including eth_type_trans())
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 9724a49..4fc2e7d 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -110,7 +110,7 @@ static int rate_list_match(int *rate_lis
 
 void ieee80211_prepare_rates(struct net_device *dev)
 {
-   struct ieee80211_local *local = dev-priv;
+   struct ieee80211_local *local = dev-ieee80211_ptr;
int i;
 
for (i = 0; i  local-num_curr_rates; i++) {
@@ -1059,7 +1059,7 @@ __ieee80211_tx_prepare(struct ieee80211_
   struct net_device *dev,
   struct ieee80211_tx_control *control)
 {
-   struct ieee80211_local *local = dev-priv;
+   struct ieee80211_local *local = dev-ieee80211_ptr;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb-data;
int hdrlen;
 
@@ -1095,12 +1095,9 @@ __ieee80211_tx_prepare(struct ieee80211_
 
 }
 
-/* FIXME: This is not nice but currently there doesn't exist more elegant way 
*/
 static int inline is_ieee80211_device(struct net_device *dev)
 {
-   return (dev-wireless_handlers ==
-   (struct iw_handler_def *) ieee80211_iw_handler_def) ||
-  (dev-hard_start_xmit == ieee80211_mgmt_start_xmit);
+   return (dev-ieee80211_ptr != NULL);
 }
 
 /* Device in tx-dev has a reference added; use dev_put(tx-dev) when
@@ -1131,7 +1128,7 @@ static void inline ieee80211_tx_prepare(
 static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
struct ieee80211_tx_control *control, int mgmt)
 {
-   struct ieee80211_local *local = dev-priv;
+   struct ieee80211_local *local = dev-ieee80211_ptr;
struct sta_info *sta;
ieee80211_tx_handler *handler;
struct ieee80211_txrx_data tx;
@@ -1307,7 +1304,7 @@ #endif
 static int ieee80211_subif_start_xmit(struct sk_buff *skb,
  struct net_device *dev)
 {
-struct ieee80211_local *local = (struct ieee80211_local *) dev-priv;
+   struct ieee80211_local *local = dev-ieee80211_ptr;
struct ieee80211_tx_packet_data *pkt_data;
 struct ieee80211_sub_if_data *sdata;
int ret = 1, head_need;
@@ -1613,7 +1610,7 @@ static void ieee80211_beacon_add_tim(str
 struct sk_buff * ieee80211_beacon_get(struct net_device *dev, int if_id,
  struct ieee80211_tx_control *control)
 {
-   struct ieee80211_local *local = dev-priv;
+   struct ieee80211_local *local = dev-ieee80211_ptr;
struct sk_buff *skb;
struct net_device *bdev;
struct ieee80211_sub_if_data *sdata = NULL;
@@ -1690,7 +1687,7 @@ struct sk_buff *
 ieee80211_get_buffered_bc(struct net_device *dev, int if_id,
  struct ieee80211_tx_control *control)
 {
-   struct ieee80211_local *local = dev-priv;
+   struct ieee80211_local *local = dev-ieee80211_ptr;
struct sk_buff *skb;
struct sta_info *sta;
ieee80211_tx_handler *handler;
@@ -1754,7 +1751,7 @@ ieee80211_get_buffered_bc(struct net_dev
 int ieee80211_if_config(struct net_device *dev)
 {

[PATCH 0/12] d80211: use sysfs instead of procfs

2006-06-08 Thread Jiri Benc
The following series of patches makes d80211 to use sysfs instead of procfs.
This means that custom reference counting in most structures is replaced by
kobjects and nearly all informations from procfs files are converted to
sysfs attributes.

The only information missing in sysfs (compared to procfs) is channels and
rates info. Implementing this in a sysfs way (i. e. one information per
attribute rule) requires a lot of code and (more important) adding kobjects
to channel and rate structures. I doubt these informations are really so
useful to be worth such complications. If there are good arguments why these
informations should be exported via sysfs I will add them.

If you find a better name for some object (directory) or attribute (file) or
just consider some name wrong or ugly, let me know please.

The third patch (separate allocation of ieee80211_local) touches the code
outside of net/d80211 - it adds ieee80211_ptr to net_device structure.

All of patches can be also obtained from 'master' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git

---

Jiri Benc:
  d80211: deinit sysfs in case of an error
  d80211: better sysfs registration of symlinks to wiphy
  d80211: separate allocation of ieee80211_local
  d80211: fix Oops when writing to add_ and remove_iface
  d80211: wiphy sysfs attributes
  d80211: network interface sysfs attributes
  d80211: rename sta_info_relase to sta_info_put
  d80211: sysfs attributes for associated stations
  d80211: remove useless parameters
  d80211: rate_control sysfs attributes
  d80211: encryption keys sysfs attributes
  d80211: remove procfs files

 include/linux/netdevice.h|1 
 net/d80211/Makefile  |2 
 net/d80211/ieee80211.c   |  206 +++---
 net/d80211/ieee80211_dev.c   |   17 +
 net/d80211/ieee80211_i.h |   45 ++
 net/d80211/ieee80211_iface.c |   43 +-
 net/d80211/ieee80211_ioctl.c |  213 ++
 net/d80211/ieee80211_key.h   |2 
 net/d80211/ieee80211_proc.c  |  771 --
 net/d80211/ieee80211_proc.h  |   45 --
 net/d80211/ieee80211_scan.c  |   10 
 net/d80211/ieee80211_sta.c   |   68 ++-
 net/d80211/ieee80211_sysfs.c |  706 +--
 net/d80211/ieee80211_sysfs_sta.c |  434 +
 net/d80211/rate_control.c|   55 ++-
 net/d80211/rate_control.h|   57 ++-
 net/d80211/sta_info.c|  132 ---
 net/d80211/sta_info.h|   16 -
 net/d80211/wme.c |   26 +
 19 files changed, 1663 insertions(+), 1186 deletions(-)


-- 
Jiri Benc
SUSE Labs
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/12] d80211: network interface sysfs attributes

2006-06-08 Thread Jiri Benc
Add /sys/class/net/X/* attributes for 802.11 interfaces.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_i.h |3 
 net/d80211/ieee80211_iface.c |1 
 net/d80211/ieee80211_sysfs.c |  299 ++
 3 files changed, 301 insertions(+), 2 deletions(-)

ad13a53621edc97c9bfb41a513a674415186c392
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 9fabf17..7c1b621 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -305,6 +305,8 @@ #define NUM_DEFAULT_KEYS 4
 } u;
 int channel_use;
 int channel_use_raw;
+
+   struct attribute_group *sysfs_group;
 };
 
 #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
@@ -616,5 +618,6 @@ int ieee80211_dev_sysfs_add(struct ieee8
 void ieee80211_dev_sysfs_del(struct ieee80211_local *local);
 int ieee80211_sysfs_init(void);
 void ieee80211_sysfs_deinit(void);
+int ieee80211_sysfs_change_if_type(struct net_device *dev);
 
 #endif /* IEEE80211_I_H */
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 8ab2c07..727b5e3 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -202,6 +202,7 @@ void ieee80211_if_set_type(struct net_de
printk(KERN_WARNING %s: %s: Unknown interface type 0x%x,
   dev-name, __FUNCTION__, type);
}
+   ieee80211_sysfs_change_if_type(dev);
 }
 
 /* Must be called with rtnl lock held. */
diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c
index 07a7036..12d16fd 100644
--- a/net/d80211/ieee80211_sysfs.c
+++ b/net/d80211/ieee80211_sysfs.c
@@ -18,6 +18,7 @@ #include ieee80211_proc.h
 #include rate_control.h
 
 #define to_ieee80211_local(class)  container_of(class, struct 
ieee80211_local, class_dev)
+#define to_net_dev(class)  container_of(class, struct net_device, 
class_dev)
 
 static inline int rtnl_lock_local(struct ieee80211_local *local)
 {
@@ -346,6 +347,238 @@ static struct attribute_group ieee80211_
.attrs = ieee80211_stats_attrs,
 };
 
+/* attributes in /sys/class/net/X/ */
+
+static ssize_t ieee80211_if_show(struct class_device *cd, char *buf,
+   ssize_t (*format)(const struct ieee80211_sub_if_data *,
+ char *))
+{
+   struct net_device *dev = to_net_dev(cd);
+   struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+   ssize_t ret = -EINVAL;
+
+   read_lock(dev_base_lock);
+   if (dev-reg_state == NETREG_REGISTERED) {
+   ret = (*format)(sdata, buf);
+   }
+   read_unlock(dev_base_lock);
+   return ret;
+}
+
+#define IEEE80211_IF_FMT(name, field, format_string)   \
+static ssize_t ieee80211_if_fmt_##name(const struct\
+   ieee80211_sub_if_data *sdata, char *buf)\
+{  \
+   return sprintf(buf, format_string, sdata-field);   \
+}
+#define IEEE80211_IF_FMT_DEC(name, field)  \
+   IEEE80211_IF_FMT(name, field, %d\n)
+#define IEEE80211_IF_FMT_HEX(name, field)  \
+   IEEE80211_IF_FMT(name, field, %#x\n)
+#define IEEE80211_IF_FMT_SIZE(name, field) \
+   IEEE80211_IF_FMT(name, field, %zd\n)
+
+#define IEEE80211_IF_FMT_ATOMIC(name, field)   \
+static ssize_t ieee80211_if_fmt_##name(const struct\
+   ieee80211_sub_if_data *sdata, char *buf)\
+{  \
+   return sprintf(buf, %d\n, atomic_read(sdata-field));\
+}
+
+#define IEEE80211_IF_FMT_MAC(name, field)  \
+static ssize_t ieee80211_if_fmt_##name(const struct\
+   ieee80211_sub_if_data *sdata, char *buf)\
+{  \
+   return sprintf(buf, MACSTR \n, MAC2STR(sdata-field));\
+}
+
+#define __IEEE80211_IF_SHOW(name)  \
+static ssize_t ieee80211_if_show_##name(struct class_device *cd,   \
+   char *buf)  \
+{  \
+   return ieee80211_if_show(cd, buf, ieee80211_if_fmt_##name); \
+}  \
+static CLASS_DEVICE_ATTR(name, S_IRUGO, ieee80211_if_show_##name, NULL);
+
+#define IEEE80211_IF_SHOW(name, field, format) \
+   IEEE80211_IF_FMT_##format(name, field)  \
+   __IEEE80211_IF_SHOW(name)
+
+/* common attributes */
+IEEE80211_IF_SHOW(channel_use, channel_use, DEC);

[PATCH 5/12] d80211: wiphy sysfs attributes

2006-06-08 Thread Jiri Benc
Add /sys/class/ieee80211/phyX/* attributes.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211_proc.c  |4 -
 net/d80211/ieee80211_proc.h  |3 
 net/d80211/ieee80211_sysfs.c |  304 +-
 3 files changed, 302 insertions(+), 9 deletions(-)

b049b3afd8db895dd1f6985c1d1051eb733b887b
diff --git a/net/d80211/ieee80211_proc.c b/net/d80211/ieee80211_proc.c
index 4f3a6b9..581b583 100644
--- a/net/d80211/ieee80211_proc.c
+++ b/net/d80211/ieee80211_proc.c
@@ -442,7 +442,7 @@ #endif /* CONFIG_D80211_DEBUG_COUNTERS *
 }
 
 
-static const char * ieee80211_mode_str_short(int mode)
+const char *ieee80211_mode_str_short(int mode)
 {
switch (mode) {
case MODE_IEEE80211A:
@@ -459,7 +459,7 @@ static const char * ieee80211_mode_str_s
 }
 
 
-static const char * ieee80211_mode_str(int mode)
+const char *ieee80211_mode_str(int mode)
 {
switch (mode) {
case MODE_IEEE80211A:
diff --git a/net/d80211/ieee80211_proc.h b/net/d80211/ieee80211_proc.h
index 8c76560..4519d26 100644
--- a/net/d80211/ieee80211_proc.h
+++ b/net/d80211/ieee80211_proc.h
@@ -42,4 +42,7 @@ static inline void ieee80211_proc_init(v
 static inline void ieee80211_proc_deinit(void) {}
 #endif /* CONFIG_PROC_FS */
 
+const char *ieee80211_mode_str(int mode);
+const char *ieee80211_mode_str_short(int mode);
+
 #endif /* IEEE80211_PROC_H */
diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c
index e799506..07a7036 100644
--- a/net/d80211/ieee80211_sysfs.c
+++ b/net/d80211/ieee80211_sysfs.c
@@ -14,6 +14,8 @@ #include linux/netdevice.h
 #include linux/rtnetlink.h
 #include net/d80211.h
 #include ieee80211_i.h
+#include ieee80211_proc.h
+#include rate_control.h
 
 #define to_ieee80211_local(class)  container_of(class, struct 
ieee80211_local, class_dev)
 
@@ -27,6 +29,8 @@ static inline int rtnl_lock_local(struct
return 0;
 }
 
+/* attributes in /sys/class/ieee80211/phyX/ */
+
 static ssize_t store_add_iface(struct class_device *dev,
   const char *buf, size_t len)
 {
@@ -66,6 +70,284 @@ static ssize_t store_remove_iface(struct
return res  0 ? res : len;
 }
 
+static ssize_t ieee80211_local_show(struct class_device *dev, char *buf,
+   ssize_t (*format)(struct ieee80211_local *, char *))
+{
+   struct ieee80211_local *local = to_ieee80211_local(dev);
+   ssize_t ret = -EINVAL;
+
+   if (local-reg_state == IEEE80211_DEV_REGISTERED)
+   ret = (*format)(local, buf);
+   return ret;
+}
+
+#define IEEE80211_LOCAL_FMT(name, field, format_string)
\
+static ssize_t ieee80211_local_fmt_##name(struct ieee80211_local *local,\
+ char *buf)\
+{  \
+   return sprintf(buf, format_string, local-field);   \
+}
+
+#define __IEEE80211_LOCAL_SHOW(name)   \
+static ssize_t ieee80211_local_show_##name(struct class_device *cd,\
+  char *buf)   \
+{  \
+   return ieee80211_local_show(cd, buf,\
+   ieee80211_local_fmt_##name);\
+}
+
+#define IEEE80211_LOCAL_SHOW(name, field, format)  \
+   IEEE80211_LOCAL_FMT(name, field, format \n)   \
+   __IEEE80211_LOCAL_SHOW(name)
+
+IEEE80211_LOCAL_SHOW(channel, conf.channel, %d);
+IEEE80211_LOCAL_SHOW(frequency, conf.freq, %d);
+IEEE80211_LOCAL_SHOW(radar_detect, conf.radar_detect, %d);
+IEEE80211_LOCAL_SHOW(antenna_sel, conf.antenna_sel, %d);
+IEEE80211_LOCAL_SHOW(calib_int, conf.calib_int, %d);
+IEEE80211_LOCAL_SHOW(bridge_packets, bridge_packets, %d);
+IEEE80211_LOCAL_SHOW(key_tx_rx_threshold, key_tx_rx_threshold, %d);
+IEEE80211_LOCAL_SHOW(rts_threshold, rts_threshold, %d);
+IEEE80211_LOCAL_SHOW(fragmentation_threshold, fragmentation_threshold, %d);
+IEEE80211_LOCAL_SHOW(short_retry_limit, short_retry_limit, %d);
+IEEE80211_LOCAL_SHOW(long_retry_limit, long_retry_limit, %d);
+IEEE80211_LOCAL_SHOW(total_ps_buffered, total_ps_buffered, %d);
+
+static ssize_t ieee80211_local_fmt_mode(struct ieee80211_local *local,
+   char *buf)
+{
+   return sprintf(buf, %s\n, ieee80211_mode_str(local-conf.phymode));
+}
+__IEEE80211_LOCAL_SHOW(mode);
+
+static ssize_t ieee80211_local_fmt_wep_iv(struct ieee80211_local *local,
+ char *buf)
+{
+   return sprintf(buf, %#06x\n, local-wep_iv  0xff);
+}
+__IEEE80211_LOCAL_SHOW(wep_iv);
+
+static ssize_t ieee80211_local_fmt_tx_power_reduction(struct ieee80211_local
+ *local, char *buf)
+{
+   short tx_power_reduction = 

[PATCH 2/12] d80211: better sysfs registration of symlinks to wiphy

2006-06-08 Thread Jiri Benc
Lately, delayed sysfs registration of net_device (in netdev_run_todo) was
removed. This allows us to remove hack that used class interface for sysfs
registration.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c   |   18 +++--
 net/d80211/ieee80211_i.h |2 ++
 net/d80211/ieee80211_iface.c |   15 ++
 net/d80211/ieee80211_sysfs.c |   45 ++
 4 files changed, 39 insertions(+), 41 deletions(-)

beb1533d9181d1c6d195de5743517b3559bfd9f9
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index f549098..9724a49 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4197,9 +4197,21 @@ int ieee80211_register_hw(struct net_dev
 
if (hw-fraglist)
dev-features |= NETIF_F_FRAGLIST;
-   result = register_netdev(dev);
-   if (result  0)
+   rtnl_lock();
+   result = dev_alloc_name(dev, dev-name);
+   if (result  0) {
+   rtnl_unlock();
+   goto fail_dev;
+   }
+   result = register_netdevice(dev);
+   if (result  0) {
+   rtnl_unlock();
goto fail_dev;
+   }
+   result = ieee80211_sysfs_add_netdevice(dev);
+   rtnl_unlock();
+   if (result  0)
+   goto fail_if_sysfs;
 
if (rate_control_initialize(local)  0) {
printk(KERN_DEBUG %s: Failed to initialize rate control 
@@ -4223,6 +4235,8 @@ int ieee80211_register_hw(struct net_dev
return 0;
 
 fail_rate:
+   ieee80211_sysfs_remove_netdevice(dev);
+fail_if_sysfs:
unregister_netdev(dev);
 fail_dev:
sta_info_stop(local);
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 94e151d..19d9d98 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -599,6 +599,8 @@ int ieee80211_if_add_mgmt(struct net_dev
 void ieee80211_if_del_mgmt(struct net_device *dev);
 
 /* ieee80211_sysfs.c */
+int ieee80211_sysfs_add_netdevice(struct net_device *dev);
+void ieee80211_sysfs_remove_netdevice(struct net_device *dev);
 int ieee80211_register_sysfs(struct ieee80211_local *local);
 void ieee80211_unregister_sysfs(struct ieee80211_local *local);
 int ieee80211_sysfs_init(void);
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 6631738..d534fe4 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -76,6 +76,13 @@ int ieee80211_if_add(struct net_device *
ret = register_netdevice(ndev);
if (ret)
goto fail;
+   ret = ieee80211_sysfs_add_netdevice(ndev);
+   if (ret) {
+   /* ndev will be freed by ndev-destructor */
+   unregister_netdevice(ndev);
+   *new_dev = NULL;
+   return ret;
+   }
 
list_add(sdata-list, local-sub_if_list);
ieee80211_proc_init_virtual(ndev);
@@ -123,10 +130,16 @@ int ieee80211_if_add_mgmt(struct net_dev
ret = register_netdevice(ndev);
if (ret)
goto fail;
+   ret = ieee80211_sysfs_add_netdevice(ndev);
+   if (ret)
+   goto fail_sysfs;
if (local-open_count  0)
dev_open(ndev);
local-apdev = ndev;
return 0;
+
+fail_sysfs:
+   unregister_netdevice(ndev);
 fail:
free_netdev(ndev);
return ret;
@@ -139,6 +152,7 @@ void ieee80211_if_del_mgmt(struct net_de
 
ASSERT_RTNL();
apdev = local-apdev;
+   ieee80211_sysfs_remove_netdevice(apdev);
local-apdev = NULL;
unregister_netdevice(apdev);
 }
@@ -293,6 +307,7 @@ void __ieee80211_if_del(struct ieee80211
ieee80211_if_reinit(dev);
list_del(sdata-list);
ieee80211_proc_deinit_virtual(dev);
+   ieee80211_sysfs_remove_netdevice(dev);
unregister_netdevice(dev);
/* Except master interface, the net_device will be freed by
 * net_device-destructor (i. e. ieee80211_if_free). */
diff --git a/net/d80211/ieee80211_sysfs.c b/net/d80211/ieee80211_sysfs.c
index 463f9aa..5c7af9f 100644
--- a/net/d80211/ieee80211_sysfs.c
+++ b/net/d80211/ieee80211_sysfs.c
@@ -98,60 +98,27 @@ void ieee80211_unregister_sysfs(struct i
class_device_del(local-class_dev);
 }
 
-static int ieee80211_add_netdevice(struct class_device *cd,
-  struct class_interface *cintf)
+int ieee80211_sysfs_add_netdevice(struct net_device *dev)
 {
-   struct net_device *dev = container_of(cd, struct net_device, class_dev);
struct ieee80211_local *local = dev-priv;
 
-   if (ieee80211_dev_find_index(local)  0)
-   return 0;
-   return sysfs_create_link(cd-kobj, local-class_dev.kobj, wiphy);
+   return sysfs_create_link(dev-class_dev.kobj, local-class_dev.kobj,
+wiphy);
 }
 
-static void ieee80211_remove_netdevice(struct class_device *cd,
-  struct class_interface 

[PATCH 9/12] d80211: remove useless parameters

2006-06-08 Thread Jiri Benc
There is no necessity for passing ieee80211_local parameter to sta_info_put
and sta_info_free now.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c   |   18 +-
 net/d80211/ieee80211_iface.c |4 ++--
 net/d80211/ieee80211_ioctl.c |   20 ++--
 net/d80211/ieee80211_sta.c   |8 
 net/d80211/rate_control.c|4 ++--
 net/d80211/sta_info.c|   16 
 net/d80211/sta_info.h|5 ++---
 7 files changed, 37 insertions(+), 38 deletions(-)

bc9e55deef4924f5a4ba82487747726413636df6
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 15d43f8..75aaa99 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1153,7 +1153,7 @@ static int ieee80211_tx(struct net_devic
skb = tx.skb; /* handlers are allowed to change skb */
 
if (sta)
-   sta_info_put(local, sta);
+   sta_info_put(sta);
 
if (unlikely(res == TXRX_DROP)) {
I802_DEBUG_INC(local-tx_handlers_drop);
@@ -1373,7 +1373,7 @@ static int ieee80211_subif_start_xmit(st
fc |= WLAN_FC_STYPE_QOS_DATA  4;
hdrlen += 2;
}
-   sta_info_put(local, sta);
+   sta_info_put(sta);
}
 
hdr.frame_control = cpu_to_le16(fc);
@@ -1743,7 +1743,7 @@ ieee80211_get_buffered_bc(struct net_dev
}
 
if (sta)
-   sta_info_put(local, sta);
+   sta_info_put(sta);
 
return skb;
 }
@@ -2330,7 +2330,7 @@ ieee80211_rx_h_data(struct ieee80211_txr
skb = NULL;
}
if (dsta)
-   sta_info_put(local, dsta);
+   sta_info_put(dsta);
}
}
 
@@ -3469,7 +3469,7 @@ void __ieee80211_rx(struct net_device *d
 
   end:
if (sta)
-   sta_info_put(local, sta);
+   sta_info_put(sta);
 }
 
 
@@ -3806,7 +3806,7 @@ void ieee80211_tx_status(struct net_devi
status-excessive_retries = 0;
status-tx_filtered = 1;
}
-   sta_info_put(local, sta);
+   sta_info_put(sta);
}
}
 
@@ -3855,7 +3855,7 @@ void ieee80211_tx_status(struct net_devi
}
dev_kfree_skb(skb);
}
-   sta_info_put(local, sta);
+   sta_info_put(sta);
return;
}
} else {
@@ -3978,8 +3978,8 @@ int ieee80211_if_update_wds(struct net_d
/* Remove STA entry for the old peer */
sta = sta_info_get(local, sdata-u.wds.remote_addr);
if (sta) {
-   sta_info_put(local, sta);
-   sta_info_free(local, sta, 0);
+   sta_info_put(sta);
+   sta_info_free(sta, 0);
} else {
printk(KERN_DEBUG %s: could not find STA entry for WDS link 
   peer  MACSTR \n,
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 467dcba..960a90e 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -261,8 +261,8 @@ #endif
case IEEE80211_IF_TYPE_WDS:
sta = sta_info_get(local, sdata-u.wds.remote_addr);
if (sta) {
-   sta_info_put(local, sta);
-   sta_info_free(local, sta, 0);
+   sta_info_put(sta);
+   sta_info_free(sta, 0);
} else {
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
printk(KERN_DEBUG %s: Someone had deleted my STA 
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index e1bdc03..562b9f3 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -294,7 +294,7 @@ static int ieee80211_ioctl_add_sta(struc
}
}
 
-   sta_info_put(local, sta);
+   sta_info_put(sta);
 
return 0;
 }
@@ -308,8 +308,8 @@ static int ieee80211_ioctl_remove_sta(st
 
sta = sta_info_get(local, param-sta_addr);
if (sta) {
-   sta_info_put(local, sta);
-   sta_info_free(local, sta, 1);
+   sta_info_put(sta);
+   sta_info_free(sta, 1);
}
 
return sta ? 0 : -ENOENT;
@@ -393,7 +393,7 @@ static int ieee80211_ioctl_get_info_sta(
param-u.get_info_sta.last_rssi = sta-last_rssi;
param-u.get_info_sta.last_ack_rssi = sta-last_ack_rssi[2];
 
-   sta_info_put(local, sta);
+   sta_info_put(sta);
 
return 0;
 }
@@ -421,7 +421,7 @@ static int ieee80211_ioctl_set_flags_sta
printk(KERN_DEBUG %s: failed to set low-level driver 
   PAE state 

[PATCH 8/12] d80211: sysfs attributes for associated stations

2006-06-08 Thread Jiri Benc
Add /sys/class/ieee80211/phyX/sta/* attributes.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/Makefile  |1 
 net/d80211/ieee80211.c   |5 +
 net/d80211/ieee80211_i.h |   14 ++
 net/d80211/ieee80211_proc.c  |3 -
 net/d80211/ieee80211_sysfs_sta.c |  228 ++
 net/d80211/sta_info.c|  114 +--
 net/d80211/sta_info.h|   11 +-
 7 files changed, 331 insertions(+), 45 deletions(-)
 create mode 100644 net/d80211/ieee80211_sysfs_sta.c

ed88547db8f143b83cf336c93221400edc2b3d81
diff --git a/net/d80211/Makefile b/net/d80211/Makefile
index 66bfcff..7d1ec29 100644
--- a/net/d80211/Makefile
+++ b/net/d80211/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_D80211) += 80211.o rate_con
ieee80211_dev.o \
ieee80211_iface.o \
ieee80211_sysfs.o \
+   ieee80211_sysfs_sta.o \
michael.o \
tkip.o \
aes_ccm.o \
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 0c23607..15d43f8 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4188,7 +4188,9 @@ int ieee80211_register_hw(struct net_dev
 
ieee80211_update_hw(dev, hw);   /* Don't care about the result. */
 
-   sta_info_start(local);
+   result = sta_info_start(local);
+   if (result  0)
+   goto fail_sta_info;
 
if (hw-fraglist)
dev-features |= NETIF_F_FRAGLIST;
@@ -4237,6 +4239,7 @@ fail_if_sysfs:
unregister_netdev(dev);
 fail_dev:
sta_info_stop(local);
+fail_sta_info:
ieee80211_dev_sysfs_del(local);
 fail_sysfs:
ieee80211_dev_free_index(local);
diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index 7c1b621..212d12f 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -344,9 +344,11 @@ #define IEEE80211_IRQSAFE_QUEUE_LIMIT 12
 
 spinlock_t generic_lock;
/* Station data structures */
+   struct kset sta_kset;
spinlock_t sta_lock; /* mutex for STA data structures */
int num_sta; /* number of stations in sta_list */
struct list_head sta_list;
+   struct list_head deleted_sta_list;
struct sta_info *sta_hash[STA_HASH_SIZE];
struct timer_list sta_cleanup;
 
@@ -511,6 +513,12 @@ #endif /* CONFIG_D80211_DEBUG_COUNTERS *
int user_space_mlme;
 };
 
+struct sta_attribute {
+   struct attribute attr;
+   ssize_t (*show)(const struct sta_info *, char *buf);
+   ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
+};
+
 
 /* ieee80211.c */
 void ieee80211_release_hw(struct ieee80211_local *local);
@@ -620,4 +628,10 @@ int ieee80211_sysfs_init(void);
 void ieee80211_sysfs_deinit(void);
 int ieee80211_sysfs_change_if_type(struct net_device *dev);
 
+/* ieee80211_sysfs_sta.c */
+int ieee80211_sta_kset_sysfs_register(struct ieee80211_local *local);
+void ieee80211_sta_kset_sysfs_unregister(struct ieee80211_local *local);
+int ieee80211_sta_sysfs_add(struct sta_info *sta);
+void ieee80211_sta_sysfs_remove(struct sta_info *sta);
+
 #endif /* IEEE80211_I_H */
diff --git a/net/d80211/ieee80211_proc.c b/net/d80211/ieee80211_proc.c
index 581b583..4bb3179 100644
--- a/net/d80211/ieee80211_proc.c
+++ b/net/d80211/ieee80211_proc.c
@@ -241,7 +241,6 @@ static int ieee80211_proc_sta_read(char 
if (!sta || !sta-dev)
return -1;
 
-   p += sprintf(p, users=%d\n, atomic_read(sta-users));
p += sprintf(p, aid=%d\n, sta-aid);
p += sprintf(p, flags=0x%x %s%s%s%s%s%s%s%s%s%s\n, sta-flags,
 sta-flags  WLAN_STA_AUTH ? [AUTH] : ,
@@ -656,7 +655,6 @@ void ieee80211_proc_init_sta(struct ieee
   ieee80211_proc_sta_read, sta);
if (entry) {
entry-mode = ~(S_IRWXG | S_IRWXO);
-   sta-proc_entry_added = 1;
}
 }
 
@@ -668,7 +666,6 @@ void ieee80211_proc_deinit_sta(struct ie
sprintf(buf, MACSTR, MAC2STR(sta-addr));
if (local-proc_sta) {
remove_proc_entry(buf, local-proc_sta);
-   sta-proc_entry_added = 0;
}
 }
 
diff --git a/net/d80211/ieee80211_sysfs_sta.c b/net/d80211/ieee80211_sysfs_sta.c
new file mode 100644
index 000..07de564
--- /dev/null
+++ b/net/d80211/ieee80211_sysfs_sta.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2003-2005, Devicescape Software, Inc.
+ * Copyright (c) 2006 Jiri Benc [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kobject.h
+#include linux/sysfs.h
+#include ieee80211_i.h
+#include sta_info.h
+
+static ssize_t sta_sysfs_show(struct kobject *, struct attribute *, char *);
+
+static struct sysfs_ops sta_ktype_ops = {
+   .show = sta_sysfs_show,
+};
+
+#define STA_SHOW(name, field, format_string)  

[PATCH 12/12] d80211: remove procfs files

2006-06-08 Thread Jiri Benc
Remove procfs support.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/Makefile  |1 
 net/d80211/ieee80211.c   |7 
 net/d80211/ieee80211_iface.c |3 
 net/d80211/ieee80211_proc.c  |  768 --
 net/d80211/ieee80211_proc.h  |   48 ---
 net/d80211/ieee80211_sysfs.c |   33 ++
 net/d80211/rate_control.c|   25 -
 net/d80211/rate_control.h|   17 -
 net/d80211/sta_info.c|4 
 9 files changed, 32 insertions(+), 874 deletions(-)
 delete mode 100644 net/d80211/ieee80211_proc.c
 delete mode 100644 net/d80211/ieee80211_proc.h

89c13fc02b12796d1f57c33c7fae1bcf875d846b
diff --git a/net/d80211/Makefile b/net/d80211/Makefile
index 7d1ec29..c21e882 100644
--- a/net/d80211/Makefile
+++ b/net/d80211/Makefile
@@ -6,7 +6,6 @@ obj-$(CONFIG_D80211) += 80211.o rate_con
sta_info.o \
wep.o \
wpa.o \
-   ieee80211_proc.o \
ieee80211_scan.o \
ieee80211_sta.o \
ieee80211_dev.o \
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 1a03f07..a8ca8d1 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -25,7 +25,6 @@ #include net/d80211.h
 #include net/d80211_common.h
 #include net/d80211_mgmt.h
 #include ieee80211_i.h
-#include ieee80211_proc.h
 #include rate_control.h
 #include wep.h
 #include wpa.h
@@ -4256,7 +4255,6 @@ int ieee80211_register_hw(struct net_dev
ieee80211_install_qdisc(dev);
 
 ieee80211_wep_init(local);
-   ieee80211_proc_init_interface(local);
 
/* add one default STA interface */
rtnl_lock();
@@ -4359,8 +4357,6 @@ void ieee80211_unregister_hw(struct net_
kfree(local-basic_rates[i]);
 }
 
-   ieee80211_proc_deinit_interface(local);
-
if (skb_queue_len(local-skb_queue)
|| skb_queue_len(local-skb_queue_unreliable))
printk(KERN_WARNING %s: skb_queue not empty, dev-name);
@@ -4520,14 +4516,12 @@ static int __init ieee80211_init(void)
return ret;
}
 
-   ieee80211_proc_init();
{
ret = ieee80211_wme_register();
if (ret) {
printk(KERN_DEBUG ieee80211_init: failed to 
   initialize WME (err=%d)\n, ret);
ieee80211_sysfs_deinit();
-   ieee80211_proc_deinit();
return ret;
}
}
@@ -4539,7 +4533,6 @@ static int __init ieee80211_init(void)
 static void __exit ieee80211_exit(void)
 {
ieee80211_wme_unregister();
-   ieee80211_proc_deinit();
ieee80211_sysfs_deinit();
 }
 
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 960a90e..5abd713 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -14,7 +14,6 @@ #include linux/rtnetlink.h
 #include net/d80211.h
 #include net/d80211_mgmt.h
 #include ieee80211_i.h
-#include ieee80211_proc.h
 #include sta_info.h
 
 void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata)
@@ -85,7 +84,6 @@ int ieee80211_if_add(struct net_device *
}
 
list_add(sdata-list, local-sub_if_list);
-   ieee80211_proc_init_virtual(ndev);
 
return 0;
 
@@ -307,7 +305,6 @@ void __ieee80211_if_del(struct ieee80211
 
ieee80211_if_reinit(dev);
list_del(sdata-list);
-   ieee80211_proc_deinit_virtual(dev);
ieee80211_sysfs_remove_netdevice(dev);
unregister_netdevice(dev);
/* Except master interface, the net_device will be freed by
diff --git a/net/d80211/ieee80211_proc.c b/net/d80211/ieee80211_proc.c
deleted file mode 100644
index 4bb3179..000
--- a/net/d80211/ieee80211_proc.c
+++ /dev/null
@@ -1,768 +0,0 @@
-/*
- * Copyright 2003-2005, Devicescape Software, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include linux/config.h
-#include linux/version.h
-#include linux/module.h
-#include linux/netdevice.h
-#include linux/proc_fs.h
-#include linux/delay.h
-
-#ifdef CONFIG_PROC_FS
-
-#include net/d80211.h
-#include net/d80211_common.h
-#include net/d80211_mgmt.h
-#include ieee80211_i.h
-#include sta_info.h
-#include ieee80211_proc.h
-#include rate_control.h
-
-
-static struct proc_dir_entry *ieee80211_proc;
-
-#define PROC_LIMIT (PAGE_SIZE - 80)
-
-
-static char * ieee80211_proc_key(char *p, struct ieee80211_key *key,
-int idx, int def_key)
-{
-   int i;
-   u8 *tpn, *rpn;
-
-   if (!key)
-   return p;
-
-   p += sprintf(p, key[%d]%s len=%d sw_encrypt=%d idx=%d hwidx=%d 
-tx_rx_count=%d,
-idx, def_key ? * : , key-keylen,
-key-force_sw_encrypt, key-keyidx, key-hw_key_idx,
-key-tx_rx_count);
- 

[PATCH 7/12] d80211: rename sta_info_relase to sta_info_put

2006-06-08 Thread Jiri Benc
sta_info structure has reference counting (will be converted to kobject in
next patch). Therefore, sta_info_release should be divided into two
functions - one for decrementing reference count and one for freeing the
structure when the count drops to zero. sta_info_release is the name
suitable for the second function.

This patch renames sta_info_release to sta_info_put to let next patch
introduce a new sta_info_release function.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c   |   18 +-
 net/d80211/ieee80211_iface.c |2 +-
 net/d80211/ieee80211_ioctl.c |   18 +-
 net/d80211/ieee80211_sta.c   |8 
 net/d80211/rate_control.c|4 ++--
 net/d80211/sta_info.c|   10 +-
 net/d80211/sta_info.h|2 +-
 7 files changed, 31 insertions(+), 31 deletions(-)

4ddde98ebbdede0d0b16a85156e1b9c192c0e764
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index c983d70..0c23607 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1153,7 +1153,7 @@ static int ieee80211_tx(struct net_devic
skb = tx.skb; /* handlers are allowed to change skb */
 
if (sta)
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
 
if (unlikely(res == TXRX_DROP)) {
I802_DEBUG_INC(local-tx_handlers_drop);
@@ -1373,7 +1373,7 @@ static int ieee80211_subif_start_xmit(st
fc |= WLAN_FC_STYPE_QOS_DATA  4;
hdrlen += 2;
}
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
}
 
hdr.frame_control = cpu_to_le16(fc);
@@ -1743,7 +1743,7 @@ ieee80211_get_buffered_bc(struct net_dev
}
 
if (sta)
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
 
return skb;
 }
@@ -2330,7 +2330,7 @@ ieee80211_rx_h_data(struct ieee80211_txr
skb = NULL;
}
if (dsta)
-   sta_info_release(local, dsta);
+   sta_info_put(local, dsta);
}
}
 
@@ -3469,7 +3469,7 @@ void __ieee80211_rx(struct net_device *d
 
   end:
if (sta)
-sta_info_release(local, sta);
+   sta_info_put(local, sta);
 }
 
 
@@ -3806,7 +3806,7 @@ void ieee80211_tx_status(struct net_devi
status-excessive_retries = 0;
status-tx_filtered = 1;
}
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
}
}
 
@@ -3855,7 +3855,7 @@ void ieee80211_tx_status(struct net_devi
}
dev_kfree_skb(skb);
}
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
return;
}
} else {
@@ -3978,7 +3978,7 @@ int ieee80211_if_update_wds(struct net_d
/* Remove STA entry for the old peer */
sta = sta_info_get(local, sdata-u.wds.remote_addr);
if (sta) {
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
sta_info_free(local, sta, 0);
} else {
printk(KERN_DEBUG %s: could not find STA entry for WDS link 
@@ -4522,7 +4522,7 @@ EXPORT_SYMBOL(ieee80211_get_hdrlen_from_
 EXPORT_SYMBOL(ieee80211_rate_control_register);
 EXPORT_SYMBOL(ieee80211_rate_control_unregister);
 EXPORT_SYMBOL(sta_info_get);
-EXPORT_SYMBOL(sta_info_release);
+EXPORT_SYMBOL(sta_info_put);
 EXPORT_SYMBOL(ieee80211_radar_status);
 EXPORT_SYMBOL(ieee80211_get_mc_list_item);
 
diff --git a/net/d80211/ieee80211_iface.c b/net/d80211/ieee80211_iface.c
index 727b5e3..467dcba 100644
--- a/net/d80211/ieee80211_iface.c
+++ b/net/d80211/ieee80211_iface.c
@@ -261,7 +261,7 @@ #endif
case IEEE80211_IF_TYPE_WDS:
sta = sta_info_get(local, sdata-u.wds.remote_addr);
if (sta) {
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
sta_info_free(local, sta, 0);
} else {
 #ifdef CONFIG_D80211_VERBOSE_DEBUG
diff --git a/net/d80211/ieee80211_ioctl.c b/net/d80211/ieee80211_ioctl.c
index 8d593e8..e1bdc03 100644
--- a/net/d80211/ieee80211_ioctl.c
+++ b/net/d80211/ieee80211_ioctl.c
@@ -294,7 +294,7 @@ static int ieee80211_ioctl_add_sta(struc
}
}
 
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);
 
return 0;
 }
@@ -308,7 +308,7 @@ static int ieee80211_ioctl_remove_sta(st
 
sta = sta_info_get(local, param-sta_addr);
if (sta) {
-   sta_info_release(local, sta);
+   sta_info_put(local, sta);

[PATCH 1/12] d80211: deinit sysfs in case of an error

2006-06-08 Thread Jiri Benc
When ieee80211_wme_register fails in ieee80211_init, ieee80211 class was not
unregistered.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

3aed246a5117bd4d1a4f2d5f5074c583d9b4941e
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index b850fb7..f549098 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4462,6 +4462,7 @@ static int __init ieee80211_init(void)
if (ret) {
printk(KERN_DEBUG ieee80211_init: failed to 
   initialize WME (err=%d)\n, ret);
+   ieee80211_sysfs_deinit();
ieee80211_proc_deinit();
return ret;
}
-- 
1.3.0

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] iWARP Connection Manager.

2006-06-08 Thread Andrew Morton
On Wed, 07 Jun 2006 15:06:05 -0500
Steve Wise [EMAIL PROTECTED] wrote:

 
 This patch provides the new files implementing the iWARP Connection
 Manager.
 
 Review Changes:
 
 - sizeof - sizeof()
 
 - removed printks
 
 - removed TT debug code
 
 - cleaned up lock/unlock around switch statements.
 
 - waitqueue - completion for destroy path.

 ...

 +/* 
 + * This function is called on interrupt context. Schedule events on
 + * the iwcm_wq thread to allow callback functions to downcall into
 + * the CM and/or block.  Events are queued to a per-CM_ID
 + * work_list. If this is the first event on the work_list, the work
 + * element is also queued on the iwcm_wq thread.
 + *
 + * Each event holds a reference on the cm_id. Until the last posted
 + * event has been delivered and processed, the cm_id cannot be
 + * deleted. 
 + */
 +static void cm_event_handler(struct iw_cm_id *cm_id,
 +  struct iw_cm_event *iw_event) 
 +{
 + struct iwcm_work *work;
 + struct iwcm_id_private *cm_id_priv;
 + unsigned long flags;
 +
 + work = kmalloc(sizeof(*work), GFP_ATOMIC);
 + if (!work)
 + return;

This allocation _will_ fail sometimes.  The driver must recover from it. 
Will it do so?

 +EXPORT_SYMBOL(iw_cm_init_qp_attr);

This file exports a ton of symbols.  It's usual to provide some justifying
commentary in the changelog when this happens.

 +/*
 + * Copyright (c) 2005 Network Appliance, Inc. All rights reserved.
 + * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
 + *
 + * This software is available to you under a choice of one of two
 + * licenses.  You may choose to be licensed under the terms of the GNU
 + * General Public License (GPL) Version 2, available from the file
 + * COPYING in the main directory of this source tree, or the
 + * OpenIB.org BSD license below:
 + *
 + * Redistribution and use in source and binary forms, with or
 + * without modification, are permitted provided that the following
 + * conditions are met:
 + *
 + *  - Redistributions of source code must retain the above
 + *copyright notice, this list of conditions and the following
 + *disclaimer.
 + *
 + *  - Redistributions in binary form must reproduce the above
 + *copyright notice, this list of conditions and the following
 + *disclaimer in the documentation and/or other materials
 + *provided with the distribution.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 + * SOFTWARE.
 + */
 +#if !defined(IW_CM_PRIVATE_H)
 +#define IW_CM_PRIVATE_H

We normally use #ifndef here.


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 4/7] AMSO1100 Memory Management.

2006-06-08 Thread Andrew Morton
On Wed, 07 Jun 2006 15:06:55 -0500
Steve Wise [EMAIL PROTECTED] wrote:

 
 +void c2_free(struct c2_alloc *alloc, u32 obj)
 +{
 + spin_lock(alloc-lock);
 + clear_bit(obj, alloc-table);
 + spin_unlock(alloc-lock);
 +}

The spinlock is unneeded here.


What does all the code in this file do, anyway?  It looks totally generic
(and hence inappropriate for drivers/infiniband/hw/amso1100/) and somewhat
similar to idr trees, perhaps.

 +int c2_array_set(struct c2_array *array, int index, void *value)
 +{
 + int p = (index * sizeof(void *))  PAGE_SHIFT;
 +
 + /* Allocate with GFP_ATOMIC because we'll be called with locks held. */
 + if (!array-page_list[p].page)
 + array-page_list[p].page =
 + (void **) get_zeroed_page(GFP_ATOMIC);
 +
 + if (!array-page_list[p].page)
 + return -ENOMEM;

This _will_ happen under load.  What will the result of that be, in the
context of thise driver?

This function is incorrectly designed - it should receive a gfp_t argument.
Because you don't *know* that the caller will always hold a spinlock.  And
GFP_KERNEL is far, far stronger than GFP_ATOMIC.

 +static int c2_alloc_mqsp_chunk(gfp_t gfp_mask, struct sp_chunk **head)
 +{
 + int i;
 + struct sp_chunk *new_head;
 +
 + new_head = (struct sp_chunk *) __get_free_page(gfp_mask | GFP_DMA);

Why is __GFP_DMA in there?  Unless you've cornered the ISA bus infiniband
market, it's likely to be wrong.


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] ehea: IBM eHEA Ethernet Device Driver

2006-06-08 Thread Jan-Bernd Themann

Hello,

thanks for your comments. It seems that yesterday's patch 1/4 has not been
delivered. We changed some things according to your comments.

Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED]
Changelog-by:  Jan-Bernd Themann [EMAIL PROTECTED]

Differences to patch set http://www.spinics.net/lists/netdev/msg05813.html

Changelog:

- reduce number of parameters for debug macro calls
- ehea prefix added to some non static functions
- Makefile and Kconfig improved

 drivers/net/ehea/Kconfig |6
 drivers/net/ehea/Makefile|7
 drivers/net/ehea/ehea.h  |  434 +++
 drivers/net/ehea/ehea_hw.h   |  319 +
 drivers/net/ehea/ehea_main.c | 2562 +++
 drivers/net/ehea/ehea_phyp.c | 1023 +
 drivers/net/ehea/ehea_phyp.h |  625 ++
 drivers/net/ehea/ehea_qmr.c  |  719 
 drivers/net/ehea/ehea_qmr.h  |  390 ++
 9 files changed, 6085 insertions(+)


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] ehea: pHYP interface

2006-06-08 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED]


 drivers/net/ehea/ehea_phyp.c | 1023 +++
 drivers/net/ehea/ehea_phyp.h |  625 ++
 2 files changed, 1648 insertions(+)



--- linux-2.6.16-rc5-orig/drivers/net/ehea/ehea_phyp.c  1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea_phyp.c 2006-06-08 01:58:28.856209904 -0700
@@ -0,0 +1,1023 @@
+/*
+ *  linux/drivers/net/ehea/ehea_phyp.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch [EMAIL PROTECTED]
+ *   Jan-Bernd Themann [EMAIL PROTECTED]
+ *   Heiko-Joerg Schick [EMAIL PROTECTED]
+ *   Thomas Klein [EMAIL PROTECTED]
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include ehea_phyp.h
+
+
+static inline u16 get_order_of_qentries(u16 queue_entries)
+{
+   u8 ld = 1;  /*  logarithmus dualis */
+   EDEB_EN(7, queue_entries=0x%X, queue_entries);
+   while (((1U  ld) - 1)  queue_entries) {
+   ld++;
+   };
+   EDEB_EX(7, mapped queue_entries=%d, ld - 1);
+   return ld - 1;
+}
+
+
+/* Defines for H_CALL H_ALLOC_RESOURCE */
+#define H_ALL_RES_TYPE_QP1
+#define H_ALL_RES_TYPE_CQ2
+#define H_ALL_RES_TYPE_EQ3
+#define H_ALL_RES_TYPE_MR5
+#define H_ALL_RES_TYPE_MW6
+
+u64 ehea_h_query_ehea_qp(const u64 hcp_adapter_handle,
+const u8 qp_category,
+const u64 qp_handle, const u64 sel_mask, void *cb_addr)
+{
+   u64 hret = H_ADAPTER_PARM;
+   u64 dummy = 0;
+
+   EDEB_EN(7, hcp_adapter_handle=%lX cat=%X qp_handle=%lX sel_mask=%lX 
+   cb_addr=%p\n,
+   hcp_adapter_handle,
+   (u16) qp_category, qp_handle, sel_mask, cb_addr);
+   EDEB_DMP(7, (u8 *) cb_addr, sizeof(struct hcp_modify_qp_cb_0),
+Before HCALL);
+
+   if u64)cb_addr)  (PAGE_SIZE - 1)) != 0)
+   panic(query_ehea_qp: cb_addr not on page boundary!!!);
+
+   hret = ehea_hcall_7arg_7ret(H_QUERY_EHEA_QP,
+   hcp_adapter_handle, /* R4 */
+   qp_category,/* R5 */
+   qp_handle,  /* R6 */
+   sel_mask,   /* R7 */
+   virt_to_abs(cb_addr),   /* R8 */
+   0, 0,   /* R9-R10 */
+   dummy, /* R4 */
+   dummy, /* R5 */
+   dummy, /* R6 */
+   dummy, /* R7 */
+   dummy, /* R8 */
+   dummy, /* R9 */
+   dummy);/* R10 */
+
+   EDEB_DMP(7, (u8 *) cb_addr, sizeof(struct hcp_modify_qp_cb_0),
+After HCALL);
+   EDEB_EX(7, );
+   return hret;
+}
+
+/* input param R5 */
+#define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11)
+#define H_ALL_RES_QP_QPP  EHEA_BMASK_IBM(12, 12)
+#define H_ALL_RES_QP_RQR  EHEA_BMASK_IBM(13, 15)
+#define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16)
+#define H_ALL_RES_QP_LL_QPEHEA_BMASK_IBM(17, 17)
+#define H_ALL_RES_QP_DMA128   EHEA_BMASK_IBM(19, 19)
+#define H_ALL_RES_QP_HSM  EHEA_BMASK_IBM(20, 21)
+#define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23)
+#define H_ALL_RES_QP_TENURE   EHEA_BMASK_IBM(48, 55)
+#define H_ALL_RES_QP_RES_TYP  EHEA_BMASK_IBM(56, 63)
+
+/* input param R9  */
+#define H_ALL_RES_QP_TOKENEHEA_BMASK_IBM(0, 31)
+#define H_ALL_RES_QP_PD   EHEA_BMASK_IBM(32,63)
+
+/* input param R10 */
+#define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7)
+#define H_ALL_RES_QP_MAX_R1WQEEHEA_BMASK_IBM(12, 15)
+#define H_ALL_RES_QP_MAX_R2WQEEHEA_BMASK_IBM(20, 23)
+#define H_ALL_RES_QP_MAX_R3WQEEHEA_BMASK_IBM(28, 31)
+/* Max Send Scatter Gather Elements */
+#define H_ALL_RES_QP_MAX_SSGE EHEA_BMASK_IBM(37, 39)

[PATCH 3/5] ehea: queue management

2006-06-08 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED]


 drivers/net/ehea/ehea_qmr.c |  719 
 drivers/net/ehea/ehea_qmr.h |  390 +++
 2 files changed, 1109 insertions(+)



--- linux-2.6.16-rc5-orig/drivers/net/ehea/ehea_qmr.c   1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea_qmr.c  2006-06-08 01:58:28.862208992 -0700
@@ -0,0 +1,719 @@
+/*
+ *  linux/drivers/net/ehea/ehea_qmr.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch [EMAIL PROTECTED]
+ *   Jan-Bernd Themann [EMAIL PROTECTED]
+ *   Heiko-Joerg Schick [EMAIL PROTECTED]
+ *   Thomas Klein [EMAIL PROTECTED]
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include ehea.h
+#include ehea_phyp.h
+#include ehea_qmr.h
+
+static void *ipz_qpageit_get_inc(struct ipz_queue *queue)
+{
+   void *retvalue = ipz_qeit_get(queue);
+   queue-current_q_offset += queue-pagesize;
+   if (queue-current_q_offset  queue-queue_length) {
+   queue-current_q_offset -= queue-pagesize;
+   retvalue = NULL;
+   }
+   else if u64) retvalue)  (EHEA_PAGESIZE-1)) != 0) {
+   EDEB(4, ERROR!! not at PAGE-Boundary);
+   return NULL;
+   }
+   EDEB(7, queue=%p retvalue=%p, queue, retvalue);
+   return retvalue;
+}
+
+static int ipz_queue_ctor(struct ipz_queue *queue,
+ const u32 nr_of_pages,
+ const u32 pagesize, const u32 qe_size,
+ const u32 nr_of_sg)
+{
+   int f;
+   EDEB_EN(7, nr_of_pages=%x pagesize=%x qe_size=%x,
+   nr_of_pages, pagesize, qe_size);
+   queue-queue_length = nr_of_pages * pagesize;
+   queue-queue_pages = vmalloc(nr_of_pages * sizeof(void *));
+   if (!queue-queue_pages) {
+   EDEB(4, ERROR!! didn't get the memory);
+   return 0;
+   }
+   memset(queue-queue_pages, 0, nr_of_pages * sizeof(void *));
+
+   for (f = 0; f  nr_of_pages; f++) {
+   (queue-queue_pages)[f] =
+   (struct ipz_page *)get_zeroed_page(GFP_KERNEL);
+   if (!(queue-queue_pages)[f]) {
+   break;
+   }
+   }
+   if (f  nr_of_pages) {
+   int g;
+   EDEB_ERR(4, couldn't get 0ed pages queue=%p f=%x 
+nr_of_pages=%x, queue, f, nr_of_pages);
+   for (g = 0; g  f; g++) {
+   free_page((unsigned long)(queue-queue_pages)[g]);
+   }
+   return 0;
+   }
+   queue-current_q_offset = 0;
+   queue-qe_size = qe_size;
+   queue-act_nr_of_sg = nr_of_sg;
+   queue-pagesize = pagesize;
+   queue-toggle_state = 1;
+   EDEB_EX(7, queue_length=%x queue_pages=%p qe_size=%x
+act_nr_of_sg=%x, queue-queue_length, queue-queue_pages,
+   queue-qe_size, queue-act_nr_of_sg);
+   return 1;
+}
+
+static int ipz_queue_dtor(struct ipz_queue *queue)
+{
+   int g;
+   EDEB_EN(7, ipz_queue pointer=%p, queue);
+   if (!queue) {
+   return 0;
+   }
+   if (!queue-queue_pages) {
+   return 0;
+   }
+   EDEB(7, destructing a queue with the following properties:\n
+queue_length=%x act_nr_of_sg=%x pagesize=%x qe_size=%x,
+queue-queue_length, queue-act_nr_of_sg, queue-pagesize,
+queue-qe_size);
+   for (g = 0; g  (queue-queue_length / queue-pagesize); g++) {
+   free_page((unsigned long)(queue-queue_pages)[g]);
+   }
+   vfree(queue-queue_pages);
+
+   EDEB_EX(7, queue freed!);
+   return 1;
+}
+
+struct ehea_cq *ehea_cq_new(void)
+{
+   struct ehea_cq *cq = vmalloc(sizeof(*cq));
+   if (cq)
+   memset(cq, 0, sizeof(*cq));
+   return cq;
+}
+
+void ehea_cq_delete(struct ehea_cq *cq)
+{
+   vfree(cq);
+}
+
+struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
+  int nr_of_cqe, u64 eq_handle, u32 cq_token)
+{
+   struct ehea_cq *cq = NULL;
+   struct h_galpa gal;
+
+   u64 *cq_handle_ref;
+   u32 act_nr_of_entries;
+   u32 act_pages;

[PATCH 5/5] ehea: makefile and Kconfig

2006-06-08 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED]


 drivers/net/ehea/Kconfig  |6 ++
 drivers/net/ehea/Makefile |7 +++
 2 files changed, 13 insertions(+)



--- linux-2.6.16-rc5-orig/drivers/net/ehea/Makefile 1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/Makefile2006-06-08 01:58:28.839212488 -0700
@@ -0,0 +1,7 @@
+#
+# Makefile for the eHEA ethernet device driver for IBM eServer System p
+#
+
+ehea_mod-objs = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o ehea_phyp.o
+obj-$(CONFIG_EHEA) += ehea_mod.o
+
--- linux-2.6.16-rc5-orig/drivers/net/ehea/Kconfig  1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/Kconfig 2006-06-08 01:58:28.842212032 -0700
@@ -0,0 +1,6 @@
+config EHEA
+   tristate eHEA Ethernet support
+   depends on IBMEBUS
+   ---help---
+   This driver supports the IBM pSeries ethernet adapter
+


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] ehea: main header files

2006-06-08 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED]


 drivers/net/ehea/ehea.h|  434 +
 drivers/net/ehea/ehea_hw.h |  319 +
 2 files changed, 753 insertions(+)



--- linux-2.6.16-rc5-orig/drivers/net/ehea/ehea.h   1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea.h  2006-06-08 01:58:29.611229144 -0700
@@ -0,0 +1,434 @@
+/*
+ *  linux/drivers/net/ehea/ehea.h
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch [EMAIL PROTECTED]
+ *   Jan-Bernd Themann [EMAIL PROTECTED]
+ *   Heiko-Joerg Schick [EMAIL PROTECTED]
+ *   Thomas Klein [EMAIL PROTECTED]
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __EHEA_H__
+#define __EHEA_H__
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include linux/kernel.h
+#include linux/vmalloc.h
+#include linux/mm.h
+#include linux/slab.h
+#include linux/sched.h
+#include linux/err.h
+#include linux/list.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/kthread.h
+#include linux/ethtool.h
+#include linux/if_vlan.h
+#include asm/ibmebus.h
+#include asm/of_device.h
+#include asm/abs_addr.h
+#include asm/semaphore.h
+#include asm/current.h
+#include asm/io.h
+
+
+#define EHEA_DRIVER_NAME   IBM eHEA
+#define EHEA_DRIVER_VERSIONEHEA_0002
+
+/* #define EHEA_CQE_TIMER */
+ #define EHEA_ADDITIONAL_STATISTICS
+
+#ifdef EHEA_SMALL_QUEUES
+#define EHEA_MAX_CQE_COUNT 1020
+#define EHEA_MAX_ENTRIES_SQ1020
+#define EHEA_MAX_ENTRIES_RQ1   4080
+#define EHEA_MAX_ENTRIES_RQ2   1020
+#define EHEA_MAX_ENTRIES_RQ3   1020
+#define EHEA_SWQE_REFILL_TH 100
+#else
+#define EHEA_MAX_CQE_COUNT32000
+#define EHEA_MAX_ENTRIES_SQ   16000
+#define EHEA_MAX_ENTRIES_RQ1  32080
+#define EHEA_MAX_ENTRIES_RQ2   4020
+#define EHEA_MAX_ENTRIES_RQ3   4020
+#define EHEA_SWQE_REFILL_TH1000
+#endif
+
+#define EHEA_MAX_ENTRIES_EQ   20
+
+#define EHEA_SG_SQ  2
+#define EHEA_SG_RQ1 1
+#define EHEA_SG_RQ2 0
+#define EHEA_SG_RQ3 0
+
+#define EHEA_MAX_PACKET_SIZE9022   /* for jumbo frame */
+#define EHEA_LL_PKT_SIZE 256
+
+/* Send completion signaling */
+#define EHEA_SIG_IV 1000
+#define EHEA_SIG_IV_LONG 4
+#define EHEA_SQ_HL_TRIGGER 5000
+
+/* Protection Domain Identifier */
+#define EHEA_PD_ID0xaabcdeff
+
+#define EHEA_RQ2_THRESHOLD 1
+#define EHEA_RQ3_THRESHOLD 5
+
+#define EHEA_SPEED_10G 1
+#define EHEA_SPEED_1G   1000
+#define EHEA_SPEED_100M  100
+#define EHEA_SPEED_10M10
+
+/* Broadcast/Multicast registration types */
+#define EHEA_BCMC_SCOPE_ALL0x08
+#define EHEA_BCMC_SCOPE_SINGLE 0x00
+#define EHEA_BCMC_MULTICAST0x04
+#define EHEA_BCMC_BROADCAST0x00
+#define EHEA_BCMC_UNTAGGED 0x02
+#define EHEA_BCMC_TAGGED   0x00
+#define EHEA_BCMC_VLANID_ALL   0x01
+#define EHEA_BCMC_VLANID_SINGLE0x00
+
+/* Use this define to kmallocate PHYP control blocks */
+#define H_CB_ALIGNMENT 4096
+
+#define EHEA_PAGESHIFT  12
+#define EHEA_PAGESIZE   4096UL
+#define EHEA_PT_ENTRIES 512UL
+#define EHEA_CACHE_LINE 128
+
+#define EHEA_ENABLE1
+#define EHEA_DISABLE   0
+
+void ehea_set_ethtool_ops(struct net_device *netdev);
+
+#ifndef KEEP_EDEBS_BELOW
+#define KEEP_EDEBS_BELOW 8
+#endif
+
+extern int ehea_trace_level;
+extern struct ehea_adapter *adapter_global;
+
+#ifdef EHEA_NO_EDEB
+#define EDEB_P_GENERIC(level, idstring, format, args...) \
+   while (0 == 1) { \
+   if(unlikely (level = ehea_trace_level)) { \
+   printk(%s  idstring  format \n, \
+   __func__, ##args); \
+ } \
+   } \
+
+#else
+
+#define EDEB_P_GENERIC(level,idstring,format,args...) \
+if (level  KEEP_EDEBS_BELOW) { \
+   do { \
+   if(unlikely (level = ehea_trace_level)) { \
+   printk(%s  idstring  format \n, \
+   __func__, ##args); \
+ } \
+   } while (1 == 0); \
+}
+#endif
+
+#define EDEB(level, format, args...) \
+EDEB_P_GENERIC(level, , format, ##args)
+
+#define EDEB_ERR(level, format, args...) \
+EDEB_P_GENERIC(level, 

EHEA: Is there a size limit below 80K for patches?

2006-06-08 Thread Jan-Bernd Themann

Hello,

we tried two times to send a patch set. In both cases the second (largest) patch
got lost. The first one was a bit above 100k, the second one we tried was like 
75K.

Any idea what might be the problem?

Thanks,
Jan-Bernd Themann
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Thu, 8 Jun 2006 11:50:33 +0100), Gerrit 
Renker [EMAIL PROTECTED] says:

 +  UDP-Lite introduces a new socket type, the SOCK_LDGRAM (note the L) for
 +  lightweight, connection-less services. These are the socket options:

I disagree.  It should be SOCK_DGRAM.

-- 
YOSHIFUJI Hideaki @ USAGI Project  [EMAIL PROTECTED]
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: EHEA: Is there a size limit below 80K for patches?

2006-06-08 Thread Christoph Raisch
well, now I'm confused...
2 People, two opinions


Here's a URL for a complete tarball, sharing the download location with
our other driver.
http://prdownloads.sourceforge.net/ibmehcad/ehea_EHEA_0002.tgz

We're waiting for a sourceforge project now since 9 days to put out a tgz,
and it looks like many other people get upset right now by their response
time.

So what's the right/preferred way to proceed?


Christop R.

 We're currently developing a new Ethernet device driver for a 10G IBM
chip
 for System p. (ppc64)

 A later version of the driver should end up in mainline kernel.
 How should we proceed to get first comments by the community?
 Either post this code as a patch to netdev or
yes

 put a full tarball on for example sourceforge?
nope.

Please read and observe:  Documentation/SubmittingPatches
and Section 3 of it, References, for other sources of
expectations/requirements.

The -mm tree also contains Documentation/SubmitChecklist
that you may find useful.

---
~Randy



Jeff Garzik [EMAIL PROTECTED] wrote on 08.06.2006 13:34:36:

 Jan-Bernd Themann wrote:
  Hello,
 
  we tried two times to send a patch set. In both cases the second
  (largest) patch
  got lost. The first one was a bit above 100k, the second one we tried
  was like 75K.
 
  Any idea what might be the problem?

 It might be size, or tripping a spam filter.

 For a new driver, do the sane thing and just post a URL.

Jeff




-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] myri10ge update

2006-06-08 Thread Brice Goglin
The following patch updates the myri10ge to 1.0.0, with the following changes:
* Switch to dma_alloc_coherent API.
* Avoid PCI burst when writing the firmware on chipset with unaligned 
completions.
* Use ethtool_op_set_tx_hw_csum instead of ethtool_op_set_tx_csum.
* Include linux/dma-mapping.h to bring DMA_32/64BIT_MASK on all architectures
  (was missing at least on alpha).
* Some typo and warning fixes.

Please apply.

Note that Andrew's myri10ge-alpha-build-fix.patch would conflict,
but it does not seem to have been merged in netdev-2.6 anyway.

Thanks.

Signed-off-by: Brice Goglin [EMAIL PROTECTED]
Signed-off-by: Andrew J. Gallatin [EMAIL PROTECTED]

 drivers/net/myri10ge/myri10ge.c |   57 +++---
 1 file changed, 37 insertions(+), 20 deletions(-)

diff -urNp linux-mm.old/drivers/net/myri10ge/myri10ge.c 
linux-mm/drivers/net/myri10ge/myri10ge.c
--- linux-mm.old/drivers/net/myri10ge/myri10ge.c2006-06-04 
08:51:00.0 -0400
+++ linux-mm/drivers/net/myri10ge/myri10ge.c2006-06-07 11:28:20.0 
-0400
@@ -44,6 +44,7 @@
 #include linux/string.h
 #include linux/module.h
 #include linux/pci.h
+#include linux/dma-mapping.h
 #include linux/etherdevice.h
 #include linux/if_ether.h
 #include linux/if_vlan.h
@@ -62,7 +63,6 @@
 #include net/checksum.h
 #include asm/byteorder.h
 #include asm/io.h
-#include asm/pci.h
 #include asm/processor.h
 #ifdef CONFIG_MTRR
 #include asm/mtrr.h
@@ -71,7 +71,7 @@
 #include myri10ge_mcp.h
 #include myri10ge_mcp_gen_header.h
 
-#define MYRI10GE_VERSION_STR 0.9.0
+#define MYRI10GE_VERSION_STR 1.0.0
 
 MODULE_DESCRIPTION(Myricom 10G driver (10GbE));
 MODULE_AUTHOR(Maintainer: [EMAIL PROTECTED]);
@@ -480,7 +478,19 @@ static int myri10ge_load_hotplug_firmwar
goto abort_with_fw;
 
crc = crc32(~0, fw-data, fw-size);
-   memcpy_toio(mgp-sram + MYRI10GE_FW_OFFSET, fw-data, fw-size);
+   if (mgp-tx.boundary == 2048) {
+   /* Avoid PCI burst on chipset with unaligned completions. */
+   int i;
+   __iomem u32 *ptr = (__iomem u32 *) (mgp-sram +
+   MYRI10GE_FW_OFFSET);
+   for (i = 0; i  fw-size / 4; i++) {
+   __raw_writel(((u32 *) fw-data)[i], ptr + i);
+   wmb();
+   }
+   } else {
+   myri10ge_pio_copy(mgp-sram + MYRI10GE_FW_OFFSET, fw-data,
+ fw-size);
+   }
/* corruption checking is good for parity recovery and buggy chipset */
memcpy_fromio(fw-data, mgp-sram + MYRI10GE_FW_OFFSET, fw-size);
reread_crc = crc32(~0, fw-data, fw-size);
@@ -536,6 +548,7 @@ static int myri10ge_load_firmware(struct
u32 dma_low, dma_high, size;
int status, i;
 
+   size = 0;
status = myri10ge_load_hotplug_firmware(mgp, size);
if (status) {
dev_warn(mgp-pdev-dev, hotplug firmware loading failed\n);
@@ -778,7 +791,7 @@ myri10ge_submit_8rx(struct mcp_kreq_ethe
 }
 
 /*
- * Set of routunes to get a new receive buffer.  Any buffer which
+ * Set of routines to get a new receive buffer.  Any buffer which
  * crosses a 4KB boundary must start on a 4KB boundary due to PCIe
  * wdma restrictions. We also try to align any smaller allocation to
  * at least a 16 byte boundary for efficiency.  We assume the linux
@@ -1349,7 +1362,7 @@ static struct ethtool_ops myri10ge_ethto
.get_rx_csum = myri10ge_get_rx_csum,
.set_rx_csum = myri10ge_set_rx_csum,
.get_tx_csum = ethtool_op_get_tx_csum,
-   .set_tx_csum = ethtool_op_set_tx_csum,
+   .set_tx_csum = ethtool_op_set_tx_hw_csum,
.get_sg = ethtool_op_get_sg,
.set_sg = ethtool_op_set_sg,
 #ifdef NETIF_F_TSO
@@ -2615,12 +2628,13 @@ static int myri10ge_probe(struct pci_dev
dev_err(pdev-dev, Error %d setting DMA mask\n, status);
goto abort_with_netdev;
}
-   mgp-cmd = pci_alloc_consistent(pdev, sizeof(*mgp-cmd), mgp-cmd_bus);
+   mgp-cmd = dma_alloc_coherent(pdev-dev, sizeof(*mgp-cmd),
+ mgp-cmd_bus, GFP_KERNEL);
if (mgp-cmd == NULL)
goto abort_with_netdev;
 
-   mgp-fw_stats = pci_alloc_consistent(pdev, sizeof(*mgp-fw_stats),
-mgp-fw_stats_bus);
+   mgp-fw_stats = dma_alloc_coherent(pdev-dev, sizeof(*mgp-fw_stats),
+  mgp-fw_stats_bus, GFP_KERNEL);
if (mgp-fw_stats == NULL)
goto abort_with_cmd;
 
@@ -2659,8 +2673,8 @@ static int myri10ge_probe(struct pci_dev
 
/* allocate rx done ring */
bytes = myri10ge_max_intr_slots * sizeof(*mgp-rx_done.entry);
-   mgp-rx_done.entry =
-   pci_alloc_consistent(pdev, bytes, mgp-rx_done.bus);
+   mgp-rx_done.entry = dma_alloc_coherent(pdev-dev, bytes,
+   

Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Jeff Garzik


(CC'ing our newly minted tulip maintainer, Val)

Grant Grundler wrote:

Jeff,
SLES10 testing exposed an MCA that was confirmed to be a DMA IO TLB miss.
This means tulip device was attempting to DMA to memory that was already
unmapped. The test was crashing in the ifconfig down step when a 4-port
tulip card was under this work load:

while :
do
ifconfig eth24 up
ifconfig eth25 up
ifconfig eth26 up
ifconfig eth27 up
# Pound both interfaces with ethtool
for i in `seq 1000`
do
ethtool eth24 /dev/null
ethtool eth25 /dev/null
ethtool eth26 /dev/null
ethtool eth27 /dev/null
done

# Bring interfaces down
echo ifconfig $nic1 down
ifconfig eth24 down
ifconfig eth25 down
ifconfig eth26 down
ifconfig eth27 down

sleep 5
done


[ And yes, I know tulip doesn't support ethtool. Don't ask.
  It's still a sore point at the moment. Just consider it 
  a delay loop or use sleep 5 instead. ]


The real network load comes from another box(en) running 4 instances
of ping -f -s 1450 192.168.x.y where x.y is the subnet/IP of eth24-27.
The parisc and ia64 machines will crash in minutes.

I believe the problem is a race condition between an interrupt coming
in and the tulip_down() code path. Moving the free_irq() to before
tulip_down() call fixes the problem. I've been able to run the above
test for several hours now.


NAK.  This is a band-aid, and one that creates new problems even as it 
attempts to solve problems.


Calling free_irq() while the chip is still active is just a bad idea, 
because the chip could raise an interrupt, creating a 
screaming-interrupts situation.  Consider especially the case of shared 
interrupts here, as a concrete example of how this won't work.


Perhaps cp_close() in 8139cp.c could be an example of a good ordering? 
It stops the chip, syncs irqs, frees irq, then frees [thus unmapping] 
the rings.


Jeff




-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


PATCH to correct dump of WPA IE

2006-06-08 Thread Larry Finger
In net/ieee80211/softmac/ieee80211softmac_wx.c, there is a bug that prints extended sign information 
whenever the byte value exceeds 0x7f. The following patch changes the printk to use a u8 cast to 
limit the output to 2 digits. This bug was first noticed by Dan Williams [EMAIL PROTECTED]. This 
patch applies to the current master branch of the Linville tree.


Signed-Off-By: Larry Finger [EMAIL PROTECTED]


diff --git a/net/ieee80211/softmac/ieee80211softmac_wx.c 
b/net/ieee80211/softmac/ieee80211softmac_wx.c
index 27edb2b..55c5c26 100644
--- a/net/ieee80211/softmac/ieee80211softmac_wx.c
+++ b/net/ieee80211/softmac/ieee80211softmac_wx.c
@@ -388,7 +388,7 @@ ieee80211softmac_wx_set_genie(struct net
memcpy(mac-wpa.IE, extra, wrqu-data.length);
dprintk(KERN_INFO PFX generic IE set to );
for (i=0;iwrqu-data.length;i++)
-   dprintk(%.2x, mac-wpa.IE[i]);
+   dprintk(%.2x, (u8)mac-wpa.IE[i]);
dprintk(\n);
mac-wpa.IElen = wrqu-data.length;
} else {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: EHEA: Is there a size limit below 80K for patches?

2006-06-08 Thread Jeff Garzik

Christoph Raisch wrote:

well, now I'm confused...
2 People, two opinions


Here's a URL for a complete tarball, sharing the download location with
our other driver.
http://prdownloads.sourceforge.net/ibmehcad/ehea_EHEA_0002.tgz

We're waiting for a sourceforge project now since 9 days to put out a tgz,
and it looks like many other people get upset right now by their response
time.

So what's the right/preferred way to proceed?


Patches and new drivers should always go to the mailing list.. 
except for the case where they are too big to be posted to the mailing 
list.  For that special case, a URL to a patch should be posted.


Jeff



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] PHYLIB/gianfar: Use phy_ethtool_get_link() for get_link op

2006-06-08 Thread Jeff Garzik

Nathaniel Case wrote:

This patch makes the gianfar ethtool code use phy_ethtool_get_link() instead of
ethtool_op_get_link().

Patch depends on previous one (1/2).

Signed-off-by: Nate Case [EMAIL PROTECTED]

---

--- a/drivers/net/gianfar_ethtool.c 2006-06-05 11:27:19.0 -0500
+++ b/drivers/net/gianfar_ethtool.c 2006-06-04 19:31:01.0 -0500
@@ -228,6 +228,18 @@
buf[i] = gfar_read(theregs[i]);
 }
 
+static u32 gfar_get_link(struct net_device *dev)

+{
+   struct gfar_private *priv = netdev_priv(dev);
+   struct phy_device *phydev = priv-phydev;
+
+   if (NULL == phydev)
+   return -ENODEV;


NAK, return code obviously wrong


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/9] NetXen 1G/10G ethernet driver patch with corrections

2006-06-08 Thread Pradeep Dalvi
diff -u linux-2.6.16.20/drivers/net/netxen/netxen_nic_ethtool.c
linux-2.6.16.20/drivers/net/netxen/netxen_nic_ethtool.c
--- linux-2.6.16.20/drivers/net/netxen/netxen_nic_ethtool.c 2006-06-06
06:58:11.0 -0700
+++ linux-2.6.16.20/drivers/net/netxen/netxen_nic_ethtool.c 2006-06-08
06:52:09.0 -0700
@@ -240,6 +240,95 @@
return NETXEN_NIC_REGS_LEN;
 }
 
+struct netxen_niu_regs {
+   netxen_crbword_treg[NETXEN_NIC_REGS_COUNT];
+};
+
+static struct netxen_niu_regs niu_registers[] = {
+   {
+/* GB Mode */
+{
+ NETXEN_NIU_GB_SERDES_RESET,
+ NETXEN_NIU_GB0_MII_MODE,
+ NETXEN_NIU_GB1_MII_MODE,
+ NETXEN_NIU_GB2_MII_MODE,
+ NETXEN_NIU_GB3_MII_MODE,
+ NETXEN_NIU_GB0_GMII_MODE,
+ NETXEN_NIU_GB1_GMII_MODE,
+ NETXEN_NIU_GB2_GMII_MODE,
+ NETXEN_NIU_GB3_GMII_MODE,
+ NETXEN_NIU_REMOTE_LOOPBACK,
+ NETXEN_NIU_GB0_HALF_DUPLEX,
+ NETXEN_NIU_GB1_HALF_DUPLEX,
+ NETXEN_NIU_RESET_SYS_FIFOS,
+ NETXEN_NIU_GB_CRC_DROP,
+ NETXEN_NIU_GB_DROP_WRONGADDR,
+ NETXEN_NIU_TEST_MUX_CTL,
+
+ NETXEN_NIU_GB_MAC_CONFIG_0(0),
+ NETXEN_NIU_GB_MAC_CONFIG_1(0),
+ NETXEN_NIU_GB_HALF_DUPLEX_CTRL(0),
+ NETXEN_NIU_GB_MAX_FRAME_SIZE(0),
+ NETXEN_NIU_GB_TEST_REG(0),
+ NETXEN_NIU_GB_MII_MGMT_CONFIG(0),
+ NETXEN_NIU_GB_MII_MGMT_COMMAND(0),
+ NETXEN_NIU_GB_MII_MGMT_ADDR(0),
+ NETXEN_NIU_GB_MII_MGMT_CTRL(0),
+ NETXEN_NIU_GB_MII_MGMT_STATUS(0),
+ NETXEN_NIU_GB_MII_MGMT_INDICATE(0),
+ NETXEN_NIU_GB_INTERFACE_CTRL(0),
+ NETXEN_NIU_GB_INTERFACE_STATUS(0),
+ NETXEN_NIU_GB_STATION_ADDR_0(0),
+ NETXEN_NIU_GB_STATION_ADDR_1(0),
+ -1,
+}
+   },
+   {
+/* XG Mode */
+{
+ NETXEN_NIU_XG_SINGLE_TERM,
+ NETXEN_NIU_XG_DRIVE_HI,
+ NETXEN_NIU_XG_DRIVE_LO,
+ NETXEN_NIU_XG_DTX,
+ NETXEN_NIU_XG_DEQ,
+ NETXEN_NIU_XG_WORD_ALIGN,
+ NETXEN_NIU_XG_RESET,
+ NETXEN_NIU_XG_POWER_DOWN,
+ NETXEN_NIU_XG_RESET_PLL,
+ NETXEN_NIU_XG_SERDES_LOOPBACK,
+ NETXEN_NIU_XG_DO_BYTE_ALIGN,
+ NETXEN_NIU_XG_TX_ENABLE,
+ NETXEN_NIU_XG_RX_ENABLE,
+ NETXEN_NIU_XG_STATUS,
+ NETXEN_NIU_XG_PAUSE_THRESHOLD,
+ NETXEN_NIU_XGE_CONFIG_0,
+ NETXEN_NIU_XGE_CONFIG_1,
+ NETXEN_NIU_XGE_IPG,
+ NETXEN_NIU_XGE_STATION_ADDR_0_HI,
+ NETXEN_NIU_XGE_STATION_ADDR_0_1,
+ NETXEN_NIU_XGE_STATION_ADDR_1_LO,
+ NETXEN_NIU_XGE_STATUS,
+ NETXEN_NIU_XGE_MAX_FRAME_SIZE,
+ NETXEN_NIU_XGE_PAUSE_FRAME_VALUE,
+ NETXEN_NIU_XGE_TX_BYTE_CNT,
+ NETXEN_NIU_XGE_TX_FRAME_CNT,
+ NETXEN_NIU_XGE_RX_BYTE_CNT,
+ NETXEN_NIU_XGE_RX_FRAME_CNT,
+ NETXEN_NIU_XGE_AGGR_ERROR_CNT,
+ NETXEN_NIU_XGE_MULTICAST_FRAME_CNT,
+ NETXEN_NIU_XGE_UNICAST_FRAME_CNT,
+ NETXEN_NIU_XGE_CRC_ERROR_CNT,
+ NETXEN_NIU_XGE_OVERSIZE_FRAME_ERR,
+ NETXEN_NIU_XGE_UNDERSIZE_FRAME_ERR,
+ NETXEN_NIU_XGE_LOCAL_ERROR_CNT,
+ NETXEN_NIU_XGE_REMOTE_ERROR_CNT,
+ NETXEN_NIU_XGE_CONTROL_CHAR_CNT,
+ NETXEN_NIU_XGE_PAUSE_FRAME_CNT,
+ -1,
+}
+   }
+};
+
 static void
 netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs,
void *p)
 {
@@ -248,6 +337,7 @@
netxen_crbword_t mode, *regs_buff = p;
unsigned long flags;
void *addr;
+   int i, window;
 
memset(p, 0, NETXEN_NIC_REGS_LEN);
regs-version = (1  24) | (adapter-ahw.revision_id  16) |
@@ -260,176 +350,18 @@
/* Common registers to all the modes */
NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER,
   regs_buff[2]);
-   switch (mode) {
-   case 4:{/* XGB Mode */
-   NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XG_SINGLE_TERM,
-  regs_buff[3]);
-   NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XG_DRIVE_HI,
-  regs_buff[4]);
-   NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XG_DRIVE_LO,
-  regs_buff[5]);
-   NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XG_DTX,
-  regs_buff[6]);
-   NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XG_DEQ,
-  regs_buff[7]);
-   NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XG_WORD_ALIGN,
-  regs_buff[8]);
-   NETXEN_NIC_LOCKED_READ_REG(NETXEN_NIU_XG_RESET,
-  regs_buff[9]);
-   

Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread Alan Cox
Ar Iau, 2006-06-08 am 11:50 +0100, ysgrifennodd Gerrit Renker:
 +  UDP-Lite introduces a new socket type, the SOCK_LDGRAM (note the L) for
 +  lightweight, connection-less services. These are the socket options:

This is not the intended use of the socket API when distinguishing
between services. The socket() call has a protocol field that is usually
unused and it exists precisely to disambiguate multiple protocols with
the same generic behaviour but different properties.

s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDPLITE);

is probably the right way to do this, keeping 0 default as before
meaning IPPROTO_UDP

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Thu, 08 Jun 2006 15:47:52 +0100), Alan Cox 
[EMAIL PROTECTED] says:

 Ar Iau, 2006-06-08 am 11:50 +0100, ysgrifennodd Gerrit Renker:
  +  UDP-Lite introduces a new socket type, the SOCK_LDGRAM (note the L) for
  +  lightweight, connection-less services. These are the socket options:
:
   s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDPLITE);
 
 is probably the right way to do this, keeping 0 default as before
 meaning IPPROTO_UDP

I do think so, too.

--yoshfuji
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] PHYLIB/gianfar: Use phy_ethtool_get_link() for get_link op

2006-06-08 Thread Nathaniel Case
On Thu, 2006-06-08 at 10:58 -0400, Jeff Garzik wrote:
  +static u32 gfar_get_link(struct net_device *dev)
  +{
  +   struct gfar_private *priv = netdev_priv(dev);
  +   struct phy_device *phydev = priv-phydev;
  +
  +   if (NULL == phydev)
  +   return -ENODEV;
 
 NAK, return code obviously wrong

Thanks.  I think we can just return 0 for that case.  Updated patch
follows.

Signed-off-by: Nate Case [EMAIL PROTECTED]


--- a/drivers/net/gianfar_ethtool.c 2006-06-05 11:27:19.0 -0500
+++ b/drivers/net/gianfar_ethtool.c 2006-06-04 19:31:01.0 -0500
@@ -228,6 +228,18 @@
buf[i] = gfar_read(theregs[i]);
 }
 
+static u32 gfar_get_link(struct net_device *dev)
+{
+   struct gfar_private *priv = netdev_priv(dev);
+   struct phy_device *phydev = priv-phydev;
+
+   if (NULL == phydev)
+   return 0;
+
+   return phy_ethtool_get_link(phydev);
+}
+
+
 /* Convert microseconds to ethernet clock ticks, which changes
  * depending on what speed the controller is running at */
 static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int 
usecs)
@@ -574,7 +578,7 @@
.get_drvinfo = gfar_gdrvinfo,
.get_regs_len = gfar_reglen,
.get_regs = gfar_get_regs,
-   .get_link = ethtool_op_get_link,
+   .get_link = gfar_get_link,
.get_coalesce = gfar_gcoalesce,
.set_coalesce = gfar_scoalesce,
.get_ringparam = gfar_gringparam,


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Grant Grundler
On Thu, Jun 08, 2006 at 10:43:04AM -0400, Jeff Garzik wrote:
 (CC'ing our newly minted tulip maintainer, Val)

Excellent!
Has MAINTAINERS file been updated? :)

...
 NAK.  This is a band-aid, and one that creates new problems even as it 
 attempts to solve problems.

You failed to demonstrate that below. Any other objections?

 Calling free_irq() while the chip is still active is just a bad idea, 
 because the chip could raise an interrupt, creating a 
 screaming-interrupts situation. Consider especially the case of shared 
 interrupts here, as a concrete example of how this won't work.

The chip IRQ gets turned off in tulip_down().
It won't be screaming for very long.
No one will hear it screaming and no one will care.
The decision to bring down the NIC was already made.

Secondly, if tulip has a problem with shared IRQs, it's already there.
We would have called free_irq() anyway - just a bit later.
In the shared IRQ case, I expect free_irq() to unlink this instance
of the tulip interrupt handler from the CPU vector list. If that
doesn't happen, I could consider that an arch specific bug,
not a tulip driver bug.

 Perhaps cp_close() in 8139cp.c could be an example of a good ordering? 
 It stops the chip, syncs irqs, frees irq, then frees [thus unmapping] 
 the rings.

Sorry, I don't see how it matters if we disable chip IRQ first
or unlink from CPU IRQ list first. Does it?

thanks,
grant
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Grant Grundler
On Thu, Jun 08, 2006 at 09:22:21AM -0600, Grant Grundler wrote:
  Perhaps cp_close() in 8139cp.c could be an example of a good ordering? 
  It stops the chip, syncs irqs, frees irq, then frees [thus unmapping] 
  the rings.
 
 Sorry, I don't see how it matters if we disable chip IRQ first
 or unlink from CPU IRQ list first. Does it?

Ok...I think I understand what you are driving at here.
The case is when CPU vector is enabled and shared but
one device _without_ an interrupt handler is registered
is still yanking on the interrupt line. It will cause
linux to disable the line since the IRQ isn't being handled.

This is only possible in the shared IRQ case.

Can we call free_irq() from tulip_down()?
I have the feeling this is going to cause alot more code movement.

thanks,
grant
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] PHYLIB/gianfar: Use phy_ethtool_get_link() for get_link op

2006-06-08 Thread Jeff Garzik

Nathaniel Case wrote:

On Thu, 2006-06-08 at 10:58 -0400, Jeff Garzik wrote:

+static u32 gfar_get_link(struct net_device *dev)
+{
+   struct gfar_private *priv = netdev_priv(dev);
+   struct phy_device *phydev = priv-phydev;
+
+   if (NULL == phydev)
+   return -ENODEV;

NAK, return code obviously wrong


Thanks.  I think we can just return 0 for that case.  Updated patch
follows.

Signed-off-by: Nate Case [EMAIL PROTECTED]


Sigh.  See rule #6: http://linux.yyz.us/patch-format.html

You excised the patch description, which means your patch can no longer 
be applied correctly by scripts.


Jeff


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Jeff Garzik

Grant Grundler wrote:

On Thu, Jun 08, 2006 at 10:43:04AM -0400, Jeff Garzik wrote:

(CC'ing our newly minted tulip maintainer, Val)


Excellent!
Has MAINTAINERS file been updated? :)


It should be updated, yes.


Calling free_irq() while the chip is still active is just a bad idea, 
because the chip could raise an interrupt, creating a 
screaming-interrupts situation. Consider especially the case of shared 
interrupts here, as a concrete example of how this won't work.


The chip IRQ gets turned off in tulip_down().
It won't be screaming for very long.


Then you admit that you add a race.



No one will hear it screaming and no one will care.


False.  Easy counter-example already provided:  Shared interrupts.

For some IRQ architectures, even without shared interrupts, this could 
easily trigger the kernel's screaming-irq detection code.




Secondly, if tulip has a problem with shared IRQs, it's already there.
We would have called free_irq() anyway - just a bit later.


Yes... AFTER we told the chip to stop DMA'ing, and delivering interrupts.

I'm frankly surprised you don't see the obvious, natural ordering.  You 
stop the hardware from wanting to deliver interrupts, before 
unregistering the irq handler.  IOW you turn out the lights, before 
leaving the room.




In the shared IRQ case, I expect free_irq() to unlink this instance
of the tulip interrupt handler from the CPU vector list. If that


Irrelevant -- that doesn't stop the tulip hardware from raising the irq, 
nor stop the system from attempting to deliver it [in all cases].  In 
the shared interrupt case, that means that another driver's irq handler 
will be called for an event tulip hardware raised.


Jeff


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Grant Grundler
On Thu, Jun 08, 2006 at 11:32:39AM -0400, Jeff Garzik wrote:
 The chip IRQ gets turned off in tulip_down().
 It won't be screaming for very long.
 
 Then you admit that you add a race.

Yes - I realized that after I hit send :(

...
 In the shared IRQ case, I expect free_irq() to unlink this instance
 of the tulip interrupt handler from the CPU vector list. If that
 
 Irrelevant -- that doesn't stop the tulip hardware from raising the irq, 
 nor stop the system from attempting to deliver it [in all cases].  In 
 the shared interrupt case, that means that another driver's irq handler 
 will be called for an event tulip hardware raised.

*nod*

thanks,
grant
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Jeff Garzik

Grant Grundler wrote:

Ok...I think I understand what you are driving at here.
The case is when CPU vector is enabled and shared but
one device _without_ an interrupt handler is registered
is still yanking on the interrupt line. It will cause
linux to disable the line since the IRQ isn't being handled.


Correct.



Can we call free_irq() from tulip_down()?


I'm sure you can answer that yourself.  If it doesn't cause problems 
elsewhere, yes.  Otherwise, no.  :)


Did you read the example I cited, cp_close() ?

Jeff


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] pcnet32 driver NAPI support

2006-06-08 Thread Lennart Sorensen
On Wed, Jun 07, 2006 at 03:32:45PM -0700, Don Fry wrote:
 One other problem I ran into.  I applied the patch but it will not
 compile because rl_active is never defined.  I have worked around it but

Doh!  I thought I cleaned up all my weird code from my own version.
Because of the platform I work with having 4 pcnet32 ports, and a slow
poke 266MHz geode, we can't handle full traffic load, so to keep the
system responsive to pause processing receives when we pass a certain
number of packets per second.  rl_active is part of that.  I meant to
remove all of it, apparently I didn't read every line of my patch
carefully enough. :(

Well at least this ought to clean up my work a bit.

Len Sorensen
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Grant Grundler
On Thu, Jun 08, 2006 at 11:38:52AM -0400, Jeff Garzik wrote:
 Can we call free_irq() from tulip_down()?
 
 I'm sure you can answer that yourself.  If it doesn't cause problems 
 elsewhere, yes.  Otherwise, no.  :)

Yeah, well, I was hoping you would Just Know (tm). :)
Research takes time.

 Did you read the example I cited, cp_close() ?

Yes - after I sent the mail. It looks good to me too.

thanks,
grant
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] s2io: netpoll support

2006-06-08 Thread Brian Haley
This adds netpoll support for things like netconsole/kgdboe to the s2io 
10GbE driver.


This duplicates some code from s2io_poll() as I wanted to be 
least-invasive, someone from Neterion might have other thoughts?


Signed-off-by: Brian Haley [EMAIL PROTECTED]
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 79208f4..c2c5f46 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2575,6 +2575,53 @@ no_rx:
 #endif
 
 /**
+ * s2io_netpoll - Rx interrupt service handler for netpoll support
+ * @dev : pointer to the device structure.
+ * Description:
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void s2io_netpoll(struct net_device *dev)
+{
+	nic_t *nic = dev-priv;
+	mac_info_t *mac_control;
+	struct config_param *config;
+	XENA_dev_config_t __iomem *bar0 = nic-bar0;
+	u64 val64;
+	int i;
+
+	atomic_inc(nic-isr_cnt);
+
+	/*  Disable all interrupts */
+	en_dis_able_nic_intrs(nic, ENA_ALL_INTRS, DISABLE_INTRS);
+
+	mac_control = nic-mac_control;
+	config = nic-config;
+
+	val64 = readq(bar0-rx_traffic_int);
+	writeq(val64, bar0-rx_traffic_int);
+
+	for (i = 0; i  config-rx_ring_num; i++)
+		rx_intr_handler(mac_control-rings[i]);
+
+	for (i = 0; i  config-rx_ring_num; i++) {
+		if (fill_rx_buffers(nic, i) == -ENOMEM) {
+			DBG_PRINT(ERR_DBG, %s:Out of memory, dev-name);
+			DBG_PRINT(ERR_DBG,  in Rx Netpoll!!\n);
+			break;
+		}
+	}
+	/* Re-enable all interrupts */
+	en_dis_able_nic_intrs(nic, ENA_ALL_INTRS, ENABLE_INTRS);
+	atomic_dec(nic-isr_cnt);
+	return;
+}
+#endif
+
+/**
  *  rx_intr_handler - Rx interrupt handler
  *  @nic: device private variable.
  *  Description:
@@ -6210,6 +6257,10 @@ Defaulting to INTA\n);
 	dev-weight = 32;
 #endif
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev-poll_controller = s2io_netpoll;
+#endif
+
 	dev-features |= NETIF_F_SG | NETIF_F_IP_CSUM;
 	if (sp-high_dma_flag == TRUE)
 		dev-features |= NETIF_F_HIGHDMA;


Re: New tulip maintainer...

2006-06-08 Thread Grant Grundler
On Thu, Jun 08, 2006 at 11:41:28AM -0400, Jeff Garzik wrote:
 Now that we have a new tulip maintainer, perhaps a resend of the 
 long-outstanding tulip phy patches could be resent?

All the tulip patches I have are archived here:
ftp://ftp.parisc-linux.org/patches/

Anything else tulip I've been involved with is available
via CVS from cvs.parisc-linux.org/linux-2.6/

Thibaut Varene has also committed his changes to that CVS.

thanks,
grant
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/5] ehea: makefile and Kconfig

2006-06-08 Thread Randy.Dunlap
On Thu, 08 Jun 2006 11:56:05 +0200 Jan-Bernd Themann wrote:

 Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED]
 
 
   drivers/net/ehea/Kconfig  |6 ++
   drivers/net/ehea/Makefile |7 +++
   2 files changed, 13 insertions(+)
 
 
 
 --- linux-2.6.16-rc5-orig/drivers/net/ehea/Makefile   1969-12-31 
 16:00:00.0 -0800
 +++ kernel/drivers/net/ehea/Makefile  2006-06-08 01:58:28.839212488 -0700
 @@ -0,0 +1,7 @@
 +#
 +# Makefile for the eHEA ethernet device driver for IBM eServer System p
 +#
 +
 +ehea_mod-objs = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o ehea_phyp.o
 +obj-$(CONFIG_EHEA) += ehea_mod.o
 +
 --- linux-2.6.16-rc5-orig/drivers/net/ehea/Kconfig1969-12-31 
 16:00:00.0 -0800
 +++ kernel/drivers/net/ehea/Kconfig   2006-06-08 01:58:28.842212032 -0700
 @@ -0,0 +1,6 @@
 +config EHEA
 +   tristate eHEA Ethernet support
 +   depends on IBMEBUS
 +   ---help---
 +   This driver supports the IBM pSeries ethernet adapter
 +

Hi,
Will you be modifying drivers/net/Makefile and drivers/net/Kconfig
to use these files?

And help text is normally indented (convention is 2 spaces)
since (from Documentation/kbuild/kconfig-language.txt):

  The end of the help text is determined by
  the indentation level, this means it ends at the first line which has
  a smaller indentation than the first line of the help text.

---
~Randy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread Gerrit Renker
Quoting Alan Cox:
|  Ar Iau, 2006-06-08 am 11:50 +0100, ysgrifennodd Gerrit Renker:
|   +  UDP-Lite introduces a new socket type, the SOCK_LDGRAM (note the L) for
|   +  lightweight, connection-less services. These are the socket options:
|  
|  This is not the intended use of the socket API when distinguishing
|  between services. The socket() call has a protocol field that is usually
|  unused and it exists precisely to disambiguate multiple protocols with
|  the same generic behaviour but different properties.
|  
|   s = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDPLITE);
|  
|  is probably the right way to do this, keeping 0 default as before
|  meaning IPPROTO_UDP
Understood. Please, anyone, disregard or un-apply the previous UDP-Lite patch.
A revised patch will be prepared and posted as soon as testing permits. 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] PHYLIB/gianfar: Use phy_ethtool_get_link() for get_link op

2006-06-08 Thread Nathaniel Case
This patch makes the gianfar ethtool code use phy_ethtool_get_link()
instead of ethtool_op_get_link().

Signed-off-by: Nate Case [EMAIL PROTECTED]

---

--- a/drivers/net/gianfar_ethtool.c 2006-06-05 11:27:19.0 -0500
+++ b/drivers/net/gianfar_ethtool.c 2006-06-04 19:31:01.0 -0500
@@ -228,6 +228,18 @@
buf[i] = gfar_read(theregs[i]);
 }
 
+static u32 gfar_get_link(struct net_device *dev)
+{
+   struct gfar_private *priv = netdev_priv(dev);
+   struct phy_device *phydev = priv-phydev;
+
+   if (NULL == phydev)
+   return 0;
+
+   return phy_ethtool_get_link(phydev);
+}
+
+
 /* Convert microseconds to ethernet clock ticks, which changes
  * depending on what speed the controller is running at */
 static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int 
usecs)
@@ -574,7 +578,7 @@
.get_drvinfo = gfar_gdrvinfo,
.get_regs_len = gfar_reglen,
.get_regs = gfar_get_regs,
-   .get_link = ethtool_op_get_link,
+   .get_link = gfar_get_link,
.get_coalesce = gfar_gcoalesce,
.set_coalesce = gfar_scoalesce,
.get_ringparam = gfar_gringparam,


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND] e100/e1000: fixes and pci error recovery

2006-06-08 Thread Auke Kok


Jeff,

This is a resend of several earlier sent (and Acked) patches for e100 and 
e1000. They are available on our git server and contain:


in branch upstream-fixes:
[1] e1000: fix irq sharing when running ethtool test
[2] e1000: remove risky prefetch on next_skb-data

against netdev-2.6#upstream-fixes e82b0f2cc21be905e504573483fa9542b15df96f

[ please note that patch 2 will need manual merging into #upstream ]

in branch upstream:
[3] e100: add PCI Error Recovery
[4] e1000: add PCI Error Recovery

against netdev-2.6#upstream 983f27d37d4fc72c252835cb2ee3103b360735a6

Please pull:

into #upstream-fixes:
  git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream-fixes
into #upstream:
  git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream

Cheers,

Auke

Refs

[1] http://marc.theaimsgroup.com/?l=linux-netdevm=114928689932374w=2
[2] http://marc.theaimsgroup.com/?l=linux-netdevm=114954878609885w=2
[3] http://marc.theaimsgroup.com/?l=linux-netdevm=114436228823926w=2
[4] http://marc.theaimsgroup.com/?l=linux-pcim=114325705604534w=2
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: PATCH 2.6.17-rc5 tulip free_irq() called too late

2006-06-08 Thread Grant Grundler
On Thu, Jun 08, 2006 at 10:43:04AM -0400, Jeff Garzik wrote:
...
 Perhaps cp_close() in 8139cp.c could be an example of a good ordering? 
 It stops the chip, syncs irqs, frees irq, then frees [thus unmapping] 
 the rings.

Here is a new patch that moves free_irq() into tulip_down().
The resulting code is structured the same as cp_close().

While I believe the code is correct, I'm not real happy
that tulip_up() and tulip_down() don't both deal with IRQs.
(ie not symetrical). Oh well, I can submit another patch
for that if Val doesn't want to wrangle that herself.

This is compile tested only.
I'll drop it on ia64/parisc servers later and retest.

thanks,
grant


Index: drivers/net/tulip/tulip_core.c
===
RCS file: /var/cvs/linux-2.6/drivers/net/tulip/tulip_core.c,v
retrieving revision 1.35
diff -u -p -r1.35 tulip_core.c
--- drivers/net/tulip/tulip_core.c  23 Apr 2006 15:18:28 -  1.35
+++ drivers/net/tulip/tulip_core.c  8 Jun 2006 16:25:43 -
@@ -18,11 +18,11 @@
 
 #define DRV_NAME   tulip
 #ifdef CONFIG_TULIP_NAPI
-#define DRV_VERSION1.1.13-NAPI /* Keep at least for test */
+#define DRV_VERSION1.1.14-NAPI /* Keep at least for test */
 #else
-#define DRV_VERSION1.1.13
+#define DRV_VERSION1.1.14
 #endif
-#define DRV_RELDATEDecember 15, 2004
+#define DRV_RELDATEMay 6, 2006
 
 
 #include linux/module.h
@@ -743,6 +745,11 @@ static void tulip_down (struct net_devic
/* Stop the Tx and Rx processes. */
tulip_stop_rxtx(tp);
 
+   spin_unlock_irqrestore (tp-lock, flags);
+
+   synchronize_irq(dev-irq);
+   free_irq (dev-irq, dev);
+
/* prepare receive buffers */
tulip_refill_rx(dev);
 
@@ -752,7 +759,6 @@ static void tulip_down (struct net_devic
if (ioread32 (ioaddr + CSR6) != 0x)
tp-stats.rx_missed_errors += ioread32 (ioaddr + CSR8)  0x;
 
-   spin_unlock_irqrestore (tp-lock, flags);
 
init_timer(tp-timer);
tp-timer.data = (unsigned long)dev;
@@ -774,14 +780,13 @@ static int tulip_close (struct net_devic
int i;
 
netif_stop_queue (dev);
 
tulip_down (dev);
 
if (tulip_debug  1)
printk (KERN_DEBUG %s: Shutting down ethercard, status was 
%2.2x.\n,
dev-name, ioread32 (ioaddr + CSR5));
 
-   free_irq (dev-irq, dev);
 
/* Free all the skbuffs in the Rx queue. */
for (i = 0; i  RX_RING_SIZE; i++) {
@@ -1750,7 +1757,6 @@ static int tulip_suspend (struct pci_dev
tulip_down(dev);
 
netif_device_detach(dev);
-   free_irq(dev-irq, dev);
 
pci_save_state(pdev);
pci_disable_device(pdev);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Netchannels: netchannel vs. socket. 2:0.

2006-06-08 Thread Evgeniy Polyakov
After some enhancements made for netchannel subsystem I'm pleased to
announce, that netchannel subsystem outperforms existing layered design
both in CPU usage and network speed.

Well, after such pretentious introduction I want to cool things down.
CPU usage is about 1-2% less for netchannels and network performance is
about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, 
is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).

It is stable and 100% reproductible result.

Performance graph and patch are attached.

Interesting note, that netchannel copy_to_user() setup slightly 
outperforms memcpy() setup.

I have some doubts that stock socket TCP code was used in Van Jacobson 
netchannel implementation, especially in the final benchmarks, because
of his words about userspace TCP processing, which sometimes pushes to read 
RFC 793 and do some coding...


Previous patches, userspace utility, design and implementatin details
can be found at project's homepage [1].

1. Netchannel homepage.
http://tservice.net.ru/~s0mbre/old/?section=projectsitem=netchannel

Signed-off-by: Evgeniy Polyakov [EMAIL PROTECTED]

diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index f48bef1..7a4a758 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -315,3 +315,5 @@ ENTRY(sys_call_table)
.long sys_splice
.long sys_sync_file_range
.long sys_tee   /* 315 */
+   .long sys_vmsplice
+   .long sys_netchannel_control
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 5a92fed..fdfb997 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -696,4 +696,5 @@ ia32_sys_call_table:
.quad sys_sync_file_range
.quad sys_tee
.quad compat_sys_vmsplice
+   .quad sys_netchannel_control
 ia32_syscall_end:  
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index eb4b152..777cd85 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -322,8 +322,9 @@
 #define __NR_sync_file_range   314
 #define __NR_tee   315
 #define __NR_vmsplice  316
+#define __NR_netchannel_control317
 
-#define NR_syscalls 317
+#define NR_syscalls 318
 
 /*
  * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index feb77cb..08c230e 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -617,8 +617,10 @@ __SYSCALL(__NR_tee, sys_tee)
 __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
 #define __NR_vmsplice  278
 __SYSCALL(__NR_vmsplice, sys_vmsplice)
+#define __NR_netchannel_control279
+__SYSCALL(__NR_vmsplice, sys_netchannel_control)
 
-#define __NR_syscall_max __NR_vmsplice
+#define __NR_syscall_max __NR_netchannel_control
 
 #ifndef __NO_STUBS
 
diff --git a/include/linux/netchannel.h b/include/linux/netchannel.h
new file mode 100644
index 000..ed426e6
--- /dev/null
+++ b/include/linux/netchannel.h
@@ -0,0 +1,118 @@
+/*
+ * netchannel.h
+ * 
+ * 2006 Copyright (c) Evgeniy Polyakov [EMAIL PROTECTED]
+ * All rights reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __NETCHANNEL_H
+#define __NETCHANNEL_H
+
+#include linux/types.h
+
+enum netchannel_commands {
+   NETCHANNEL_CREATE = 0,
+   NETCHANNEL_REMOVE,
+   NETCHANNEL_BIND,
+   NETCHANNEL_READ,
+   NETCHANNEL_DUMP,
+};
+
+enum netchannel_type {
+   NETCHANNEL_COPY_USER = 0,
+   NETCHANNEL_MMAP,
+   NETCHANEL_VM_HACK,
+};
+
+struct unetchannel
+{
+   __u32   src, dst;   /* source/destination 
hashes */
+   __u16   sport, dport;   /* source/destination 
ports */
+   __u8proto;  /* IP protocol number */
+   __u8type;   /* Netchannel type */
+   __u8memory_limit_order; /* Memor limit order */
+   __u8init_stat_work; /* Start statistic 
dumping */
+};
+
+struct unetchannel_control
+{
+   struct unetchannel  unc;
+   __u32   cmd;
+   __u32

Re: [PATCH 1/2] e1000: fix netpoll with NAPI

2006-06-08 Thread Mitch Williams
On Wed, 2006-06-07 at 11:44 -0700, Jeff Moyer wrote:

 That patch locks around the tx clean routine.  As such, it doesn't
 prevent
 the problem.

The call to netif_rx_schedule_prep provides locking because it sets the
__LINK_STATE_RX_SCHED bit atomically.  The spinlock around
e1000_clean_tx_irq is to protect it from other calls to the transmit
routine, not NAPI.

-Mitch

  + disable_irq(adapter-pdev-irq);
  + if
 (likely(netif_rx_schedule_prep(adapter-polling_netdev[0]))) {
  + if (spin_trylock(adapter-tx_queue_lock)) {
  + e1000_clean_tx_irq(adapter,
 adapter-tx_ring[0]);
  + spin_unlock(adapter-tx_queue_lock);
  + }
  + adapter-clean_rx(adapter, adapter-rx_ring,
  + budget, netdev-weight);
  + clear_bit(__LINK_STATE_RX_SCHED,
  + adapter-polling_netdev[0].state);
 
 -Jeff
 
 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] e1000: fix netpoll with NAPI

2006-06-08 Thread Jeff Moyer
== Regarding Re: [PATCH 1/2] e1000: fix netpoll with NAPI; Mitch Williams 
[EMAIL PROTECTED] adds:

mitch.a.williams On Wed, 2006-06-07 at 11:44 -0700, Jeff Moyer wrote:
 That patch locks around the tx clean routine.  As such, it doesn't
 prevent the problem.

mitch.a.williams The call to netif_rx_schedule_prep provides locking
mitch.a.williams because it sets the __LINK_STATE_RX_SCHED bit atomically.
mitch.a.williams The spinlock around e1000_clean_tx_irq is to protect it
mitch.a.williams from other calls to the transmit routine, not NAPI.

Yes, but what prevents recursion in the poll routine?  Consider that the
poll routine could end up triggerring a printk (think iptables, here).  In
that case, you end up calling into netpoll, and if the tx ring is full, we
call the poll_controller routine.  We've now recursed.

The poll lock was originally introduced to prevent recursion, not
concurrent access.

-Jeff
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] e1000: fix netpoll with NAPI

2006-06-08 Thread Mitch Williams
On Wed, 2006-06-07 at 11:54 -0700, John W. Linville wrote:

 Pedantic objection, but I think this would read easier w/o the extra
 newline before disable_irq.

Heh.  I prefer to have a newline between declarations and code.  The
real problem is the position of the #ifdef -- that's what makes it
difficult to read.  The other solution would be
{
struct e1000_adapter *adapter = netdev_priv(netdev);
#ifdef CONFIG_E1000_NAPI
int budget = 0;
#endif

disable_irq(adapter-pdev-irq);

#ifdef CONFIG_E1000_NAPI
 all that stuff 
#else
rest of the stuff 
#endif
}

Which I think is worse to read.
-Mitch
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fw: [Bugme-new] [Bug 6666] New: invalid tcp socket connection to windows stacks

2006-06-08 Thread Andrew Morton


Begin forwarded message:

Date: Thu, 8 Jun 2006 05:23:04 -0700
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [Bugme-new] [Bug ] New: invalid tcp socket connection to windows 
stacks


http://bugzilla.kernel.org/show_bug.cgi?id=

   Summary: invalid tcp socket connection to windows stacks
Kernel Version: 2.6.17.rc3-rc6
Status: NEW
  Severity: normal
 Owner: [EMAIL PROTECTED]
 Submitter: [EMAIL PROTECTED]


Most recent kernel where this bug did not occur:

2.6.16 stable

Distribution:
none. static kernel compiled directly out of the box.

Hardware Environment:
dual Xeon 2.66 512kB 1024MB networks e1000 e1000 e100
dual Xeon 3.20 2048kB 2048MB networks e1000 sky2

Software Environment:
problem occurs in kernel version 2.6.17rc3, 2.6.17rc6
problem does NOT occur in kernel version 2.6.16

Problem Description:

The kernel sends an ack to the windows stack after sync has been
replied, but theres no answere to this ack(1) and the kernel sends
a FIN packet after connection timeout. Now the windowsstack sends 
an ack(2) and a FIN and the connections ends.

It takes a while for the linux kernel to send the fin, we have shorten 
this in our tcpdump a bit.

connections to other windowssystems i.e. throu a dsl router or other linux 
based computers are working as expected. 

It is a very! special bug which you are maybe not able to reproduce. 

that's why i added the ip adress to test with. As far as i know, the ip
belongs to an exchange server in a home network somewhere in switzerland.

You can use it freely as it acts as a public mailserver for the domain.

Problem occurs independently of Rx Polling/NAPI and Packet Split 
settings.

Steps to reproduce:

You need TCPDUMP and NETCAT ( nc ).

1) tcpdump -w /tmp/log -s 2000 host  212.90.215.40  
2) nc 212.90.215.40 25

If it's buggy you get :

11:24:15.021572 d59.x-mailer.de.59959 
cust.static.212-90-215-40.cybernet.ch.smtp: S 2028538653:2028538653(0) win 5840
mss 1460,sackOK,timestamp 243108498 0,nop,wscale 7 (DF)
11:24:15.076329 cust.static.212-90-215-40.cybernet.ch.smtp 
d59.x-mailer.de.59959: S 2328498080:2328498080(0) ack 2028538654 win 16384 mss
1400,nop,wscale 0,nop,nop,timestamp 0
0,nop,nop,sackOK
11:24:15.076352 d59.x-mailer.de.59959 
cust.static.212-90-215-40.cybernet.ch.smtp: . ack 1 win 46 nop,nop,timestamp
243108503 0 (DF)
11:24:21.926186 d59.x-mailer.de.59959 
cust.static.212-90-215-40.cybernet.ch.smtp: F 1:1(0) ack 1 win 46
nop,nop,timestamp 243109188 0 (DF)
11:24:21.972106 cust.static.212-90-215-40.cybernet.ch.smtp 
d59.x-mailer.de.59959: . ack 2 win 65535 nop,nop,timestamp 19121191 243109188 
(DF)
11:24:21.973980 cust.static.212-90-215-40.cybernet.ch.smtp 
d59.x-mailer.de.59959: F 116:116(0) ack 2 win 65535 nop,nop,timestamp 19121191
243109188 (DF)
11:24:21.973999 d59.x-mailer.de.59959 
cust.static.212-90-215-40.cybernet.ch.smtp: R 2028538655:2028538655(0) win 0 
(DF)   

### you should get kind of this:

13:56:37.203297 d59.x-mailer.de.43286 
cust.static.212-90-215-40.cybernet.ch.smtp: S 1489507409:1489507409(0) win 5840
mss 1460,sackOK,timestamp 16627469 0,nop,wscale 2 (DF)
13:56:37.250827 cust.static.212-90-215-40.cybernet.ch.smtp 
d59.x-mailer.de.43286: S 783498912:783498912(0) ack 1489507410 win 16384 mss
1400,nop,wscale 0,nop,nop,timestamp 0 0,nop,nop,sackOK
13:56:37.250888 d59.x-mailer.de.43286 
cust.static.212-90-215-40.cybernet.ch.smtp: . ack 1 win 1460 nop,nop,timestamp
16627473 0 (DF)
13:56:37.292170 cust.static.212-90-215-40.cybernet.ch.smtp 
d59.x-mailer.de.43286: P 1:116(115) ack 1 win 65535 nop,nop,timestamp 20940584
16627469 (DF)
13:56:37.292207 d59.x-mailer.de.43286 
cust.static.212-90-215-40.cybernet.ch.smtp: . ack 116 win 1460
nop,nop,timestamp 16627478 20940584 (DF)
13:56:39.373383 d59.x-mailer.de.43286 
cust.static.212-90-215-40.cybernet.ch.smtp: F 1:1(0) ack 116 win 1460
nop,nop,timestamp 16627686 20940584 (DF)
13:56:39.413075 cust.static.212-90-215-40.cybernet.ch.smtp 
d59.x-mailer.de.43286: . ack 2 win 65535 nop,nop,timestamp 20940605 16627686 
(DF)
13:56:39.414449 cust.static.212-90-215-40.cybernet.ch.smtp 
d59.x-mailer.de.43286: F 116:116(0) ack 2 win 65535 nop,nop,timestamp 20940605
16627686 (DF)
13:56:39.414464 d59.x-mailer.de.43286 
cust.static.212-90-215-40.cybernet.ch.smtp: . ack 117 win 1460
nop,nop,timestamp 16627690 20940605 (DF)

--- You are receiving this mail because: ---
You are on the CC list for the bug, or are watching someone who is.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Netchannels: netchannel vs. socket. 2:0.

2006-06-08 Thread Evgeniy Polyakov
On Thu, Jun 08, 2006 at 09:15:55PM +0400, Evgeniy Polyakov ([EMAIL PROTECTED]) 
wrote:
 After some enhancements made for netchannel subsystem I'm pleased to
 announce, that netchannel subsystem outperforms existing layered design
 both in CPU usage and network speed.
 
 Well, after such pretentious introduction I want to cool things down.
 CPU usage is about 1-2% less for netchannels and network performance is
 about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, 
 is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).
 
 It is stable and 100% reproductible result.
 
 Performance graph and patch are attached.

Hmm, graph has been attached now.

-- 
Evgeniy Polyakov


netchannel_speed.png
Description: PNG image


[DOC] update bonding documentation with sysfs

2006-06-08 Thread Auke Kok


Jeff,

Attached patch is pushed on top of #upstream on our git server also containing 
the resent patches earlier today.


Please pull:
  git pull git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream

Cheers,

Auke


---
[DOC] Update bonding documentation with sysfs info

Bonding documentation needed an update to include sysfs specific
information. This patch adds information on how to change bonding
parameters at runtime using the sysfs interface.

Signed-off-by: Mitch Williams [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]

---
 bonding.txt |  323 ++--
 1 file changed, 229 insertions(+), 94 deletions(-)


---
[DOC] Update bonding documentation with sysfs info

Bonding documentation needed an update to include sysfs specific
information. This patch adds information on how to change bonding
parameters at runtime using the sysfs interface.

Signed-off-by: Mitch Williams [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]

---
 bonding.txt |  323 ++--
 1 file changed, 229 insertions(+), 94 deletions(-)

---
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 8d8b4e5..afac780 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -1,7 +1,7 @@
 
 		Linux Ethernet Bonding Driver HOWTO
 
-		Latest update: 21 June 2005
+		Latest update: 24 April 2006
 
 Initial release : Thomas Davis tadavis at lbl.gov
 Corrections, HA extensions : 2000/10/03-15 :
@@ -12,6 +12,8 @@ Corrections, HA extensions : 2000/10/03-
   - Jay Vosburgh fubar at us dot ibm dot com
 
 Reorganized and updated Feb 2005 by Jay Vosburgh
+Added Sysfs information: 2006/04/24
+  - Mitch Williams mitch.a.williams at intel.com
 
 Introduction
 
@@ -38,61 +40,62 @@ Table of Contents
 2. Bonding Driver Options
 
 3. Configuring Bonding Devices
-3.1	Configuration with sysconfig support
-3.1.1		Using DHCP with sysconfig
-3.1.2		Configuring Multiple Bonds with sysconfig
-3.2	Configuration with initscripts support
-3.2.1		Using DHCP with initscripts
-3.2.2		Configuring Multiple Bonds with initscripts
-3.3	Configuring Bonding Manually
+3.1	Configuration with Sysconfig Support
+3.1.1		Using DHCP with Sysconfig
+3.1.2		Configuring Multiple Bonds with Sysconfig
+3.2	Configuration with Initscripts Support
+3.2.1		Using DHCP with Initscripts
+3.2.2		Configuring Multiple Bonds with Initscripts
+3.3	Configuring Bonding Manually with Ifenslave
 3.3.1		Configuring Multiple Bonds Manually
+3.4	Configuring Bonding Manually via Sysfs
 
-5. Querying Bonding Configuration
-5.1	Bonding Configuration
-5.2	Network Configuration
+4. Querying Bonding Configuration
+4.1	Bonding Configuration
+4.2	Network Configuration
 
-6. Switch Configuration
+5. Switch Configuration
 
-7. 802.1q VLAN Support
+6. 802.1q VLAN Support
 
-8. Link Monitoring
-8.1	ARP Monitor Operation
-8.2	Configuring Multiple ARP Targets
-8.3	MII Monitor Operation
+7. Link Monitoring
+7.1	ARP Monitor Operation
+7.2	Configuring Multiple ARP Targets
+7.3	MII Monitor Operation
 
-9. Potential Trouble Sources
-9.1	Adventures in Routing
-9.2	Ethernet Device Renaming
-9.3	Painfully Slow Or No Failed Link Detection By Miimon
+8. Potential Trouble Sources
+8.1	Adventures in Routing
+8.2	Ethernet Device Renaming
+8.3	Painfully Slow Or No Failed Link Detection By Miimon
 
-10. SNMP agents
+9. SNMP agents
 
-11. Promiscuous mode
+10. Promiscuous mode
 
-12. Configuring Bonding for High Availability
-12.1	High Availability in a Single Switch Topology
-12.2	High Availability in a Multiple Switch Topology
-12.2.1		HA Bonding Mode Selection for Multiple Switch Topology
-12.2.2		HA Link Monitoring for Multiple Switch Topology
+11. Configuring Bonding for High Availability
+11.1	High Availability in a Single Switch Topology
+11.2	High Availability in a Multiple Switch Topology
+11.2.1		HA Bonding Mode Selection for Multiple Switch Topology
+11.2.2		HA Link Monitoring for Multiple Switch Topology
 
-13. Configuring Bonding for Maximum Throughput
-13.1	Maximum Throughput in a Single Switch Topology
-13.1.1		MT Bonding Mode Selection for Single Switch Topology
-13.1.2		MT Link Monitoring for Single Switch Topology
-13.2	Maximum Throughput in a Multiple Switch Topology
-13.2.1		MT Bonding Mode Selection for Multiple Switch Topology
-13.2.2		MT Link Monitoring for Multiple Switch Topology
+12. Configuring Bonding for Maximum Throughput
+12.1	Maximum Throughput in a Single Switch Topology
+12.1.1		MT Bonding Mode Selection for Single Switch Topology
+12.1.2		MT Link Monitoring for Single Switch Topology
+12.2	Maximum Throughput in a Multiple Switch Topology
+12.2.1		MT Bonding Mode Selection for Multiple Switch Topology
+12.2.2		MT Link Monitoring for Multiple Switch Topology
 
-14. Switch Behavior Issues
-14.1	Link Establishment and Failover Delays
-14.2	Duplicated Incoming Packets
+13. Switch Behavior 

Re: [patch 06/17] neighbour.c, pneigh_get_next() skips published entry

2006-06-08 Thread Jari Takkala

On Mon, 5 Jun 2006, David Miller wrote:

 This patch doesn't make any sense, I've been over it a few times.
 
 The seqfile layer should take care of that user buffering issue
transparently as
 long as we implement the interface callbacks properly.

 Even if something needs to be fixed in the pneigh dumper, special
casing *pos==1
 doesn't look right.  Also, if pneigh has this problem, how come the
neigh seqfile
 iterators don't have the same problem or do they?

From my analysis, the problem is that pneigh_get_next() ends up
assigning pn to one entry ahead of what it should be pointing too. This
only occurs when the user's read buffer fills up, where pneigh_get_idx()
is called, which calls pneigh_get_next() until *pos is not true.

I have not checked neigh seqfile iterators, the problem may exist in
there as well. My patch solves this issue for us, however a more elegant
solution would be most welcome.  Could the root of the problem be that
*pos is off by one when pneigh_get_idx() is called?

Jari

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] e1000: fix netpoll with NAPI

2006-06-08 Thread John W. Linville
On Thu, Jun 08, 2006 at 10:23:56AM -0700, Mitch Williams wrote:
 On Wed, 2006-06-07 at 11:54 -0700, John W. Linville wrote:
 
  Pedantic objection, but I think this would read easier w/o the extra
  newline before disable_irq.
 
 Heh.  I prefer to have a newline between declarations and code.  The

Normally I would agree.  But in this case, I find the distraction of
the random newline after the #else to be more compelling.

 real problem is the position of the #ifdef -- that's what makes it
 difficult to read.  The other solution would be
 {
 struct e1000_adapter *adapter = netdev_priv(netdev);
 #ifdef CONFIG_E1000_NAPI
   int budget = 0;
 #endif
 
   disable_irq(adapter-pdev-irq);
 
 #ifdef CONFIG_E1000_NAPI
all that stuff 
 #else
   rest of the stuff 
 #endif
 }
 
 Which I think is worse to read.

I presume it is the double #ifdef that you find objectionable?
I don't really like it, but at least that idiom is quite common.

Given that the disable_irq appears in both code paths (almost by
necessity), there is a certain appeal to having it outside of the
#ifdef block.  That seems more maintainable.

To me, the idiomatic #ifdef placement seems more readable, if for no
other reason than familiarity.  I suppose we can agree to disagree.

John
-- 
John W. Linville
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Firewall question

2006-06-08 Thread Alex Davis
The scenario:
I have a DSL modem in pass through (bridge) mode. The linux firewall/router 
has a single ethernet card.  It is running pppoe. This gives two interfaces: 
eth0 and ppp0. The firewall is running iptables. There are several machines 
behind the firewall.

Problem:
I've been told that if someone whose public IP address is on the same
network subnet as mine were to get my mac address, (s)he could bypass
the firewall and talk directly to the machines behind it.

Is this true?

Thanks.


I code, therefore I am

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Bugme-new] [Bug 6666] New: invalid tcp socket connection to windows stacks

2006-06-08 Thread David Miller

FIN only gets output when the connection is actually closed
for sending, and that is controlled by the application not
by the kernel.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Firewall question

2006-06-08 Thread Lennart Sorensen
On Thu, Jun 08, 2006 at 11:57:12AM -0700, Alex Davis wrote:
 The scenario:
 I have a DSL modem in pass through (bridge) mode. The linux firewall/router 
 has a single ethernet card.  It is running pppoe. This gives two interfaces: 
 eth0 and ppp0. The firewall is running iptables. There are several machines 
 behind the firewall.
 
 Problem:
 I've been told that if someone whose public IP address is on the same
 network subnet as mine were to get my mac address, (s)he could bypass
 the firewall and talk directly to the machines behind it.
 
 Is this true?

Well the DSL modem only transfers whatever data the ISP end sends to it,
which in your case is just PPP packets (LCC or LCP I think).  No one out
on the internet would be able to send ethernet data over the DSL link,
so the only way to send data to another machine on your network (that
the DSL modem is connected to physically) is if you have other machines
on your local network which are also running PPPoE and listening for
that traffic.

So the worst thing I can see happening is that someone on your local
network could potentially take over your PPPoE session, but that's about
it.  I just can't see anything else that could happen.  I used to run
exactly the setup you describe before I had to drop the DSL connection
(I moved).

Len Sorensen
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread David Miller
From: Gerrit Renker [EMAIL PROTECTED]
Date: Thu, 8 Jun 2006 12:22:54 +0100

 I am sorry, I don't at the moment have the time to port to v6 with the
 same degree of rigour. 

You give the impression that you would just disappear from the face of
the planet should your work actually be integrated into the kernel
tree.

So I can only assume that you are posting this for people to play
around with, and not for serious consideration of inclusion into the
kernel tree.

We're trying to avoid this serious problem we have where a group or
individual submits on a piece of code, works just hard enough to get
it integrated into the tree, then disappears and does not stick around
to support the inevitable ensuing bugs and problem reports.  Such
behavior is totally irresponsible, yet it happens quite a bit.

So if you can't be bothered to cook up IPV6 support, chances are you
won't stick around to support your code if it went into the tree
either.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread David Miller
From: Gerrit Renker [EMAIL PROTECTED]
Date: Thu, 8 Jun 2006 17:03:54 +0100

 Understood. Please, anyone, disregard or un-apply the previous
 UDP-Lite patch.  A revised patch will be prepared and posted as soon
 as testing permits.

Nobody is going to integrate your patch anywhere, don't worry.
You make it clear that once you toss this piece of code over
the wall, you'll disappear.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Using netconsole for debugging suspend/resume

2006-06-08 Thread Jeremy Fitzhardinge
I've been trying to get suspend/resume working well on my new laptop.  
In general, netconsole has been pretty useful for extracting oopses and 
other messages, but it is of more limited help in debugging the actual 
suspend/resume cycle.  The problem looks like the e1000 driver won't 
suspend while netconsole is using it, so I have to rmmod/modprobe 
netconsole around the actual suspend/resume.


This is a big problem during resume because the screen is also blank, so 
I get no useful clue as to what went wrong when things go wrong.  I'm 
wondering if there's some way to keep netconsole alive to the last 
possible moment during suspend, and re-woken as soon as possible during 
resume.  It would be nice to have a clean solution, but I'm willing to 
use a bletcherous hack if that's what it takes.


Any ideas?

Thanks,
   J

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jeff Garzik

Jon Loeliger wrote:

Signed-off-by: Kriston Carson [EMAIL PROTECTED]
Signed-off-by: Xianghua Xiao [EMAIL PROTECTED]
Signed-off-by: Jon Loeliger [EMAIL PROTECTED]


ACK, but patch does not apply to netdev-2.6.git#upstream.

Jeff



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] skge: use workq for PHY handling

2006-06-08 Thread Jeff Garzik

applied 1-5 to #upstream


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Please pull 'upstream-fixes' branch of wireless-2.6

2006-06-08 Thread Jeff Garzik

John W. Linville wrote:

This pull is intended for 2.6.17 if at all possible.

Thanks,

John

---

The following changes since commit 672c6108a51bf559d19595d9f8193dfd81f0f752:
  Linus Torvalds:
Merge master.kernel.org:/.../jejb/scsi-rc-fixes-2.6

are found in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git 
upstream-fixes


pulled


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Please pull 'upstream' branch of wireless-2.6

2006-06-08 Thread Jeff Garzik

John W. Linville wrote:

This pull is intended for 2.6.18.

Thanks,

John

---

The following changes since commit f6882a0688ea83db5fc2f3491ac9fcdce0834cc7:
  John W. Linville:
Merge branch 'upstream-fixes' into upstream

are found in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git 
upstream


applied

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread James Morris
On Thu, 8 Jun 2006, David Miller wrote:

  Understood. Please, anyone, disregard or un-apply the previous
  UDP-Lite patch.  A revised patch will be prepared and posted as soon
  as testing permits.
 
 Nobody is going to integrate your patch anywhere, don't worry.
 You make it clear that once you toss this piece of code over
 the wall, you'll disappear.

Having dealt with more than enough code thrown over the wall in recent 
times, I agree.

But, if someone well known  trusted wants to claim responsibility for the 
code once it's upstream, that might be a way forward (I think the Apache 
project has or had a policy like this).



- James
-- 
James Morris
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread Gerrit Renker
Quoting James Morris:
|  On Thu, 8 Jun 2006, David Miller wrote:
|  
|Understood. Please, anyone, disregard or un-apply the previous
|UDP-Lite patch.  A revised patch will be prepared and posted as soon
|as testing permits.
|   
|   Nobody is going to integrate your patch anywhere, don't worry.
|   You make it clear that once you toss this piece of code over
|   the wall, you'll disappear.
|  
|  Having dealt with more than enough code thrown over the wall in recent 
|  times, I agree.

I understand the points of both of you well enough. But how come this is 
interpreted 
as saying I'd toss this piece of code over the wall? I can understand getting 
tired 
of cowboy coding jobs, but there is a misunderstanding here.

Of course do and will I maintain that code and every issue related it. I have 
been
maintaining, improving, testing this code for 9 months. The protocol spec (RFC 
3828)
was developed at University of Aberdeen, and there is continuing research into 
UDP-Lite here, i.e. it is not a `dead' project. That is why I held back 
regarding the 
IPv6 port: I can ensure that this (IPv4) code is up to standard and to date, 
but am 
lacking the required additional time to implement the same for IPv6. 
I am trying to contact people to help with the port, but for the moment I will 
take 
responsibility only for the IPv4 version.

And if there is someone `well-known and respected' who is interested in taking 
this code 
over, I would only be happy for him/her to do this. But I won't simply 
`disappear' :-)






-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger
On Thu, 2006-06-08 at 14:34, Jeff Garzik wrote:
 Jon Loeliger wrote:
  Signed-off-by: Kriston Carson [EMAIL PROTECTED]
  Signed-off-by: Xianghua Xiao [EMAIL PROTECTED]
  Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
 
 ACK, but patch does not apply to netdev-2.6.git#upstream.
 
   Jeff

Thanks, Jeff.

Are you willing to take the netdev parts as-is, then?
Or would you like me to reformat the netdev parts to
apply against the netdev-2.6.git#upstream branch?
The patch is currently for the Paul Mackerras powerpc.git
tree as it stands now.  Should we apply it through that
path now as you have ACK'ed it?

Thanks,
jdl


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jeff Garzik

Jon Loeliger wrote:

On Thu, 2006-06-08 at 14:34, Jeff Garzik wrote:

Jon Loeliger wrote:

Signed-off-by: Kriston Carson [EMAIL PROTECTED]
Signed-off-by: Xianghua Xiao [EMAIL PROTECTED]
Signed-off-by: Jon Loeliger [EMAIL PROTECTED]

ACK, but patch does not apply to netdev-2.6.git#upstream.

Jeff


Thanks, Jeff.

Are you willing to take the netdev parts as-is, then?
Or would you like me to reformat the netdev parts to
apply against the netdev-2.6.git#upstream branch?
The patch is currently for the Paul Mackerras powerpc.git
tree as it stands now.  Should we apply it through that
path now as you have ACK'ed it?


Is it dependent on other stuff in Paul's tree?

Normally this should come through netdev-2.6.git#upstream...

Jeff



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jeff Garzik

Jon Loeliger wrote:

On Thu, 2006-06-08 at 15:36, Jeff Garzik wrote:

Is it dependent on other stuff in Paul's tree?


Yes, very much so.  Most of this patch set is an
entirely new PPC board port against his arch/powerpc
basis.  The new PHY is incidentally on that board,
but the patches for its introduction could be
introduced through the netdev tree if needed.
It would just need to be coordinated some.  I am,
of course, willing to work it either way as needed.


I leave it up to you and Paul to coordinate, then :)

I'm fine with the patch, and if its better to merge via linuxppc.git, 
that's OK with me.  If you would prefer to send it via my tree, to go 
ahead and get it in, that's fine too.


Jeff



-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger
On Thu, 2006-06-08 at 15:36, Jeff Garzik wrote:
 Is it dependent on other stuff in Paul's tree?

Yes, very much so.  Most of this patch set is an
entirely new PPC board port against his arch/powerpc
basis.  The new PHY is incidentally on that board,
but the patches for its introduction could be
introduced through the netdev tree if needed.
It would just need to be coordinated some.  I am,
of course, willing to work it either way as needed.

jdl


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger
On Thu, 2006-06-08 at 15:46, Jeff Garzik wrote:

 I leave it up to you and Paul to coordinate, then :)
 
 I'm fine with the patch, and if its better to merge via linuxppc.git, 
 that's OK with me.  If you would prefer to send it via my tree, to go 
 ahead and get it in, that's fine too.

OK, thanks.  I need to re-submit 5 of 10 parts for
other cleanup issues anyway, so I think I will:

- Resubmit the entire patch set,
- Resubmit netdev parts to Paul, and netdev with
  an added ACK: by you line (OK?),
- Throw myself on the mercy of Help us Obi-wan Mackerras
  and see what he says when he wakes up!

Thanks!
jdl


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Using netconsole for debugging suspend/resume

2006-06-08 Thread Rafael J. Wysocki
On Thursday 08 June 2006 19:50, Jeremy Fitzhardinge wrote:
 I've been trying to get suspend/resume working well on my new laptop.  
 In general, netconsole has been pretty useful for extracting oopses and 
 other messages, but it is of more limited help in debugging the actual 
 suspend/resume cycle.  The problem looks like the e1000 driver won't 
 suspend while netconsole is using it, so I have to rmmod/modprobe 
 netconsole around the actual suspend/resume.
 
 This is a big problem during resume because the screen is also blank, so 
 I get no useful clue as to what went wrong when things go wrong.  I'm 
 wondering if there's some way to keep netconsole alive to the last 
 possible moment during suspend, and re-woken as soon as possible during 
 resume.  It would be nice to have a clean solution, but I'm willing to 
 use a bletcherous hack if that's what it takes.
 
 Any ideas?

Please try doing echo 8  /proc/sys/kernel/printk before suspend.

Greetings,
Rafael
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jeff Garzik

Jon Loeliger wrote:

On Thu, 2006-06-08 at 15:46, Jeff Garzik wrote:


I leave it up to you and Paul to coordinate, then :)

I'm fine with the patch, and if its better to merge via linuxppc.git, 
that's OK with me.  If you would prefer to send it via my tree, to go 
ahead and get it in, that's fine too.


OK, thanks.  I need to re-submit 5 of 10 parts for
other cleanup issues anyway, so I think I will:

- Resubmit the entire patch set,
- Resubmit netdev parts to Paul, and netdev with
  an added ACK: by you line (OK?),


OK with me.  Since we use a specific header to indicate such, that would be:

Acked-by: Jeff Garzik [EMAIL PROTECTED]


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: New tulip maintainer...

2006-06-08 Thread Valerie Henson

On 6/8/06, Grant Grundler [EMAIL PROTECTED] wrote:

On Thu, Jun 08, 2006 at 11:41:28AM -0400, Jeff Garzik wrote:
 Now that we have a new tulip maintainer, perhaps a resend of the
 long-outstanding tulip phy patches could be resent?

All the tulip patches I have are archived here:
ftp://ftp.parisc-linux.org/patches/

Anything else tulip I've been involved with is available
via CVS from cvs.parisc-linux.org/linux-2.6/

Thibaut Varene has also committed his changes to that CVS.


Hey folks,

Just a quick note to say that, yes, in a moment of weak-willed
delusion, I did let Jeff pressure me into becoming the tulip
maintainer.  I will accept tokens of condolence in the form of beer,
money, and old tulip cards (email me for my shipping address).

I'm going to be a tiny bit busy the next couple of weeks - minor
things like running the file systems workshop and moving house - but I
am paying attention and will start testing and shipping patches as
soon as possible.

One quick note: please use my spiffy [EMAIL PROTECTED]
address (see From: address) for Linux stuff.  Besides giving props to
my employer, it's much easier to send/receive patches from that
account.

-VAL
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT] Realtek 8168 ethernet support

2006-06-08 Thread Randy.Dunlap
On Thu,  1 Jun 2006 21:02:00 +0100 (BST) Daniel Drake wrote:

 I've produced this patch which should allow the r8169 driver to work with the
 new Realtek 8168 chips. These are found in PCI-Express form and onboard some
 newer motherboards.
 
 Does anyone own this hardware? I'm looking for someone to test it before I
 send it on.
 
 Signed-off-by: Daniel Drake [EMAIL PROTECTED]
 
 Index: linux/drivers/net/r8169.c
 ===
 --- linux.orig/drivers/net/r8169.c
 +++ linux/drivers/net/r8169.c
 @@ -184,6 +184,7 @@ static const struct {
  
  static struct pci_device_id rtl8169_pci_tbl[] = {
   { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), },
 + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), },
   { PCI_DEVICE(PCI_VENDOR_ID_DLINK,   0x4300), },
   { PCI_DEVICE(0x16ec,0x0116), },
   { PCI_VENDOR_ID_LINKSYS,0x1032, PCI_ANY_ID, 0x0024, },


The (GPL) RealTek driver (from
http://www.realtek.com.tw/downloads/downloads1-3.aspx?lineid=1famid=4series=2003072Software=True)
contains this PCI device table:

static struct pci_device_id r1000_pci_tbl[] __devinitdata = {
{ 0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0x10ec, 0x8167, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0x10ec, 0x8168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ 0x10ec, 0x8136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{0,}
};

Any reason not to include all of those?
Conversely, any reason to use the RealTek r1000 driver?


 @@ -1398,6 +1399,7 @@ rtl8169_init_board(struct pci_dev *pdev,
   struct net_device *dev;
   struct rtl8169_private *tp;
   int rc = -ENOMEM, i, acpi_idle_state = 0, pm_cap;
 + u32 mmio_base = 0;
  
   assert(ioaddr_out != NULL);
  
 @@ -1442,20 +1444,24 @@ rtl8169_init_board(struct pci_dev *pdev,
   }
   }
  
 - /* make sure PCI base addr 1 is MMIO */
 - if (!(pci_resource_flags(pdev, 1)  IORESOURCE_MEM)) {
 - if (netif_msg_probe(tp)) {
 - printk(KERN_ERR PFX
 -region #1 not an MMIO resource, aborting\n);
 - }
 - rc = -ENODEV;
 - goto err_out_mwi;
 + /* find MMIO resource: this varies between 8168 and 8169 */
 + for (i = 0; i  5; i++) {
 + /* check resource type */
 + if (!(pci_resource_flags(pdev, i)  IORESOURCE_MEM))
 + continue;
 +
 + /* check for weird/broken PCI region reporting */
 + if (pci_resource_len(pdev, i)  R8169_REGS_SIZE)
 + continue;
 +
 + mmio_base = pci_resource_start(pdev, i);
 + break;
   }
 - /* check for weird/broken PCI region reporting */
 - if (pci_resource_len(pdev, 1)  R8169_REGS_SIZE) {
 +
 + if (mmio_base == 0) {
   if (netif_msg_probe(tp)) {
   printk(KERN_ERR PFX
 -Invalid PCI region size(s), aborting\n);
 +couldn't find valid MMIO resource, aborting\n);
   }
   rc = -ENODEV;
   goto err_out_mwi;
 @@ -1490,7 +1496,7 @@ rtl8169_init_board(struct pci_dev *pdev,
   pci_set_master(pdev);
  
   /* ioremap MMIO region */
 - ioaddr = ioremap(pci_resource_start(pdev, 1), R8169_REGS_SIZE);
 + ioaddr = ioremap(mmio_base, R8169_REGS_SIZE);
   if (ioaddr == NULL) {
   if (netif_msg_probe(tp))
   printk(KERN_ERR PFX cannot remap MMIO, aborting\n);
 -

---
~Randy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[git patches] net driver fixes

2006-06-08 Thread Jeff Garzik

Just got back from travelling, and am catching up.  Thanks to Andrew for
working with me via email while I was on the road, he pushed a couple
patches already for me.

Here are the netdev fixes that were in my 'Pending' folder.  I've got a
couple libata fixes to push as well, those may not come until tomorrow.

Please pull from 'upstream-fixes' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git

to receive the following updates:

 drivers/net/e1000/e1000_ethtool.c  |5 +++-
 drivers/net/e1000/e1000_main.c |8 +--
 drivers/net/wireless/bcm43xx/bcm43xx_dma.c |   31 -
 3 files changed, 28 insertions(+), 16 deletions(-)

Auke Kok:
  e1000: fix ethtool test irq alloc as probe
  e1000: remove risky prefetch on next_skb-data

Michael Buesch:
  bcm43xx: add DMA rx poll workaround to DMA4

diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index ea3..d1c705b 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -870,13 +870,16 @@ e1000_intr_test(struct e1000_adapter *ad
*data = 0;
 
/* Hook up test interrupt handler just for this test */
-   if (!request_irq(irq, e1000_test_intr, 0, netdev-name, netdev)) {
+   if (!request_irq(irq, e1000_test_intr, SA_PROBEIRQ, netdev-name,
+netdev)) {
shared_int = FALSE;
} else if (request_irq(irq, e1000_test_intr, SA_SHIRQ,
  netdev-name, netdev)){
*data = 1;
return -1;
}
+   DPRINTK(PROBE,INFO, testing %s interrupt\n,
+   (shared_int ? shared : unshared));
 
/* Disable all the interrupts */
E1000_WRITE_REG(adapter-hw, IMC, 0x);
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index ed15fca..97e71a4 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3519,7 +3519,7 @@ #endif
buffer_info = rx_ring-buffer_info[i];
 
while (rx_desc-status  E1000_RXD_STAT_DD) {
-   struct sk_buff *skb, *next_skb;
+   struct sk_buff *skb;
u8 status;
 #ifdef CONFIG_E1000_NAPI
if (*work_done = work_to_do)
@@ -3537,8 +3537,6 @@ #endif
prefetch(next_rxd);
 
next_buffer = rx_ring-buffer_info[i];
-   next_skb = next_buffer-skb;
-   prefetch(next_skb-data - NET_IP_ALIGN);
 
cleaned = TRUE;
cleaned_count++;
@@ -3668,7 +3666,7 @@ #endif
struct e1000_buffer *buffer_info, *next_buffer;
struct e1000_ps_page *ps_page;
struct e1000_ps_page_dma *ps_page_dma;
-   struct sk_buff *skb, *next_skb;
+   struct sk_buff *skb;
unsigned int i, j;
uint32_t length, staterr;
int cleaned_count = 0;
@@ -3697,8 +3695,6 @@ #endif
prefetch(next_rxd);
 
next_buffer = rx_ring-buffer_info[i];
-   next_skb = next_buffer-skb;
-   prefetch(next_skb-data - NET_IP_ALIGN);
 
cleaned = TRUE;
cleaned_count++;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c 
b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
index bbecba0..d0318e5 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c
@@ -624,25 +624,28 @@ err_destroy_tx0:
 static u16 generate_cookie(struct bcm43xx_dmaring *ring,
   int slot)
 {
-   u16 cookie = 0x;
+   u16 cookie = 0xF000;
 
/* Use the upper 4 bits of the cookie as
 * DMA controller ID and store the slot number
-* in the lower 12 bits
+* in the lower 12 bits.
+* Note that the cookie must never be 0, as this
+* is a special value used in RX path.
 */
switch (ring-mmio_base) {
default:
assert(0);
case BCM43xx_MMIO_DMA1_BASE:
+   cookie = 0xA000;
break;
case BCM43xx_MMIO_DMA2_BASE:
-   cookie = 0x1000;
+   cookie = 0xB000;
break;
case BCM43xx_MMIO_DMA3_BASE:
-   cookie = 0x2000;
+   cookie = 0xC000;
break;
case BCM43xx_MMIO_DMA4_BASE:
-   cookie = 0x3000;
+   cookie = 0xD000;
break;
}
assert(((u16)slot  0xF000) == 0x);
@@ -660,16 +663,16 @@ struct bcm43xx_dmaring * parse_cookie(st
struct bcm43xx_dmaring *ring = NULL;
 
switch (cookie  0xF000) {
-   case 0x:
+   case 0xA000:
ring = dma-tx_ring0;
break;
-   case 0x1000:
+   case 0xB000:
ring = dma-tx_ring1;
break;
-   case 0x2000:
+   case 0xC000:
ring = dma-tx_ring2;
break;

[PATCH 8/10] Add Vitesse 8244 PHY for MPC8641 HPCN platform.

2006-06-08 Thread Jon Loeliger

Signed-off-by: Kriston Carson [EMAIL PROTECTED]
Signed-off-by: Xianghua Xiao [EMAIL PROTECTED]
Signed-off-by: Jon Loeliger [EMAIL PROTECTED]
Acked-by: Jeff Garzik [EMAIL PROTECTED]

---

 drivers/net/Kconfig   |6 +-
 drivers/net/phy/Kconfig   |5 ++
 drivers/net/phy/Makefile  |1 
 drivers/net/phy/vitesse.c |  112 +
 4 files changed, 121 insertions(+), 3 deletions(-)


diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index bdaaad8..c1c2758 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2179,11 +2179,11 @@ config SPIDER_NET
 
 config GIANFAR
tristate Gianfar Ethernet
-   depends on 85xx || 83xx
+   depends on 85xx || 83xx || PPC_86xx
select PHYLIB
help
- This driver supports the Gigabit TSEC on the MPC85xx 
- family of chips, and the FEC on the 8540
+ This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
+ and MPC86xx family of chips, and the FEC on the 8540.
 
 config GFAR_NAPI
bool NAPI Support
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index fa39b94..76e51b1 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -44,6 +44,11 @@ config CICADA_PHY
depends on PHYLIB
---help---
  Currently supports the cis8204
+config VITESSE_PHY
+tristate Drivers for the Vitesse PHYs
+depends on PHYLIB
+---help---
+  Currently supports the vsc8244
 
 endmenu
 
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index e4116a5..a8d066e 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_DAVICOM_PHY)   += davicom.o
 obj-$(CONFIG_CICADA_PHY)   += cicada.o
 obj-$(CONFIG_LXT_PHY)  += lxt.o
 obj-$(CONFIG_QSEMI_PHY)+= qsemi.o
+obj-$(CONFIG_VITESSE_PHY)  += vitesse.o
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c
new file mode 100644
index 000..ffd215d
--- /dev/null
+++ b/drivers/net/phy/vitesse.c
@@ -0,0 +1,112 @@
+/*
+ * Driver for Vitesse PHYs
+ *
+ * Author: Kriston Carson
+ *
+ * Copyright (c) 2005 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/mii.h
+#include linux/ethtool.h
+#include linux/phy.h
+
+/* Vitesse Extended Control Register 1 */
+#define MII_VSC8244_EXT_CON1   0x17
+#define MII_VSC8244_EXTCON1_INIT   0x
+
+/* Vitesse Interrupt Mask Register */
+#define MII_VSC8244_IMASK  0x19
+#define MII_VSC8244_IMASK_IEN  0x8000
+#define MII_VSC8244_IMASK_SPEED0x4000
+#define MII_VSC8244_IMASK_LINK 0x2000
+#define MII_VSC8244_IMASK_DUPLEX   0x1000
+#define MII_VSC8244_IMASK_MASK 0xf000
+
+/* Vitesse Interrupt Status Register */
+#define MII_VSC8244_ISTAT  0x1a
+#define MII_VSC8244_ISTAT_STATUS   0x8000
+#define MII_VSC8244_ISTAT_SPEED0x4000
+#define MII_VSC8244_ISTAT_LINK 0x2000
+#define MII_VSC8244_ISTAT_DUPLEX   0x1000
+
+/* Vitesse Auxiliary Control/Status Register */
+#define MII_VSC8244_AUX_CONSTAT0x1c
+#define MII_VSC8244_AUXCONSTAT_INIT0x0004
+#define MII_VSC8244_AUXCONSTAT_DUPLEX  0x0020
+#define MII_VSC8244_AUXCONSTAT_SPEED   0x0018
+#define MII_VSC8244_AUXCONSTAT_GBIT0x0010
+#define MII_VSC8244_AUXCONSTAT_100 0x0008
+
+MODULE_DESCRIPTION(Vitesse PHY driver);
+MODULE_AUTHOR(Kriston Carson);
+MODULE_LICENSE(GPL);
+
+static int vsc824x_config_init(struct phy_device *phydev)
+{
+   int err;
+
+   err = phy_write(phydev, MII_VSC8244_AUX_CONSTAT,
+   MII_VSC8244_AUXCONSTAT_INIT);
+   if (err  0)
+   return err;
+
+   err = phy_write(phydev, MII_VSC8244_EXT_CON1,
+   MII_VSC8244_EXTCON1_INIT);
+   return err;
+}
+
+static int vsc824x_ack_interrupt(struct phy_device *phydev)
+{
+   int err = phy_read(phydev, MII_VSC8244_ISTAT);
+
+   return (err  0) ? err : 0;
+}
+
+static int vsc824x_config_intr(struct phy_device *phydev)
+{
+   int err;
+
+   if (phydev-interrupts == PHY_INTERRUPT_ENABLED)
+   err = phy_write(phydev, MII_VSC8244_IMASK,
+   MII_VSC8244_IMASK_MASK);
+   else
+   err = phy_write(phydev, MII_VSC8244_IMASK, 0);
+   return err;
+}
+
+/* Vitesse 824x */
+static struct phy_driver vsc8244_driver = {
+   .phy_id = 0x000fc6c2,
+   .name   = Vitesse VSC8244,
+   .phy_id_mask= 0x000fffc0,
+   .features   = PHY_GBIT_FEATURES,
+   .flags 

Re: [PATCH 2.6.17-rc6-mm1 ] net: RFC 3828-compliant UDP-Lite support

2006-06-08 Thread David Miller
From: Gerrit Renker [EMAIL PROTECTED]
Date: Thu, 8 Jun 2006 21:09:33 +0100

 That is why I held back regarding the IPv6 port: I can ensure that
 this (IPv4) code is up to standard and to date, but am lacking the
 required additional time to implement the same for IPv6.  I am
 trying to contact people to help with the port, but for the moment I
 will take responsibility only for the IPv4 version.

It's not like an ipv6 port is such a big pile of work.

I'd say it would take you an afternoon, max.

You don't have to test it to the point where it is ISO9000 compliant,
that's not what is being asked of you.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV6]: Fix RTNLGRP_IPV6_IFINFO netlink notifications

2006-06-08 Thread Patrick McHardy
[IPV6]: Fix RTNLGRP_IPV6_IFINFO netlink notifications

The allocated skb is too small for the message, which results in an EINVAL
getting reported to the (innocent) multicast listeners.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

---
commit f71bc8ace692302ad3a80d84b8cbccbb14e88fe5
tree 21ccfa89e911ff8e6bda04ab817367f2ac4e3173
parent 1def630a6a49dda5bc89dfbd86656293640456f0
author Patrick McHardy [EMAIL PROTECTED] Wed, 07 Jun 2006 09:25:26 +0200
committer Patrick McHardy [EMAIL PROTECTED] Wed, 07 Jun 2006 09:25:26 +0200

 net/ipv6/addrconf.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 445006e..cc81cab 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3235,8 +3235,7 @@ static int inet6_dump_ifinfo(struct sk_b
 void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
 {
struct sk_buff *skb;
-   /* 128 bytes ?? */
-   int size = NLMSG_SPACE(sizeof(struct ifinfomsg)+128);
+   int size = NLMSG_SPACE(sizeof(struct ifinfomsg)+172);

skb = alloc_skb(size, GFP_ATOMIC);
if (!skb) {


Re: Netchannels: netchannel vs. socket. 2:0.

2006-06-08 Thread Hans Henrik Happe
On Thursday 08 June 2006 19:15, you wrote:
 After some enhancements made for netchannel subsystem I'm pleased to
 announce, that netchannel subsystem outperforms existing layered design
 both in CPU usage and network speed.
 
 Well, after such pretentious introduction I want to cool things down.
 CPU usage is about 1-2% less for netchannels and network performance is
 about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, 
 is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).

I have followed your work closely and have wondered how it affects latency?
I have somewhat limited knowledge about TCP and how the kernel handles it, but 
I guess the path from NIC to userspace hasn't increased. What about syscall 
overhead caused by userspace TCP processing?

H³  

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


netif_tx_disable vs netif_stop_queue (possible races?)

2006-06-08 Thread Daniel Drake

Hi,

In order to avoid disconnect races in ZD1211, I'm trying to convince 
myself that other USB network drivers are race-free (and why).


I brought up a possible issue in usbnet with David Brownell, but it 
appears neither of us are 100% clear on the details, so it would be good 
to get some extra clarification.


USB devices can be yanked out by the user at *any* time, and typically 
free_netdev is called in the disconnect handler, which frees all 
device-specific structures.


The issue I brought up is that code using these structures may be 
running concurrently on another CPU when the disconnect handler is 
invoked, resulting in access to freed data.


More specifically, we're talking about drivers/usb/net/usbnet.c and the 
usbnet_disconnect() function.  The race I am highlighting is that 
usbnet's hard_start_xmit handler (usbnet_start_xmit) may be running when 
the disconnect happens.


Is this a possible scenario?

My thoughts on avoiding this are to ensure that the TX queue is stopped 
and all current transmissions in usbnet_stop (the netdev-stop hook). I 
understand that the stop function is called during disconnect, because 
usbnet_disconnect() calls unregister_netdev(). The stop function already 
has a call to netif_stop_queue but (based on my knowledge from LDD3) 
this is not enough.


My understanding is that netif_stop_queue() should be used only inside a 
hard_start_xmit function, when it wants to make sure that no more 
transmissions are started until the queue is reopened.


I suggested that we use netif_tx_disable here, which is effectively the 
same but because it takes the lock, it guarantees that no 
hard_start_xmit transmissions are running on any CPU when it returns.


David pointed out that netif_tx_disable is rarely used, and a large 
number of drivers call netif_stop_queue in their stop function, so if 
what I suggest is true, there may be many such potential races 
elsewhere. Am I missing something simple?


Thanks,
Daniel
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT] Realtek 8168 ethernet support

2006-06-08 Thread Francois Romieu
Randy.Dunlap [EMAIL PROTECTED] :
[...]
 static struct pci_device_id r1000_pci_tbl[] __devinitdata = {
   { 0x10ec, 0x8169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
   { 0x10ec, 0x8167, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
   { 0x10ec, 0x8168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
   { 0x10ec, 0x8136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
   {0,}
 };
 
 Any reason not to include all of those?

Nothing worrying:
- 0x8167 and 0x8168 use a different PCI region;
- some phy differences. They appear when the r1000 driver is
  compared to the previous r8169 driver from realtek.

I'll pack it with other changes.

 Conversely, any reason to use the RealTek r1000 driver?

Feel free to read it and make your own mind.

-- 
Ueimor
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [IPV6]: Fix RTNLGRP_IPV6_IFINFO netlink notifications

2006-06-08 Thread YOSHIFUJI Hideaki / 吉藤英明
Hello.

In article [EMAIL PROTECTED] (at Fri, 09 Jun 2006 00:56:46 +0200), Patrick 
McHardy [EMAIL PROTECTED] says:

Okay, thanks.
I think it is better to eliminate these magic numbers.

How about this?

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 445006e..b5267c6 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2860,6 +2860,11 @@ inet6_rtm_newaddr(struct sk_buff *skb, s
return inet6_addr_add(ifm-ifa_index, pfx, ifm-ifa_prefixlen);
 }
 
+/* Maximum length of ifa_cacheinfo attributes */
+#define INET6_IFADDR_RTA_SPACE \
+   RTA_SPACE(16) /* IFA_ADDRESS */ + \
+   RTA_SPACE(sizeof(struct ifa_cacheinfo)) /* CACHEINFO */
+
 static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa,
 u32 pid, u32 seq, int event, unsigned int flags)
 {
@@ -3092,7 +3097,7 @@ static int inet6_dump_ifacaddr(struct sk
 static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
 {
struct sk_buff *skb;
-   int size = NLMSG_SPACE(sizeof(struct ifaddrmsg)+128);
+   int size = NLMSG_SPACE(sizeof(struct ifaddrmsg) + 
INET6_IFADDR_RTA_SPACE);
 
skb = alloc_skb(size, GFP_ATOMIC);
if (!skb) {
@@ -3142,6 +3147,16 @@ static void inline ipv6_store_devconf(st
 #endif
 }
 
+/* Maximum length of ifinfomsg attributes */
+#define INET6_IFINFO_RTA_SPACE \
+   RTA_SPACE(IFNAMSIZ) /* IFNAME */ + \
+   RTA_SPACE(MAX_ADDR_LEN) /* ADDRESS */ + \
+   RTA_SPACE(sizeof(u32)) /* MTU */ + \
+   RTA_SPACE(0) /* PROTINFO */ + \
+   RTA_SPACE(sizeof(u32)) /* FLAGS */ + \
+   RTA_SPACE(sizeof(struct ifla_cacheinfo)) /* CACHEINFO */ + \
+   RTA_SPACE(sizeof(__s32[DEVCONF_MAX])) /* CONF */
+
 static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev, 
 u32 pid, u32 seq, int event, unsigned int flags)
 {
@@ -3235,8 +3250,7 @@ static int inet6_dump_ifinfo(struct sk_b
 void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
 {
struct sk_buff *skb;
-   /* 128 bytes ?? */
-   int size = NLMSG_SPACE(sizeof(struct ifinfomsg)+128);
+   int size = NLMSG_SPACE(sizeof(struct ifinfomsg) + 
INET6_IFINFO_RTA_SPACE);

skb = alloc_skb(size, GFP_ATOMIC);
if (!skb) {
@@ -3252,6 +3266,11 @@ void inet6_ifinfo_notify(int event, stru
netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV6_IFINFO, GFP_ATOMIC);
 }
 
+/* Maximum length of prefix_cacheinfo attributes */
+#define INET6_PREFIX_RTA_SPACE \
+   RTA_SPACE(sizeof(((struct prefix_info *)NULL)-prefix)) /* 
ADDRESS */ + \
+   RTA_SPACE(sizeof(struct prefix_cacheinfo)) /* CACHEINFO */
+
 static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
struct prefix_info *pinfo, u32 pid, u32 seq, 
int event, unsigned int flags)
@@ -3296,7 +3315,7 @@ static void inet6_prefix_notify(int even
 struct prefix_info *pinfo)
 {
struct sk_buff *skb;
-   int size = NLMSG_SPACE(sizeof(struct prefixmsg)+128);
+   int size = NLMSG_SPACE(sizeof(struct prefixmsg) + 
INET6_PREFIX_RTA_SPACE);
 
skb = alloc_skb(size, GFP_ATOMIC);
if (!skb) {

-- 
YOSHIFUJI Hideaki @ USAGI Project  [EMAIL PROTECTED]
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT] Realtek 8168 ethernet support

2006-06-08 Thread Jeff Garzik

Randy.Dunlap wrote:

Conversely, any reason to use the RealTek r1000 driver?


FWIW, RealTek emailed me about merging r1000.  I suggested that, if the 
register sets were similar, that r8169 should be updated instead, to 
preserve compatibility with existing users (and not lose existing work).


Jeff


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFT] Realtek 8168 ethernet support

2006-06-08 Thread Randy.Dunlap
On Thu, 08 Jun 2006 22:40:05 -0400 Jeff Garzik wrote:

 Randy.Dunlap wrote:
  Conversely, any reason to use the RealTek r1000 driver?
 
 FWIW, RealTek emailed me about merging r1000.  I suggested that, if the 
 register sets were similar, that r8169 should be updated instead, to 
 preserve compatibility with existing users (and not lose existing work).

Sounds good to me.  I'm not terribly interested in seeing
multiple drivers for the same hardware in the kernel tree.

---
~Randy
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Using netconsole for debugging suspend/resume

2006-06-08 Thread Andi Kleen
On Thursday 08 June 2006 19:50, Jeremy Fitzhardinge wrote:
 I've been trying to get suspend/resume working well on my new laptop.  
 In general, netconsole has been pretty useful for extracting oopses and 
 other messages, but it is of more limited help in debugging the actual 
 suspend/resume cycle.  The problem looks like the e1000 driver won't 
 suspend while netconsole is using it, so I have to rmmod/modprobe 
 netconsole around the actual suspend/resume.

If your laptop has firewire you can also use firescope.
(ftp://ftp.suse.com/pub/people/ak/firescope/) 

 This is a big problem during resume because the screen is also blank, so 
 I get no useful clue as to what went wrong when things go wrong.  I'm 
 wondering if there's some way to keep netconsole alive to the last 
 possible moment during suspend, and re-woken as soon as possible during 
 resume.  It would be nice to have a clean solution, but I'm willing to 
 use a bletcherous hack if that's what it takes.

FW keeps running as long as nobody resets the ieee1394 chip.

Networking is much more complex and will likely never work well for such
low level debug situations. Netconsole is mostly useful to catch the
odd oops during runtime.

-Andi


-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Firewall question

2006-06-08 Thread Andi Kleen

 Well the DSL modem only transfers whatever data the ISP end sends to it,
 which in your case is just PPP packets (LCC or LCP I think).  No one out
 on the internet 

No one out on the internet, but it would be trivial for someone outside
his house. All his traffic will be on a long unsecured cable. 

That is why I would never bridge home ethernet traffic onto a DSL line.

-Andi

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] wan/sdla section fixes

2006-06-08 Thread Randy.Dunlap
From: Randy Dunlap [EMAIL PROTECTED]

Priority: tossup.
netdev-set_config can be called at any time, so these references
to __initdata would be a real problem.
However, problem has not been observed AFAIK.

Fix section mismatch warnings:
WARNING: drivers/net/wan/sdla.o - Section mismatch: reference to .init.data: 
from .text between 'sdla_set_config' (at offset 0x1b8e) and 'sdla_stats'
WARNING: drivers/net/wan/sdla.o - Section mismatch: reference to .init.data: 
from .text between 'sdla_set_config' (at offset 0x1e76) and 'sdla_stats'

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
---
 drivers/net/wan/sdla.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-2617-rc6.orig/drivers/net/wan/sdla.c
+++ linux-2617-rc6/drivers/net/wan/sdla.c
@@ -60,9 +60,9 @@
 
 static const char* version = SDLA driver v0.30, 12 Sep 1996, [EMAIL 
PROTECTED];
 
-static unsigned int valid_port[] __initdata = { 0x250, 0x270, 0x280, 0x300, 
0x350, 0x360, 0x380, 0x390};
+static unsigned int valid_port[] = { 0x250, 0x270, 0x280, 0x300, 0x350, 0x360, 
0x380, 0x390};
 
-static unsigned int valid_mem[]  __initdata = {
+static unsigned int valid_mem[] = {
0xA, 0xA2000, 0xA4000, 0xA6000, 
0xA8000, 0xAA000, 0xAC000, 0xAE000, 
 0xB, 0xB2000, 0xB4000, 0xB6000, 
0xB8000, 0xBA000, 0xBC000, 0xBE000,
 0xC, 0xC2000, 0xC4000, 0xC6000, 
0xC8000, 0xCA000, 0xCC000, 0xCE000,


---
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Using netconsole for debugging suspend/resume

2006-06-08 Thread Jeremy Fitzhardinge

Matt Mackall wrote:

That's odd. Netpoll holds a reference to the device, of course, but so
does a normal up interface. So that shouldn't be the problem.
Another possibility is that outgoing packets from printks in the
driver are causing difficulty. Not sure what can be done about that.
  
I only tried once; maybe I misunderstood what was going on.  I'll try 
again tonight.


Oh, I think I see what's happening.  The e1000 suspend routine does this:

if (netif_running(netdev))
e1000_down(adapter);

This leaves the interface up, but it stops the queue.  Then 
netpoll_send_skb() has this loop:


do {
npinfo-tries--;
spin_lock(np-dev-xmit_lock);
np-dev-xmit_lock_owner = smp_processor_id();

/*
 * network drivers do not expect to be called if the queue is
 * stopped.
 */
if (netif_queue_stopped(np-dev)) {
np-dev-xmit_lock_owner = -1;
spin_unlock(np-dev-xmit_lock);
netpoll_poll(np);
udelay(50);
continue;
}
/* ... */
again: /* proposed */
} while (npinfo-tries  0);


so this will end up in an infinite loop, since netif_queue_stopped() 
will always return true, and it never looks at npinfo-tries.  Should 
the continue be goto again?


Also, e1000_down does a netif_poll_disable(), but I'm not sure what that 
actually does...  Should it prevent netpoll from even trying to send?

It's generally going to suck, because unlike a polled serial port, the
device needs to be put to sleep. But if you're doing suspend to RAM,
  
I'm interested in suspend-to-ram.  I presume that with suspend-to-disk, 
booting with built-in netconsole will tell me useful stuff; that'll be 
the next experiment.



you might be able to do something like this:

- unhook net device from suspend machinery (possibly just return success)
- bounce out of suspend before the final call to ACPI is made

Net effect is you do OS-level suspend and resume of everything but the
NIC without actually powering down the core. Which should let you
debug just about everything.


Well, the machine has to really suspend so that I can see (and debug) a 
mostly normal resume.  In particular, I need the hardware to be zapped 
so I can see if it is being restarted properly.


What might work is to change the e1000 suspend routine to save enough 
state for resume to work, but keep the interface up so that netconsole 
can keep transmitting all the way up to the point that the final acpi 
call powers off the machine.


Then the e1000 would resume normally, including restarting the xmit 
queue so that netconsole can start again immediately; any netconsole 
output before the e1000 resume would be lost, of course (I guess it 
could be buffered).  That would suit me for now.


   J

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RFC] netpoll: don't spin forever sending to stopped queues

2006-06-08 Thread Jeremy Fitzhardinge

Matt Mackall wrote:

That's odd. Netpoll holds a reference to the device, of course, but so
does a normal up interface. So that shouldn't be the problem.
Another possibility is that outgoing packets from printks in the
driver are causing difficulty. Not sure what can be done about that.
  
Here's a patch.  I haven't tested it beyond compiling it, and I don't 
know if it is actually correct.  In this case, it seems pointless to 
spin waiting for an even which will never happen.  Should 
netif_poll_disable() cause netpoll_send_skb() (or something) to not even 
bother trying to send?  netif_poll_disable seems mysteriously simple to me.


   J

--

Subject: netpoll: don't spin forever sending to stopped queues

When transmitting a skb in netpoll_send_skb(), only retry a limited
number of times if the device queue is stopped.

Signed-off-by: Jeremy Fitzhardinge [EMAIL PROTECTED]

diff -r aac813f54617 net/core/netpoll.c
--- a/net/core/netpoll.cWed Jun 07 14:53:40 2006 -0700
+++ b/net/core/netpoll.cThu Jun 08 19:00:29 2006 -0700
@@ -280,15 +280,10 @@ static void netpoll_send_skb(struct netp
 * network drivers do not expect to be called if the queue is
 * stopped.
 */
-   if (netif_queue_stopped(np-dev)) {
-   np-dev-xmit_lock_owner = -1;
-   spin_unlock(np-dev-xmit_lock);
-   netpoll_poll(np);
-   udelay(50);
-   continue;
-   }
-
-   status = np-dev-hard_start_xmit(skb, np-dev);
+   status = NETDEV_TX_BUSY;
+   if (!netif_queue_stopped(np-dev))
+   status = np-dev-hard_start_xmit(skb, np-dev);
+
np-dev-xmit_lock_owner = -1;
spin_unlock(np-dev-xmit_lock);




-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Using netconsole for debugging suspend/resume

2006-06-08 Thread Jeremy Fitzhardinge

Rafael J. Wysocki wrote:

Please try doing echo 8  /proc/sys/kernel/printk before suspend.
  
Um, why?  That would increase the amount of log output, but I don't see 
how it would help with netconsole preventing suspend, or not being able 
to see console messages on a blank screen after resume.


   J

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: netif_tx_disable vs netif_stop_queue (possible races?)

2006-06-08 Thread Herbert Xu
Daniel Drake [EMAIL PROTECTED] wrote:
 
 More specifically, we're talking about drivers/usb/net/usbnet.c and the 
 usbnet_disconnect() function.  The race I am highlighting is that 
 usbnet's hard_start_xmit handler (usbnet_start_xmit) may be running when 
 the disconnect happens.
 
 Is this a possible scenario?

It should be safe, if only because of the synchronize_net that occurs
before a netdev can be freed.

However, there is definitely room for clean-ups.  In particular, LLTX
drivers have changed the meaning of xmit_lock so things like dev_deactivate
no longer carries the same power they used to.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Fw: [Bugme-new] [Bug 6666] New: invalid tcp socket connection to windows stacks

2006-06-08 Thread Herbert Xu
Andrew Morton [EMAIL PROTECTED] wrote:
 
 If it's buggy you get :
 
 11:24:15.021572 d59.x-mailer.de.59959 
 cust.static.212-90-215-40.cybernet.ch.smtp: S 2028538653:2028538653(0) win 
 5840
 mss 1460,sackOK,timestamp 243108498 0,nop,wscale 7 (DF)
 11:24:15.076329 cust.static.212-90-215-40.cybernet.ch.smtp 
 d59.x-mailer.de.59959: S 2328498080:2328498080(0) ack 2028538654 win 16384 
 mss
 1400,nop,wscale 0,nop,nop,timestamp 0
 0,nop,nop,sackOK
 11:24:15.076352 d59.x-mailer.de.59959 
 cust.static.212-90-215-40.cybernet.ch.smtp: . ack 1 win 46 nop,nop,timestamp
 243108503 0 (DF)

...
 
 ### you should get kind of this:
 
 13:56:37.203297 d59.x-mailer.de.43286 
 cust.static.212-90-215-40.cybernet.ch.smtp: S 1489507409:1489507409(0) win 
 5840
 mss 1460,sackOK,timestamp 16627469 0,nop,wscale 2 (DF)
 13:56:37.250827 cust.static.212-90-215-40.cybernet.ch.smtp 
 d59.x-mailer.de.43286: S 783498912:783498912(0) ack 1489507410 win 16384 mss
 1400,nop,wscale 0,nop,nop,timestamp 0 0,nop,nop,sackOK
 13:56:37.250888 d59.x-mailer.de.43286 
 cust.static.212-90-215-40.cybernet.ch.smtp: . ack 1 win 1460 
 nop,nop,timestamp
 16627473 0 (DF)

Looks like the problem is window scaling.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 06/17] neighbour.c, pneigh_get_next() skips published entry

2006-06-08 Thread Herbert Xu
Jari Takkala [EMAIL PROTECTED] wrote:
 
 I have not checked neigh seqfile iterators, the problem may exist in
 there as well. My patch solves this issue for us, however a more elegant
 solution would be most welcome.  Could the root of the problem be that
 *pos is off by one when pneigh_get_idx() is called?

Could you post an exact sequence of commands that reproduces the bug?
That would help us in verifying your fix.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Netchannels: netchannel vs. socket. 2:0.

2006-06-08 Thread Evgeniy Polyakov
On Fri, Jun 09, 2006 at 01:00:24AM +0200, Hans Henrik Happe ([EMAIL PROTECTED]) 
wrote:
 On Thursday 08 June 2006 19:15, you wrote:
  After some enhancements made for netchannel subsystem I'm pleased to
  announce, that netchannel subsystem outperforms existing layered design
  both in CPU usage and network speed.
  
  Well, after such pretentious introduction I want to cool things down.
  CPU usage is about 1-2% less for netchannels and network performance is
  about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, 
  is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).
 
 I have followed your work closely and have wondered how it affects latency?
 I have somewhat limited knowledge about TCP and how the kernel handles it, 
 but 
 I guess the path from NIC to userspace hasn't increased. What about syscall 
 overhead caused by userspace TCP processing?

Path from NIC to userspace was decreased in that way that there are less
number of context switches, much smaller amount of work being done in
softirq (I have not modified driver and still use NAPI), less cache
thrashing due to work ping-ponging and less number of locks.
Number of syscalls is still the same - either one recv() or one
netchannel_control() to read the same block of data.

But since existing socket code is used, gain is not that big, since
sockets are locked, although they should not, skbs are requeued, ACKs
are scheduled, although all that could be changed.

At least receiving part of the netchannel TCP processing could be
different. And my thoughts move in that direction.

 H³  

-- 
Evgeniy Polyakov
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >