Re: [PATCH net-next] net/ipv6: Block IPv6 addrconf on team ports

2018-10-25 Thread Chas Williams




On 10/25/2018 05:59 PM, Jay Vosburgh wrote:

Chas Williams <3ch...@gmail.com> wrote:


netif_is_lag_port should be used to identify link aggregation ports.
For this to work, we need to reorganize the bonding and team drivers
so that the necessary flags are set before dev_open is called.

commit 31e77c93e432 ("sched/fair: Update blocked load when newly idle")
made this decision originally based on the IFF_SLAVE flag which isn't
used by the team driver.  Note, we do need to retain the IFF_SLAVE
check for the eql driver.


Is 31e77c93e432 the correct commit reference?  I don't see
anything in there about IFF_SLAVE or bonding; it's a patch to the
process scheduler.


No, that's wrong.  It should be c2edacf80e155.


And, as Jiri said, the subject doesn't mention bonding.


The behavior of bonding wasn't changed.  The intent of the patch
is to add team slaves to the interfaces that don't get automatic
IPv6 addresses.  The body discusses why bonding had to change as
well.

I was under the impression that the subject needs to kept short.
If there a better way to phrase what I want to do?




Signed-off-by: Chas Williams <3ch...@gmail.com>
---
drivers/net/bonding/bond_main.c | 4 ++--
drivers/net/team/team.c | 7 +--
net/ipv6/addrconf.c | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ffa37adb7681..5cdad164332b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1536,6 +1536,7 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev,

/* set slave flag before open to prevent IPv6 addrconf */
slave_dev->flags |= IFF_SLAVE;
+   slave_dev->priv_flags |= IFF_BONDING;

/* open the slave since the application closed it */
res = dev_open(slave_dev);
@@ -1544,7 +1545,6 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev,
goto err_restore_mac;
}

-   slave_dev->priv_flags |= IFF_BONDING;
/* initialize slave stats */
dev_get_stats(new_slave->dev, _slave->slave_stats);

@@ -1804,10 +1804,10 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev,
slave_disable_netpoll(new_slave);

err_close:
-   slave_dev->priv_flags &= ~IFF_BONDING;
dev_close(slave_dev);

err_restore_mac:
+   slave_dev->priv_flags &= ~IFF_BONDING;
slave_dev->flags &= ~IFF_SLAVE;
if (!bond->params.fail_over_mac ||
BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index db633ae9f784..8fc7d57e9f6d 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1128,14 +1128,12 @@ static int team_upper_dev_link(struct team *team, 
struct team_port *port,
   _upper_info, extack);
if (err)
return err;
-   port->dev->priv_flags |= IFF_TEAM_PORT;
return 0;
}

static void team_upper_dev_unlink(struct team *team, struct team_port *port)
{
netdev_upper_dev_unlink(port->dev, team->dev);
-   port->dev->priv_flags &= ~IFF_TEAM_PORT;
}

static void __team_port_change_port_added(struct team_port *port, bool linkup);
@@ -1214,6 +1212,9 @@ static int team_port_add(struct team *team, struct 
net_device *port_dev,
goto err_port_enter;
}

+   /* set slave flag before open to prevent IPv6 addrconf */
+   port->dev->priv_flags |= IFF_TEAM_PORT;
+
err = dev_open(port_dev);
if (err) {
netdev_dbg(dev, "Device %s opening failed\n",
@@ -1292,6 +1293,7 @@ static int team_port_add(struct team *team, struct 
net_device *port_dev,
dev_close(port_dev);

err_dev_open:
+   port->dev->priv_flags &= ~IFF_TEAM_PORT;
team_port_leave(team, port);
team_port_set_orig_dev_addr(port);

@@ -1328,6 +1330,7 @@ static int team_port_del(struct team *team, struct 
net_device *port_dev)
dev_uc_unsync(port_dev, dev);
dev_mc_unsync(port_dev, dev);
dev_close(port_dev);
+   port->dev->priv_flags &= ~IFF_TEAM_PORT;
team_port_leave(team, port);

__team_option_inst_mark_removed_port(team, port);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 45b84dd5c4eb..121f863022ed 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3482,7 +3482,7 @@ static int addrconf_notify(struct notifier_block *this, 
unsigned long event,

case NETDEV_UP:
case NETDEV_CHANGE:
-   if (dev->flags & IFF_SLAVE)
+   if (netif_is_lag_port(dev) || dev->flags & IFF_SLAVE)


Note that netvsc_vf_join() also uses IFF_SLAVE in order skip
IPv6 addrconf for netvsc devices; I don't believe its usag

Re: [PATCH net-next] net/ipv6: Block IPv6 addrconf on team ports

2018-10-25 Thread Chas Williams




On 10/25/2018 05:10 PM, Jiri Pirko wrote:

Thu, Oct 25, 2018 at 11:02:27PM CEST, 3ch...@gmail.com wrote:

netif_is_lag_port should be used to identify link aggregation ports.
For this to work, we need to reorganize the bonding and team drivers
so that the necessary flags are set before dev_open is called.

commit 31e77c93e432 ("sched/fair: Update blocked load when newly idle")
made this decision originally based on the IFF_SLAVE flag which isn't
used by the team driver.  Note, we do need to retain the IFF_SLAVE
check for the eql driver.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
drivers/net/bonding/bond_main.c | 4 ++--
drivers/net/team/team.c | 7 +--
net/ipv6/addrconf.c | 2 +-


Subject talks about "team" yet you modify bond and team. Confusing..


The subject discusses what I want to do. The body of the message
covers how I had to do it. The behavior of bonding with respect to
addrconf isn't changed but netif_is_lag_port is picky about the
flags it wants to see from bonding.  So some bonding changes are
necessary.


[PATCH net-next] net/ipv6: Block IPv6 addrconf on team ports

2018-10-25 Thread Chas Williams
netif_is_lag_port should be used to identify link aggregation ports.
For this to work, we need to reorganize the bonding and team drivers
so that the necessary flags are set before dev_open is called.

commit 31e77c93e432 ("sched/fair: Update blocked load when newly idle")
made this decision originally based on the IFF_SLAVE flag which isn't
used by the team driver.  Note, we do need to retain the IFF_SLAVE
check for the eql driver.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/bonding/bond_main.c | 4 ++--
 drivers/net/team/team.c | 7 +--
 net/ipv6/addrconf.c | 2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index ffa37adb7681..5cdad164332b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1536,6 +1536,7 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev,
 
/* set slave flag before open to prevent IPv6 addrconf */
slave_dev->flags |= IFF_SLAVE;
+   slave_dev->priv_flags |= IFF_BONDING;
 
/* open the slave since the application closed it */
res = dev_open(slave_dev);
@@ -1544,7 +1545,6 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev,
goto err_restore_mac;
}
 
-   slave_dev->priv_flags |= IFF_BONDING;
/* initialize slave stats */
dev_get_stats(new_slave->dev, _slave->slave_stats);
 
@@ -1804,10 +1804,10 @@ int bond_enslave(struct net_device *bond_dev, struct 
net_device *slave_dev,
slave_disable_netpoll(new_slave);
 
 err_close:
-   slave_dev->priv_flags &= ~IFF_BONDING;
dev_close(slave_dev);
 
 err_restore_mac:
+   slave_dev->priv_flags &= ~IFF_BONDING;
slave_dev->flags &= ~IFF_SLAVE;
if (!bond->params.fail_over_mac ||
BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index db633ae9f784..8fc7d57e9f6d 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1128,14 +1128,12 @@ static int team_upper_dev_link(struct team *team, 
struct team_port *port,
   _upper_info, extack);
if (err)
return err;
-   port->dev->priv_flags |= IFF_TEAM_PORT;
return 0;
 }
 
 static void team_upper_dev_unlink(struct team *team, struct team_port *port)
 {
netdev_upper_dev_unlink(port->dev, team->dev);
-   port->dev->priv_flags &= ~IFF_TEAM_PORT;
 }
 
 static void __team_port_change_port_added(struct team_port *port, bool linkup);
@@ -1214,6 +1212,9 @@ static int team_port_add(struct team *team, struct 
net_device *port_dev,
goto err_port_enter;
}
 
+   /* set slave flag before open to prevent IPv6 addrconf */
+   port->dev->priv_flags |= IFF_TEAM_PORT;
+
err = dev_open(port_dev);
if (err) {
netdev_dbg(dev, "Device %s opening failed\n",
@@ -1292,6 +1293,7 @@ static int team_port_add(struct team *team, struct 
net_device *port_dev,
dev_close(port_dev);
 
 err_dev_open:
+   port->dev->priv_flags &= ~IFF_TEAM_PORT;
team_port_leave(team, port);
team_port_set_orig_dev_addr(port);
 
@@ -1328,6 +1330,7 @@ static int team_port_del(struct team *team, struct 
net_device *port_dev)
dev_uc_unsync(port_dev, dev);
dev_mc_unsync(port_dev, dev);
dev_close(port_dev);
+   port->dev->priv_flags &= ~IFF_TEAM_PORT;
team_port_leave(team, port);
 
__team_option_inst_mark_removed_port(team, port);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 45b84dd5c4eb..121f863022ed 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3482,7 +3482,7 @@ static int addrconf_notify(struct notifier_block *this, 
unsigned long event,
 
case NETDEV_UP:
case NETDEV_CHANGE:
-   if (dev->flags & IFF_SLAVE)
+   if (netif_is_lag_port(dev) || dev->flags & IFF_SLAVE)
break;
 
if (idev && idev->cnf.disable_ipv6)
-- 
2.14.4



Re: [PATCH] team: set IFF_SLAVE on team ports

2018-09-27 Thread Chas Williams




On 07/10/15 02:41, Jiri Pirko wrote:

Thu, Jul 09, 2015 at 05:36:55PM CEST, jblu...@infradead.org wrote:

On Thu, Jul 9, 2015 at 12:07 PM, Jiri Pirko  wrote:

Thu, Jul 09, 2015 at 11:58:34AM CEST, jblu...@infradead.org wrote:

The code in net/ipv6/addrconf.c:addrconf_notify() tests for IFF_SLAVE to
decide if it should start the address configuration. Since team ports
shouldn't get link-local addresses assigned lets set IFF_SLAVE when linking
a port to the team master.


I don't want to use IFF_SLAVE in team. Other master-slave devices are
not using that as well, for example bridge, ovs, etc.



Maybe they need to get fixed too. I've used that flag because it is
documented as
a "slave of a load balancer" which describes what a team port is.



I think that this should be fixed in addrconf_notify. It should lookup
if there is a master on top and bail out in that case.


There are other virtual interfaces that have a master assigned and want to
participate in IPv6 address configuration.


Can you give me an example?


I would like to revisit this patch (yes, I know it has been a while).  I 
believe the VRF implementation uses master to group the interfaces under

a single interface.

I don't see a reason not to use IFF_SLAVE since team and bonding are 
fairly similar.




Unless we want to have a cascade of conditionals testing the priv_flags in
addrconf_notify() this is asking for a new net_device_flags flag.
Maybe something
generic like IFF_L2PORT ?

Thanks,
Jan

[ Jiri, sorry for getting that mail twice ]






[PATCH v4,net-next] vlan: implement vlan id and protocol changes

2018-07-02 Thread Chas Williams
vlan_changelink silently ignores attempts to change the vlan id
or protocol id of an existing vlan interface.  Implement by adding
the new vlan id and protocol to the interface's vlan group and then
removing the old vlan id and protocol from the vlan group.  This
avoids the netlink churn of deleting and re-adding an interface
to change the vlan id.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 include/linux/netdevice.h |  1 +
 net/8021q/vlan.c  |  4 ++--
 net/8021q/vlan.h  |  2 ++
 net/8021q/vlan_netlink.c  | 49 ++-
 net/core/dev.c|  1 +
 5 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8bf8d6149f79..bf3f557eed8c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2416,6 +2416,7 @@ enum netdev_cmd {
NETDEV_CVLAN_FILTER_DROP_INFO,
NETDEV_SVLAN_FILTER_PUSH_INFO,
NETDEV_SVLAN_FILTER_DROP_INFO,
+   NETDEV_CHANGEVLAN,
 };
 const char *netdev_cmd_to_name(enum netdev_cmd cmd);
 
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 99141986efa0..b6d0b2e2ada0 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -51,8 +51,8 @@ const char vlan_version[] = DRV_VERSION;
 
 /* End of global variables definitions. */
 
-static int vlan_group_prealloc_vid(struct vlan_group *vg,
-  __be16 vlan_proto, u16 vlan_id)
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id)
 {
struct net_device **array;
unsigned int pidx, vidx;
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 44df1c3df02d..c734dd21d70d 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -116,6 +116,8 @@ int register_vlan_dev(struct net_device *dev, struct 
netlink_ext_ack *extack);
 void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
 bool vlan_dev_inherit_address(struct net_device *dev,
  struct net_device *real_dev);
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id);
 
 static inline u32 vlan_get_ingress_priority(struct net_device *dev,
u16 vlan_tci)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 9b60c1e399e2..0a4ae6b15d89 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -107,10 +107,56 @@ static int vlan_changelink(struct net_device *dev, struct 
nlattr *tb[],
   struct nlattr *data[],
   struct netlink_ext_ack *extack)
 {
+   struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
struct ifla_vlan_flags *flags;
struct ifla_vlan_qos_mapping *m;
struct nlattr *attr;
int rem;
+   int err = 0;
+   __be16 vlan_proto = vlan->vlan_proto;
+   u16 vlan_id = vlan->vlan_id;
+
+   if (data[IFLA_VLAN_ID])
+   vlan_id = nla_get_u16(data[IFLA_VLAN_ID]);
+
+   if (data[IFLA_VLAN_PROTOCOL])
+   vlan_proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]);
+
+   if (vlan->vlan_id != vlan_id || vlan->vlan_proto != vlan_proto) {
+   struct net_device *real_dev = vlan->real_dev;
+   struct vlan_info *vlan_info;
+   struct vlan_group *grp;
+   __be16 old_vlan_proto = vlan->vlan_proto;
+   u16 old_vlan_id = vlan->vlan_id;
+
+   err = vlan_vid_add(real_dev, vlan_proto, vlan_id);
+   if (err)
+   goto out;
+   vlan_info = rtnl_dereference(real_dev->vlan_info);
+   grp = _info->grp;
+   err = vlan_group_prealloc_vid(grp, vlan_proto, vlan_id);
+   if (err < 0) {
+   vlan_vid_del(real_dev, vlan_proto, vlan_id);
+   return err;
+   }
+   vlan_group_set_device(grp, vlan_proto, vlan_id, dev);
+   vlan->vlan_proto = vlan_proto;
+   vlan->vlan_id = vlan_id;
+
+   err = call_netdevice_notifiers(NETDEV_CHANGEVLAN, dev);
+   err = notifier_to_errno(err);
+   if (err) {
+   /* rollback */
+   vlan_group_set_device(grp, vlan_proto, vlan_id, NULL);
+   vlan_vid_del(real_dev, vlan_proto, vlan_id);
+   vlan->vlan_proto = old_vlan_proto;
+   vlan->vlan_id = old_vlan_id;
+   } else {
+   vlan_group_set_device(grp, old_vlan_proto,
+ old_vlan_id, NULL);
+   vlan_vid_del(real_dev, old_vlan_proto, old_vlan_id);
+   }
+   }
 
if (data[IFLA_VLAN_FLAGS]) {
flags = nla_data(data[IFLA_VLAN_FLAGS]);
@@ -128,7 +174,8 @@ static in

[PATCH v3,net-next] vlan: implement vlan id and protocol changes

2018-06-25 Thread Chas Williams
vlan_changelink silently ignores attempts to change the vlan id
or protocol id of an existing vlan interface.  Implement by adding
the new vlan id and protocol to the interface's vlan group and then
removing the old vlan id and protocol from the vlan group.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 include/linux/netdevice.h |  1 +
 net/8021q/vlan.c  |  4 ++--
 net/8021q/vlan.h  |  2 ++
 net/8021q/vlan_netlink.c  | 38 ++
 net/core/dev.c|  1 +
 5 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3ec9850c7936..a95ae238addf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2409,6 +2409,7 @@ enum netdev_cmd {
NETDEV_CVLAN_FILTER_DROP_INFO,
NETDEV_SVLAN_FILTER_PUSH_INFO,
NETDEV_SVLAN_FILTER_DROP_INFO,
+   NETDEV_CHANGEVLAN,
 };
 const char *netdev_cmd_to_name(enum netdev_cmd cmd);
 
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 73a65789271b..b5e0ad1a581a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -51,8 +51,8 @@ const char vlan_version[] = DRV_VERSION;
 
 /* End of global variables definitions. */
 
-static int vlan_group_prealloc_vid(struct vlan_group *vg,
-  __be16 vlan_proto, u16 vlan_id)
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id)
 {
struct net_device **array;
unsigned int pidx, vidx;
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 44df1c3df02d..c734dd21d70d 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -116,6 +116,8 @@ int register_vlan_dev(struct net_device *dev, struct 
netlink_ext_ack *extack);
 void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
 bool vlan_dev_inherit_address(struct net_device *dev,
  struct net_device *real_dev);
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id);
 
 static inline u32 vlan_get_ingress_priority(struct net_device *dev,
u16 vlan_tci)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 9b60c1e399e2..ee27781939e0 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -107,10 +107,48 @@ static int vlan_changelink(struct net_device *dev, struct 
nlattr *tb[],
   struct nlattr *data[],
   struct netlink_ext_ack *extack)
 {
+   struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
struct ifla_vlan_flags *flags;
struct ifla_vlan_qos_mapping *m;
struct nlattr *attr;
int rem;
+   __be16 vlan_proto = vlan->vlan_proto;
+   u16 vlan_id = vlan->vlan_id;
+
+   if (data[IFLA_VLAN_ID])
+   vlan_id = nla_get_u16(data[IFLA_VLAN_ID]);
+
+   if (data[IFLA_VLAN_PROTOCOL])
+   vlan_proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]);
+
+   if (vlan->vlan_id != vlan_id || vlan->vlan_proto != vlan_proto) {
+   struct net_device *real_dev = vlan->real_dev;
+   struct vlan_info *vlan_info;
+   struct vlan_group *grp;
+   __be16 old_vlan_proto = vlan->vlan_proto;
+   u16 old_vlan_id = vlan->vlan_id;
+   int err;
+
+   err = vlan_vid_add(real_dev, vlan_proto, vlan_id);
+   if (err)
+   return err;
+   vlan_info = rtnl_dereference(real_dev->vlan_info);
+   grp = _info->grp;
+   err = vlan_group_prealloc_vid(grp, vlan_proto, vlan_id);
+   if (err < 0) {
+   vlan_vid_del(real_dev, vlan_proto, vlan_id);
+   return err;
+   }
+   vlan_group_set_device(grp, vlan_proto, vlan_id, dev);
+   vlan->vlan_proto = vlan_proto;
+   vlan->vlan_id = vlan_id;
+
+   vlan_group_set_device(grp, old_vlan_proto, old_vlan_id, NULL);
+   vlan_vid_del(real_dev, old_vlan_proto, old_vlan_id);
+
+   err = call_netdevice_notifiers(NETDEV_CHANGEVLAN, dev);
+   notifier_to_errno(err);
+   }
 
if (data[IFLA_VLAN_FLAGS]) {
flags = nla_data(data[IFLA_VLAN_FLAGS]);
diff --git a/net/core/dev.c b/net/core/dev.c
index a5aa1c7444e6..4bda5d2e3c85 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1587,6 +1587,7 @@ const char *netdev_cmd_to_name(enum netdev_cmd cmd)
N(UDP_TUNNEL_DROP_INFO) N(CHANGE_TX_QUEUE_LEN)
N(CVLAN_FILTER_PUSH_INFO) N(CVLAN_FILTER_DROP_INFO)
N(SVLAN_FILTER_PUSH_INFO) N(SVLAN_FILTER_DROP_INFO)
+   N(CHANGEVLAN)
}
 #undef N
return "UNKNOWN_NETDEV_EVENT";
-- 
2.14.4



[PATCH v2 net-next] vlan: implement vlan id and protocol changes

2018-06-11 Thread Chas Williams
vlan_changelink silently ignores attempts to change the vlan id
or protocol id of an existing vlan interface.  Implement by adding
the new vlan id and protocol to the interface's vlan group and then
removing the old vlan id and protocol from the vlan group.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 include/linux/netdevice.h |  1 +
 net/8021q/vlan.c  |  4 ++--
 net/8021q/vlan.h  |  2 ++
 net/8021q/vlan_netlink.c  | 38 ++
 net/core/dev.c|  1 +
 5 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3ec9850c7936..a95ae238addf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2409,6 +2409,7 @@ enum netdev_cmd {
NETDEV_CVLAN_FILTER_DROP_INFO,
NETDEV_SVLAN_FILTER_PUSH_INFO,
NETDEV_SVLAN_FILTER_DROP_INFO,
+   NETDEV_CHANGEVLAN,
 };
 const char *netdev_cmd_to_name(enum netdev_cmd cmd);
 
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 73a65789271b..b5e0ad1a581a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -51,8 +51,8 @@ const char vlan_version[] = DRV_VERSION;
 
 /* End of global variables definitions. */
 
-static int vlan_group_prealloc_vid(struct vlan_group *vg,
-  __be16 vlan_proto, u16 vlan_id)
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id)
 {
struct net_device **array;
unsigned int pidx, vidx;
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 44df1c3df02d..c734dd21d70d 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -116,6 +116,8 @@ int register_vlan_dev(struct net_device *dev, struct 
netlink_ext_ack *extack);
 void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
 bool vlan_dev_inherit_address(struct net_device *dev,
  struct net_device *real_dev);
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id);
 
 static inline u32 vlan_get_ingress_priority(struct net_device *dev,
u16 vlan_tci)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 9b60c1e399e2..0e59babe6651 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -107,10 +107,48 @@ static int vlan_changelink(struct net_device *dev, struct 
nlattr *tb[],
   struct nlattr *data[],
   struct netlink_ext_ack *extack)
 {
+   struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
struct ifla_vlan_flags *flags;
struct ifla_vlan_qos_mapping *m;
struct nlattr *attr;
int rem;
+   int err;
+   __be16 vlan_proto = vlan->vlan_proto;
+   u16 vlan_id = vlan->vlan_id;
+
+   if (data[IFLA_VLAN_ID])
+   vlan_id = nla_get_u16(data[IFLA_VLAN_ID]);
+
+   if (data[IFLA_VLAN_PROTOCOL])
+   vlan_proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]);
+
+   if (vlan->vlan_id != vlan_id || vlan->vlan_proto != vlan_proto) {
+   struct net_device *real_dev = vlan->real_dev;
+   struct vlan_info *vlan_info;
+   struct vlan_group *grp;
+   __be16 old_vlan_proto = vlan->vlan_proto;
+   u16 old_vlan_id = vlan->vlan_id;
+
+   err = vlan_vid_add(real_dev, vlan_proto, vlan_id);
+   if (err)
+   return err;
+   vlan_info = rtnl_dereference(real_dev->vlan_info);
+   grp = _info->grp;
+   err = vlan_group_prealloc_vid(grp, vlan_proto, vlan_id);
+   if (err < 0) {
+   vlan_vid_del(real_dev, vlan_proto, vlan_id);
+   return err;
+   }
+   vlan_group_set_device(grp, vlan_proto, vlan_id, dev);
+   vlan->vlan_proto = vlan_proto;
+   vlan->vlan_id = vlan_id;
+
+   vlan_group_set_device(grp, old_vlan_proto, old_vlan_id, NULL);
+   vlan_vid_del(real_dev, old_vlan_proto, old_vlan_id);
+
+   err = call_netdevice_notifiers(NETDEV_CHANGEVLAN, dev);
+   notifier_to_errno(err);
+   }
 
if (data[IFLA_VLAN_FLAGS]) {
flags = nla_data(data[IFLA_VLAN_FLAGS]);
diff --git a/net/core/dev.c b/net/core/dev.c
index 6e18242a1cae..849fdb60fd21 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1587,6 +1587,7 @@ const char *netdev_cmd_to_name(enum netdev_cmd cmd)
N(UDP_TUNNEL_DROP_INFO) N(CHANGE_TX_QUEUE_LEN)
N(CVLAN_FILTER_PUSH_INFO) N(CVLAN_FILTER_DROP_INFO)
N(SVLAN_FILTER_PUSH_INFO) N(SVLAN_FILTER_DROP_INFO)
+   N(CHANGEVLAN)
}
 #undef N
return "UNKNOWN_NETDEV_EVENT";
-- 
2.14.3



[PATCH net-next] vlan: implement vlan id and protocol changes

2018-06-10 Thread Chas Williams
From: "Charles (Chas) Williams" 

vlan_changelink silently ignores attempts to change the vlan id
or protocol id of an existing vlan interface.  Implement by adding
the new vlan id and protocol to the interface's vlan group and then
removing the old vlan id and protocol from the vlan group.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 include/linux/netdevice.h |  1 +
 net/8021q/vlan.c  |  4 ++--
 net/8021q/vlan.h  |  2 ++
 net/8021q/vlan_netlink.c  | 38 ++
 4 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3ec9850c7936..a95ae238addf 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2409,6 +2409,7 @@ enum netdev_cmd {
NETDEV_CVLAN_FILTER_DROP_INFO,
NETDEV_SVLAN_FILTER_PUSH_INFO,
NETDEV_SVLAN_FILTER_DROP_INFO,
+   NETDEV_CHANGEVLAN,
 };
 const char *netdev_cmd_to_name(enum netdev_cmd cmd);
 
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 73a65789271b..b5e0ad1a581a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -51,8 +51,8 @@ const char vlan_version[] = DRV_VERSION;
 
 /* End of global variables definitions. */
 
-static int vlan_group_prealloc_vid(struct vlan_group *vg,
-  __be16 vlan_proto, u16 vlan_id)
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id)
 {
struct net_device **array;
unsigned int pidx, vidx;
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 44df1c3df02d..c734dd21d70d 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -116,6 +116,8 @@ int register_vlan_dev(struct net_device *dev, struct 
netlink_ext_ack *extack);
 void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
 bool vlan_dev_inherit_address(struct net_device *dev,
  struct net_device *real_dev);
+int vlan_group_prealloc_vid(struct vlan_group *vg,
+   __be16 vlan_proto, u16 vlan_id);
 
 static inline u32 vlan_get_ingress_priority(struct net_device *dev,
u16 vlan_tci)
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index 9b60c1e399e2..0e59babe6651 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -107,10 +107,48 @@ static int vlan_changelink(struct net_device *dev, struct 
nlattr *tb[],
   struct nlattr *data[],
   struct netlink_ext_ack *extack)
 {
+   struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
struct ifla_vlan_flags *flags;
struct ifla_vlan_qos_mapping *m;
struct nlattr *attr;
int rem;
+   int err;
+   __be16 vlan_proto = vlan->vlan_proto;
+   u16 vlan_id = vlan->vlan_id;
+
+   if (data[IFLA_VLAN_ID])
+   vlan_id = nla_get_u16(data[IFLA_VLAN_ID]);
+
+   if (data[IFLA_VLAN_PROTOCOL])
+   vlan_proto = nla_get_be16(data[IFLA_VLAN_PROTOCOL]);
+
+   if (vlan->vlan_id != vlan_id || vlan->vlan_proto != vlan_proto) {
+   struct net_device *real_dev = vlan->real_dev;
+   struct vlan_info *vlan_info;
+   struct vlan_group *grp;
+   __be16 old_vlan_proto = vlan->vlan_proto;
+   u16 old_vlan_id = vlan->vlan_id;
+
+   err = vlan_vid_add(real_dev, vlan_proto, vlan_id);
+   if (err)
+   return err;
+   vlan_info = rtnl_dereference(real_dev->vlan_info);
+   grp = _info->grp;
+   err = vlan_group_prealloc_vid(grp, vlan_proto, vlan_id);
+   if (err < 0) {
+   vlan_vid_del(real_dev, vlan_proto, vlan_id);
+   return err;
+   }
+   vlan_group_set_device(grp, vlan_proto, vlan_id, dev);
+   vlan->vlan_proto = vlan_proto;
+   vlan->vlan_id = vlan_id;
+
+   vlan_group_set_device(grp, old_vlan_proto, old_vlan_id, NULL);
+   vlan_vid_del(real_dev, old_vlan_proto, old_vlan_id);
+
+   err = call_netdevice_notifiers(NETDEV_CHANGEVLAN, dev);
+   notifier_to_errno(err);
+   }
 
if (data[IFLA_VLAN_FLAGS]) {
flags = nla_data(data[IFLA_VLAN_FLAGS]);
-- 
2.14.3



[PATCH net-next] Allow ethtool to change tun link settings

2018-06-02 Thread Chas Williams
Let user space set whatever it would like to advertise for the
tun interface.  Preserve the existing defaults.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/tun.c | 27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2265d2ccea47..7a7492845f53 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -81,6 +81,9 @@
 #include 
 #include 
 
+static void tun_default_link_ksettings(struct net_device *dev,
+  struct ethtool_link_ksettings *cmd);
+
 /* Uncomment to enable debugging */
 /* #define TUN_DEBUG 1 */
 
@@ -242,6 +245,7 @@ struct tun_struct {
struct bpf_prog __rcu *xdp_prog;
struct tun_prog __rcu *steering_prog;
struct tun_prog __rcu *filter_prog;
+   struct ethtool_link_ksettings link_ksettings;
 };
 
 struct veth {
@@ -2292,6 +2296,7 @@ static void tun_setup(struct net_device *dev)
 
tun->owner = INVALID_UID;
tun->group = INVALID_GID;
+   tun_default_link_ksettings(dev, >link_ksettings);
 
dev->ethtool_ops = _ethtool_ops;
dev->needs_free_netdev = true;
@@ -3323,8 +3328,8 @@ static struct miscdevice tun_miscdev = {
 
 /* ethtool interface */
 
-static int tun_get_link_ksettings(struct net_device *dev,
- struct ethtool_link_ksettings *cmd)
+static void tun_default_link_ksettings(struct net_device *dev,
+  struct ethtool_link_ksettings *cmd)
 {
ethtool_link_ksettings_zero_link_mode(cmd, supported);
ethtool_link_ksettings_zero_link_mode(cmd, advertising);
@@ -,6 +3338,23 @@ static int tun_get_link_ksettings(struct net_device *dev,
cmd->base.port  = PORT_TP;
cmd->base.phy_address   = 0;
cmd->base.autoneg   = AUTONEG_DISABLE;
+}
+
+static int tun_get_link_ksettings(struct net_device *dev,
+ struct ethtool_link_ksettings *cmd)
+{
+   struct tun_struct *tun = netdev_priv(dev);
+
+   memcpy(cmd, >link_ksettings, sizeof(*cmd));
+   return 0;
+}
+
+static int tun_set_link_ksettings(struct net_device *dev,
+ const struct ethtool_link_ksettings *cmd)
+{
+   struct tun_struct *tun = netdev_priv(dev);
+
+   memcpy(>link_ksettings, cmd, sizeof(*cmd));
return 0;
 }
 
@@ -3403,6 +3425,7 @@ static const struct ethtool_ops tun_ethtool_ops = {
.get_coalesce   = tun_get_coalesce,
.set_coalesce   = tun_set_coalesce,
.get_link_ksettings = tun_get_link_ksettings,
+   .set_link_ksettings = tun_set_link_ksettings,
 };
 
 static int tun_queue_resize(struct tun_struct *tun)
-- 
2.14.3



Re: [PATCH net-next] bridge: Allow max MTU when multiple VLANs present

2018-04-03 Thread Chas Williams
On Tue, Apr 3, 2018 at 2:13 AM, Roopa Prabhu <ro...@cumulusnetworks.com> wrote:
> On Mon, Apr 2, 2018 at 8:26 AM, Chas Williams <3ch...@gmail.com> wrote:
>> On Mon, Apr 2, 2018 at 11:08 AM, Roopa Prabhu <ro...@cumulusnetworks.com> 
>> wrote:
>>>
>
> [snip]
>
>>> they are popular...in-fact they are the default bridge mode on our
>>> network switches.
>>> And they have been around for some time now to ignore its users.
>>> Plus it is not right to change default mtu behavior for one mode of the 
>>> bridge
>>> and not the others (bridge mtu handling from user-space is complex enough 
>>> today
>>> due to dynamic mtu changes on port enslave/deslave).
>>
>> I don't see the issue with one mode of bridge behaving differently
>> from another mode.
>> The VLAN behavior between the two bridge modes is completely different so 
>> having
>> a different MTU behavior doesn't seem that surprising.
>>
>> You are potentially mixing different sized VLAN on a same bridge.  The only 
>> sane
>> choice is to pick the largest MTU for the bridge.  This lets you have
>> whatever MTU
>> is appropriate on the child VLAN interfaces of the bridge.  If you
>> attempt to forward
>> from a port with a larger MTU to a smaller MTU, you get the expected 
>> behavior.
>
>
> you mean larger MTU on the vlan device on the bridge to a smaller MTU
> on the bridge port ?.
> this will result in dropping the packet. how is this supposed to be
> expected default behavior ?.

If a user configures the VLAN device to be a larger than MTU than the port,
then yes, I expect the packet to be dropped.  That's a msconfiguration of either
the VLAN's or port's MTU.  We can't protect the user from that by simply making
sure they can't mismatch the MTUs because you can still get packets dropped
during ingress from the large MTU VLAN.

>> Forcing the end user to configure all the ports to the maximum MTU of
>> all the VLANs
>> on the bridge is wrong IMHO.
>> You then risk attempting to forward
>> oversize packets
>> on a network that can't support that.
>
> I am a bit confused: Are you trying to solve the config problem by
> implicitly making it the default and there by creating the oversize
> packet drop issue by default ?

I am attempting to allow a configuration that lets me choose the appropriate
MTU size for each port.  With the previous code to configure a VLAN device
with an MTU of 9000, I would need to configure all the ports
on the bridge with an MTU of 9000 regardless of whether those ports should
be passing large MTU traffic.  I am creating a potential packet drop issue
by forwarding traffic between ports that have an artificially inflated MTUs.


>>>> I don't think those drops are unexpected.  If a user has misconfigured
>>>> the bridge
>>>> we can't be expected to fix that for them.  It is the user's
>>>> responsbility to ensure
>>>> that the ports on the VLAN have a size consistent with the traffic
>>>> they expect to
>>>> pass.
>>>>
>>>
>>> By default they are not expected today. The problem is changing the bridge
>>> to max mtu changes 'all' the vlan devices on top of the vlan aware bridge to
>>> max mtu by default which makes drops at the bridge driver more common if the
>>> user had mixed mtu on its ports.
>>
>> That's not been my experience.  The MTU on the vlan devices is only
>> limited by the
>> bridges's MTU.  Setting the bridge MTU doesn't change the children
>> VLAN devices MTUs.
>
> It does not, but it now allows vlan devices on the bridge to have a
> larger MTU if they need to (some or all of them).
> This is consistent with vxlan driver as well: picks default mtu to be
> lower or equal to the default dst dev mtu and allows user to override
> it with a larger MTU.

The VLAN device MTU can't be larger than the parent MTU.  The end user
is just going to set the parent bridge MTU to be larger anyway, so why not
just make that the default?


Re: [PATCH net-next] bridge: Allow max MTU when multiple VLANs present

2018-04-02 Thread Chas Williams
On Mon, Apr 2, 2018 at 11:08 AM, Roopa Prabhu <ro...@cumulusnetworks.com> wrote:
> On Fri, Mar 30, 2018 at 12:54 PM, Chas Williams <3ch...@gmail.com> wrote:
>> On Thu, Mar 29, 2018 at 9:02 PM, Toshiaki Makita
>> <makita.toshi...@lab.ntt.co.jp> wrote:
>>> On 2018/03/30 1:49, Roopa Prabhu wrote:
>>>> On Thu, Mar 22, 2018 at 9:53 PM, Roopa Prabhu <ro...@cumulusnetworks.com> 
>>>> wrote:
>>>>> On Thu, Mar 22, 2018 at 8:34 AM, Chas Williams <3ch...@gmail.com> wrote:
>>>>>> If the bridge is allowing multiple VLANs, some VLANs may have
>>>>>> different MTUs.  Instead of choosing the minimum MTU for the
>>>>>> bridge interface, choose the maximum MTU of the bridge members.
>>>>>> With this the user only needs to set a larger MTU on the member
>>>>>> ports that are participating in the large MTU VLANS.
>>>>>>
>>>>>> Signed-off-by: Chas Williams <3ch...@gmail.com>
>>>>>> ---
>>>>>
>>>>> Acked-by: Roopa Prabhu <ro...@cumulusnetworks.com>
>>>>>
>>>>> This or an equivalent fix is necessary: as stated above, today the
>>>>> bridge mtu capped at min port mtu limits all
>>>>> vlan devices on top of the vlan filtering bridge to min port mtu.
>>>>
>>>>
>>>> On further thought, since this patch changes default behavior, it may
>>>> upset people. ie with this patch, a vlan device
>>>> on the bridge by default will now use the  bridge max mtu and that
>>>> could cause unexpected drops in the bridge driver
>>>> if the xmit port had a lower mtu. This may surprise users.
>>
>> It only changes the default behavior when you are using VLAN aware bridges.
>> The behavior remains the same otherwise.  I don't know if VLAN aware bridges
>> are that popular yet so there probably isn't any particular
>> expectation from those
>> bridges.
>
> they are popular...in-fact they are the default bridge mode on our
> network switches.
> And they have been around for some time now to ignore its users.
> Plus it is not right to change default mtu behavior for one mode of the bridge
> and not the others (bridge mtu handling from user-space is complex enough 
> today
> due to dynamic mtu changes on port enslave/deslave).

I don't see the issue with one mode of bridge behaving differently
from another mode.
The VLAN behavior between the two bridge modes is completely different so having
a different MTU behavior doesn't seem that surprising.

You are potentially mixing different sized VLAN on a same bridge.  The only sane
choice is to pick the largest MTU for the bridge.  This lets you have
whatever MTU
is appropriate on the child VLAN interfaces of the bridge.  If you
attempt to forward
from a port with a larger MTU to a smaller MTU, you get the expected behavior.

Forcing the end user to configure all the ports to the maximum MTU of
all the VLANs
on the bridge is wrong IMHO.  You then risk attempting to forward
oversize packets
on a network that can't support that.

>
>>
>> I don't think those drops are unexpected.  If a user has misconfigured
>> the bridge
>> we can't be expected to fix that for them.  It is the user's
>> responsbility to ensure
>> that the ports on the VLAN have a size consistent with the traffic
>> they expect to
>> pass.
>>
>
> By default they are not expected today. The problem is changing the bridge
> to max mtu changes 'all' the vlan devices on top of the vlan aware bridge to
> max mtu by default which makes drops at the bridge driver more common if the
> user had mixed mtu on its ports.

That's not been my experience.  The MTU on the vlan devices is only
limited by the
bridges's MTU.  Setting the bridge MTU doesn't change the children
VLAN devices MTUs.


Re: [PATCH net-next] bridge: Allow max MTU when multiple VLANs present

2018-03-30 Thread Chas Williams
On Thu, Mar 29, 2018 at 9:02 PM, Toshiaki Makita
<makita.toshi...@lab.ntt.co.jp> wrote:
> On 2018/03/30 1:49, Roopa Prabhu wrote:
>> On Thu, Mar 22, 2018 at 9:53 PM, Roopa Prabhu <ro...@cumulusnetworks.com> 
>> wrote:
>>> On Thu, Mar 22, 2018 at 8:34 AM, Chas Williams <3ch...@gmail.com> wrote:
>>>> If the bridge is allowing multiple VLANs, some VLANs may have
>>>> different MTUs.  Instead of choosing the minimum MTU for the
>>>> bridge interface, choose the maximum MTU of the bridge members.
>>>> With this the user only needs to set a larger MTU on the member
>>>> ports that are participating in the large MTU VLANS.
>>>>
>>>> Signed-off-by: Chas Williams <3ch...@gmail.com>
>>>> ---
>>>
>>> Acked-by: Roopa Prabhu <ro...@cumulusnetworks.com>
>>>
>>> This or an equivalent fix is necessary: as stated above, today the
>>> bridge mtu capped at min port mtu limits all
>>> vlan devices on top of the vlan filtering bridge to min port mtu.
>>
>>
>> On further thought, since this patch changes default behavior, it may
>> upset people. ie with this patch, a vlan device
>> on the bridge by default will now use the  bridge max mtu and that
>> could cause unexpected drops in the bridge driver
>> if the xmit port had a lower mtu. This may surprise users.

It only changes the default behavior when you are using VLAN aware bridges.
The behavior remains the same otherwise.  I don't know if VLAN aware bridges
are that popular yet so there probably isn't any particular
expectation from those
bridges.

I don't think those drops are unexpected.  If a user has misconfigured
the bridge
we can't be expected to fix that for them.  It is the user's
responsbility to ensure
that the ports on the VLAN have a size consistent with the traffic
they expect to
pass.

>>
>> The other equivalent fix i was thinking about is to keep the default
>> behavior as is, and allow a max mtu to be
>> configured on the bridge. This will allow a sys admin to fix the
>> current mtu limitations if
>> deployments require it.
>>
>> we will submit an incremental patch to re-work this patch to restore
>> default behavior.
>
> +1
>
> This makes sense to me.
>
> --
> Toshiaki Makita
>


Re: [PATCH net-next] bridge: Allow max MTU when multiple VLANs present

2018-03-23 Thread Chas Williams
On Fri, Mar 23, 2018 at 12:20 PM, Nikolay Aleksandrov
<niko...@cumulusnetworks.com> wrote:
> On 23/03/18 18:17, David Miller wrote:
>> From: Chas Williams <3ch...@gmail.com>
>> Date: Thu, 22 Mar 2018 11:34:06 -0400
>>
>>> If the bridge is allowing multiple VLANs, some VLANs may have
>>> different MTUs.  Instead of choosing the minimum MTU for the
>>> bridge interface, choose the maximum MTU of the bridge members.
>>> With this the user only needs to set a larger MTU on the member
>>> ports that are participating in the large MTU VLANS.
>>>
>>> Signed-off-by: Chas Williams <3ch...@gmail.com>
>>
>> Applied, thanks.
>>
>
> Argh, this will break on builds without vlans because br->vlan_enabled 
> shouldn't
> be accessed directly. I missed that when reviewing.
> I'll send a follow up fix in a second that uses br_vlan_enabled().
>

Sorry I missed that one.  Thanks for covering!


[PATCH net-next] bridge: Allow max MTU when multiple VLANs present

2018-03-22 Thread Chas Williams
If the bridge is allowing multiple VLANs, some VLANs may have
different MTUs.  Instead of choosing the minimum MTU for the
bridge interface, choose the maximum MTU of the bridge members.
With this the user only needs to set a larger MTU on the member
ports that are participating in the large MTU VLANS.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 net/bridge/br.c |  2 +-
 net/bridge/br_device.c  |  2 +-
 net/bridge/br_if.c  | 26 ++
 net/bridge/br_private.h |  2 +-
 4 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/net/bridge/br.c b/net/bridge/br.c
index 7770481a6506..a3f95ab9d6a3 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -52,7 +52,7 @@ static int br_device_event(struct notifier_block *unused, 
unsigned long event, v
 
switch (event) {
case NETDEV_CHANGEMTU:
-   dev_set_mtu(br->dev, br_min_mtu(br));
+   dev_set_mtu(br->dev, br_mtu(br));
break;
 
case NETDEV_CHANGEADDR:
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 1285ca30ab0a..278fc999d355 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -224,7 +224,7 @@ static void br_get_stats64(struct net_device *dev,
 static int br_change_mtu(struct net_device *dev, int new_mtu)
 {
struct net_bridge *br = netdev_priv(dev);
-   if (new_mtu > br_min_mtu(br))
+   if (new_mtu > br_mtu(br))
return -EINVAL;
 
dev->mtu = new_mtu;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 9ba4ed65c52b..48dc4d2e2be3 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -424,8 +424,18 @@ int br_del_bridge(struct net *net, const char *name)
return ret;
 }
 
+static bool min_mtu(int a, int b)
+{
+   return a < b ? 1 : 0;
+}
+
+static bool max_mtu(int a, int b)
+{
+   return a > b ? 1 : 0;
+}
+
 /* MTU of the bridge pseudo-device: ETH_DATA_LEN or the minimum of the ports */
-int br_min_mtu(const struct net_bridge *br)
+static int __br_mtu(const struct net_bridge *br, bool (compare_fn)(int, int))
 {
const struct net_bridge_port *p;
int mtu = 0;
@@ -436,13 +446,21 @@ int br_min_mtu(const struct net_bridge *br)
mtu = ETH_DATA_LEN;
else {
list_for_each_entry(p, >port_list, list) {
-   if (!mtu  || p->dev->mtu < mtu)
+   if (!mtu || compare_fn(p->dev->mtu, mtu))
mtu = p->dev->mtu;
}
}
return mtu;
 }
 
+int br_mtu(const struct net_bridge *br)
+{
+   if (br->vlan_enabled)
+   return __br_mtu(br, max_mtu);
+   else
+   return __br_mtu(br, min_mtu);
+}
+
 static void br_set_gso_limits(struct net_bridge *br)
 {
unsigned int gso_max_size = GSO_MAX_SIZE;
@@ -594,7 +612,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev,
if (changed_addr)
call_netdevice_notifiers(NETDEV_CHANGEADDR, br->dev);
 
-   dev_set_mtu(br->dev, br_min_mtu(br));
+   dev_set_mtu(br->dev, br_mtu(br));
br_set_gso_limits(br);
 
kobject_uevent(>kobj, KOBJ_ADD);
@@ -641,7 +659,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
 */
del_nbp(p);
 
-   dev_set_mtu(br->dev, br_min_mtu(br));
+   dev_set_mtu(br->dev, br_mtu(br));
br_set_gso_limits(br);
 
spin_lock_bh(>lock);
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 8e13a64d8c99..048d5b51813b 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -578,7 +578,7 @@ int br_del_bridge(struct net *net, const char *name);
 int br_add_if(struct net_bridge *br, struct net_device *dev,
  struct netlink_ext_ack *extack);
 int br_del_if(struct net_bridge *br, struct net_device *dev);
-int br_min_mtu(const struct net_bridge *br);
+int br_mtu(const struct net_bridge *br);
 netdev_features_t br_features_recompute(struct net_bridge *br,
netdev_features_t features);
 void br_port_flags_change(struct net_bridge_port *port, unsigned long mask);
-- 
2.13.6



Re: net/atm: warning in alloc_tx/__might_sleep

2017-03-14 Thread Chas Williams
On Mon, 2017-03-13 at 18:43 +0100, Andrey Konovalov wrote:
> On Thu, Jan 12, 2017 at 11:40 AM, Chas Williams <3ch...@gmail.com> wrote:
> > On Wed, 2017-01-11 at 20:36 -0800, Cong Wang wrote:
> >> On Wed, Jan 11, 2017 at 11:46 AM, Michal Hocko <mho...@kernel.org> wrote:
> >> > On Wed 11-01-17 20:45:25, Michal Hocko wrote:
> >> >> On Wed 11-01-17 09:37:06, Chas Williams wrote:
> >> >> > On Mon, 2017-01-09 at 18:20 +0100, Andrey Konovalov wrote:
> >> >> > > Hi!
> >> >> > >
> >> >> > > I've got the following error report while running the syzkaller 
> >> >> > > fuzzer.
> >> >> > >
> >> >> > > On commit a121103c922847ba5010819a3f250f1f7fc84ab8 (4.10-rc3).
> >> >> > >
> >> >> > > A reproducer is attached.
> >> >> > >
> >> >> > > [ cut here ]
> >> >> > > WARNING: CPU: 0 PID: 4114 at kernel/sched/core.c:7737 
> >> >> > > __might_sleep+0x149/0x1a0
> >> >> > > do not call blocking ops when !TASK_RUNNING; state=1 set at
> >> >> > > [] prepare_to_wait+0x182/0x530
> >> >> > > Modules linked in:
> >> >> > > CPU: 0 PID: 4114 Comm: a.out Not tainted 4.10.0-rc3+ #59
> >> >> > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 
> >> >> > > 01/01/2011
> >> >> > > Call Trace:
> >> >> > >  __dump_stack lib/dump_stack.c:15
> >> >> > >  dump_stack+0x292/0x398 lib/dump_stack.c:51
> >> >> > >  __warn+0x19f/0x1e0 kernel/panic.c:547
> >> >> > >  warn_slowpath_fmt+0xc5/0x110 kernel/panic.c:562
> >> >> > >  __might_sleep+0x149/0x1a0 kernel/sched/core.c:7732
> >> >> > >  slab_pre_alloc_hook mm/slab.h:408
> >> >> > >  slab_alloc_node mm/slub.c:2634
> >> >> > >  kmem_cache_alloc_node+0x14a/0x280 mm/slub.c:2744
> >> >> > >  __alloc_skb+0x10f/0x800 net/core/skbuff.c:219
> >> >> > >  alloc_skb ./include/linux/skbuff.h:926
> >> >> > >  alloc_tx net/atm/common.c:75
> >> >> >
> >> >> > This is likely alloc_skb(..., GFP_KERNEL) in alloc_tx().  The simplest
> >> >> > fix for this would be simply to switch this GFP_ATOMIC.  See if this 
> >> >> > is
> >> >> > any better.
> >> >> >
> >> >> > diff --git a/net/atm/common.c b/net/atm/common.c
> >> >> > index a3ca922..d84220c 100644
> >> >> > --- a/net/atm/common.c
> >> >> > +++ b/net/atm/common.c
> >> >> > @@ -72,7 +72,7 @@ static struct sk_buff *alloc_tx(struct atm_vcc 
> >> >> > *vcc, unsigned int size)
> >> >> >  sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
> >> >> > return NULL;
> >> >> > }
> >> >> > -   while (!(skb = alloc_skb(size, GFP_KERNEL)))
> >> >> > +   while (!(skb = alloc_skb(size, GFP_ATOMIC)))
> >> >> > schedule();
> >> >> > pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
> >> >> > atomic_add(skb->truesize, >sk_wmem_alloc);
> >> >>
> >> >> Blee, this code is just horrendous. But the "fix" is obviously broken!
> >> >> schedule() is just a noop if you do not change the task state and what
> >> >> you are just asking for is a never failing non sleeping allocation - aka
> >> >> a busy loop in the kernel!
> >> >
> >> > And btw. this while loop should be really turned into GFP_KERNEL |
> >> > __GFP_NOFAIL with and explanation why this allocation cannot possibly
> >> > fail.
> >>
> >> I think a nested loop is quite unnecessary, probably due to the code itself
> >> is pretty old. The alloc_tx() is in the outer loop, the alloc_skb() is
> >> in the inner
> >> loop, both seem to wait for a successful GFP allocation. The inner one
> >> is even more unnecessary.
> >>
> >> Of course, I am not surprised MM may already have a mechanism to do
> >> the similar logic.
> >>
> >> There maybe some reason ATM needs such a logic, although other proto
> >> could handle skb allocation failure quite well in ->sendmsg().
> >
> >
> > I can't think of any particular reason that it needs this loop here.  I 
> > suspect
> > that the loop for alloc_tx() predates the wait logic in ->sendmsg() and 
> > that the
> > original looping was in alloc_tx() initially and was simply never removed.  
> > Changes
> > here would date back to before the git conversion.
> >
> 
> Hi,
> 
> I'm still seeing this on 4495c08e84729385774601b5146d51d9e5849f81 (4.11-rc2).
> 
> Thanks!

David Miller just accepted a patch for net-next that should resolve this issue.





[Patch net-next] atm: remove an unnecessary loop

2017-03-11 Thread Chas Williams
From: Francois Romieu <rom...@fr.zoreil.com>

Andrey reported this kernel warning:

WARNING: CPU: 0 PID: 4114 at kernel/sched/core.c:7737 __might_sleep+0x149/0x1a0
do not call blocking ops when !TASK_RUNNING; state=1 set at
[] prepare_to_wait+0x182/0x530

The deeply nested alloc_skb is a problem.

Diagnosis: nesting is wrong. It makes zero sense. Fix it and the
implicit task state change problem automagically goes away.

alloc_skb() does not need to be in the "while" loop.

alloc_skb() does not need to be in the {prepare_to_wait/add_wait_queue ...
finish_wait/remove_wait_queue} block.

I claim that:
- alloc_tx() should only perform the "wait_for_decent_tx_drain" part
- alloc_skb() ought to be done directly in vcc_sendmsg
- alloc_skb() failure can be handled gracefully in vcc_sendmsg
- alloc_skb() may use a (m->msg_flags & MSG_DONTWAIT) dependent
  GFP_{KERNEL / ATOMIC} flag

Reported-by: Andrey Konovalov <andreyk...@google.com>
Reviewed-and-Tested-by: Chas Williams <3ch...@gmail.com>
Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 net/atm/common.c | 22 +-
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
index 9613381..f06422f 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -62,21 +62,16 @@ static void vcc_remove_socket(struct sock *sk)
write_unlock_irq(_sklist_lock);
 }
 
-static struct sk_buff *alloc_tx(struct atm_vcc *vcc, unsigned int size)
+static bool vcc_tx_ready(struct atm_vcc *vcc, unsigned int size)
 {
-   struct sk_buff *skb;
struct sock *sk = sk_atm(vcc);
 
if (sk_wmem_alloc_get(sk) && !atm_may_send(vcc, size)) {
pr_debug("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",
 sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
-   return NULL;
+   return false;
}
-   while (!(skb = alloc_skb(size, GFP_KERNEL)))
-   schedule();
-   pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
-   atomic_add(skb->truesize, >sk_wmem_alloc);
-   return skb;
+   return true;
 }
 
 static void vcc_sock_destruct(struct sock *sk)
@@ -606,7 +601,7 @@ int vcc_sendmsg(struct socket *sock, struct msghdr *m, 
size_t size)
eff = (size+3) & ~3; /* align to word boundary */
prepare_to_wait(sk_sleep(sk), , TASK_INTERRUPTIBLE);
error = 0;
-   while (!(skb = alloc_tx(vcc, eff))) {
+   while (!vcc_tx_ready(vcc, eff)) {
if (m->msg_flags & MSG_DONTWAIT) {
error = -EAGAIN;
break;
@@ -628,6 +623,15 @@ int vcc_sendmsg(struct socket *sock, struct msghdr *m, 
size_t size)
finish_wait(sk_sleep(sk), );
if (error)
goto out;
+
+   skb = alloc_skb(eff, GFP_KERNEL);
+   if (!skb) {
+   error = -ENOMEM;
+   goto out;
+   }
+   pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
+   atomic_add(skb->truesize, >sk_wmem_alloc);
+
skb->dev = NULL; /* for paths shared with net_device interfaces */
ATM_SKB(skb)->atm_options = vcc->atm_options;
if (!copy_from_iter_full(skb_put(skb, size), size, >msg_iter)) {
-- 
2.7.4



Re: [Patch net] atm: remove an unnecessary loop

2017-01-14 Thread Chas Williams
On Fri, 2017-01-13 at 16:30 -0800, Cong Wang wrote:
> On Fri, Jan 13, 2017 at 3:54 PM, Chas Williams <3ch...@gmail.com> wrote:
> > On Fri, 2017-01-13 at 10:20 -0800, Cong Wang wrote:
> >> On Fri, Jan 13, 2017 at 9:10 AM, David Miller <da...@davemloft.net> wrote:
> >> > From: Francois Romieu <rom...@fr.zoreil.com>
> >> > Date: Fri, 13 Jan 2017 01:07:00 +0100
> >> >
> >> >> Were alloc_skb moved one level up in the call stack, there would be
> >> >> no need to use the new wait api in the subsequent page, thus easing
> >> >> pre 3.19 longterm kernel maintenance (at least those on korg page).
> >> >>
> >> >> But it tastes a tad bit too masochistic.
> >> >
> >> > Lack of error handling of allocation failure is always a huge red
> >> > flag.  We even long ago tried to do something like this for TCP FIN
> >> > handling.
> >> >
> >> > It's dumb, it doesn't work.
> >> >
> >> > Therefore I agree that the correct fix is to move the SKB allocation
> >> > up one level to vcc_sendmsg() and make it handle errors properly.
> >>
> >> If you can justify API is not broken by doing that, I am more than happy
> >> to do it, as I already stated in the latter patch:
> >
> > The man page for sendmsg() allows for ENOMEM.  See below.
> >
> 
> Errno is just one part, you miss the behavior behind the logic.
> 
> >>
> >> "Of course, the logic itself is suspicious, other sendmsg()
> >> could handle skb allocation failure very well, not sure
> >> why ATM has to wait for a successful one here. But probably
> >> it is too late to change since the errno and behavior is
> >> visible to user-space. So just leave the logic as it is."
> >>
> >> For some reason, no one reads that patch. :-/
> >
> > I read it and I agree.  I think it should be moved up/conflated with
> > vcc_sendmsg().  vcc_sendmsg() can already return an errno for other
> > conditions so if so has written something where they are explicitly
> > not expecting a ENOMEM, we really can't help them.
> 
> Nope, the reason is never ENOMEM is expected or not. The current
> _behavior_ behind this logic might be relied on by user-space.
> The behavior here is, when allocation fails, kernel will retry under
> certain circumstances, for example, if any fatal signal pending,
> returns ERESTARTSYS, etc.. This is what I worry, not just ENOMEM
> or not, which is too obvious.

Yes, and that behavior is certainly wrong.  Proving that nothing relies
on it would be very difficult since this is a negative supposition.

It's not clear to me that it is a good idea to ignore the pending signal
and just send the data.  At best, this seems like the signal is getting
ignored when the program might actaully want to do something about it.
The way the vcc sockets work, you are almost always waiting for "space
available to send".  Since vcc_sendmsg() has always been able to return
ERESTARTSYS for this condition, this isn't exactly new behavior, it
could just happen (very) slightly more often.

The loop in alloc_tx() also ignores the MSG_DONTWAIT flag.  The user
might end up waiting after all.  So that seems broken as well.  If
someone is expecting to wait with MSG_DONTWAIT when memory pressure
is present, I can't help them.  They are insane.

> Of course, I could be too conservative, I'd rather not to break things
> for -stable at least.
> 
> Thanks.


Re: [Patch net] atm: remove an unnecessary loop

2017-01-13 Thread Chas Williams
On Fri, 2017-01-13 at 10:20 -0800, Cong Wang wrote:
> On Fri, Jan 13, 2017 at 9:10 AM, David Miller  wrote:
> > From: Francois Romieu 
> > Date: Fri, 13 Jan 2017 01:07:00 +0100
> >
> >> Were alloc_skb moved one level up in the call stack, there would be
> >> no need to use the new wait api in the subsequent page, thus easing
> >> pre 3.19 longterm kernel maintenance (at least those on korg page).
> >>
> >> But it tastes a tad bit too masochistic.
> >
> > Lack of error handling of allocation failure is always a huge red
> > flag.  We even long ago tried to do something like this for TCP FIN
> > handling.
> >
> > It's dumb, it doesn't work.
> >
> > Therefore I agree that the correct fix is to move the SKB allocation
> > up one level to vcc_sendmsg() and make it handle errors properly.
> 
> If you can justify API is not broken by doing that, I am more than happy
> to do it, as I already stated in the latter patch:

The man page for sendmsg() allows for ENOMEM.  See below.

> 
> "Of course, the logic itself is suspicious, other sendmsg()
> could handle skb allocation failure very well, not sure
> why ATM has to wait for a successful one here. But probably
> it is too late to change since the errno and behavior is
> visible to user-space. So just leave the logic as it is."
> 
> For some reason, no one reads that patch. :-/

I read it and I agree.  I think it should be moved up/conflated with
vcc_sendmsg().  vcc_sendmsg() can already return an errno for other
conditions so if so has written something where they are explicitly
not expecting a ENOMEM, we really can't help them.

I would certainly prefer to not have to resort to an atomic allocation.
That's just going to make matters worse as far as similarity to the
existing API.

So, as Francois has suggested, just wait for the atm socket to
drain, and then do the allocation after the wait is finished.


Re: net/atm: warning in alloc_tx/__might_sleep

2017-01-12 Thread Chas Williams
On Wed, 2017-01-11 at 20:36 -0800, Cong Wang wrote:
> On Wed, Jan 11, 2017 at 11:46 AM, Michal Hocko <mho...@kernel.org> wrote:
> > On Wed 11-01-17 20:45:25, Michal Hocko wrote:
> >> On Wed 11-01-17 09:37:06, Chas Williams wrote:
> >> > On Mon, 2017-01-09 at 18:20 +0100, Andrey Konovalov wrote:
> >> > > Hi!
> >> > >
> >> > > I've got the following error report while running the syzkaller fuzzer.
> >> > >
> >> > > On commit a121103c922847ba5010819a3f250f1f7fc84ab8 (4.10-rc3).
> >> > >
> >> > > A reproducer is attached.
> >> > >
> >> > > [ cut here ]
> >> > > WARNING: CPU: 0 PID: 4114 at kernel/sched/core.c:7737 
> >> > > __might_sleep+0x149/0x1a0
> >> > > do not call blocking ops when !TASK_RUNNING; state=1 set at
> >> > > [] prepare_to_wait+0x182/0x530
> >> > > Modules linked in:
> >> > > CPU: 0 PID: 4114 Comm: a.out Not tainted 4.10.0-rc3+ #59
> >> > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 
> >> > > 01/01/2011
> >> > > Call Trace:
> >> > >  __dump_stack lib/dump_stack.c:15
> >> > >  dump_stack+0x292/0x398 lib/dump_stack.c:51
> >> > >  __warn+0x19f/0x1e0 kernel/panic.c:547
> >> > >  warn_slowpath_fmt+0xc5/0x110 kernel/panic.c:562
> >> > >  __might_sleep+0x149/0x1a0 kernel/sched/core.c:7732
> >> > >  slab_pre_alloc_hook mm/slab.h:408
> >> > >  slab_alloc_node mm/slub.c:2634
> >> > >  kmem_cache_alloc_node+0x14a/0x280 mm/slub.c:2744
> >> > >  __alloc_skb+0x10f/0x800 net/core/skbuff.c:219
> >> > >  alloc_skb ./include/linux/skbuff.h:926
> >> > >  alloc_tx net/atm/common.c:75
> >> >
> >> > This is likely alloc_skb(..., GFP_KERNEL) in alloc_tx().  The simplest
> >> > fix for this would be simply to switch this GFP_ATOMIC.  See if this is
> >> > any better.
> >> >
> >> > diff --git a/net/atm/common.c b/net/atm/common.c
> >> > index a3ca922..d84220c 100644
> >> > --- a/net/atm/common.c
> >> > +++ b/net/atm/common.c
> >> > @@ -72,7 +72,7 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc, 
> >> > unsigned int size)
> >> >  sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
> >> > return NULL;
> >> > }
> >> > -   while (!(skb = alloc_skb(size, GFP_KERNEL)))
> >> > +   while (!(skb = alloc_skb(size, GFP_ATOMIC)))
> >> > schedule();
> >> > pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
> >> > atomic_add(skb->truesize, >sk_wmem_alloc);
> >>
> >> Blee, this code is just horrendous. But the "fix" is obviously broken!
> >> schedule() is just a noop if you do not change the task state and what
> >> you are just asking for is a never failing non sleeping allocation - aka
> >> a busy loop in the kernel!
> >
> > And btw. this while loop should be really turned into GFP_KERNEL |
> > __GFP_NOFAIL with and explanation why this allocation cannot possibly
> > fail.
> 
> I think a nested loop is quite unnecessary, probably due to the code itself
> is pretty old. The alloc_tx() is in the outer loop, the alloc_skb() is
> in the inner
> loop, both seem to wait for a successful GFP allocation. The inner one
> is even more unnecessary.
> 
> Of course, I am not surprised MM may already have a mechanism to do
> the similar logic.
> 
> There maybe some reason ATM needs such a logic, although other proto
> could handle skb allocation failure quite well in ->sendmsg().


I can't think of any particular reason that it needs this loop here.  I suspect
that the loop for alloc_tx() predates the wait logic in ->sendmsg() and that the
original looping was in alloc_tx() initially and was simply never removed.  
Changes
here would date back to before the git conversion.



Re: net/atm: warning in alloc_tx/__might_sleep

2017-01-11 Thread Chas Williams
On Mon, 2017-01-09 at 18:20 +0100, Andrey Konovalov wrote:
> Hi!
> 
> I've got the following error report while running the syzkaller fuzzer.
> 
> On commit a121103c922847ba5010819a3f250f1f7fc84ab8 (4.10-rc3).
> 
> A reproducer is attached.
> 
> [ cut here ]
> WARNING: CPU: 0 PID: 4114 at kernel/sched/core.c:7737 
> __might_sleep+0x149/0x1a0
> do not call blocking ops when !TASK_RUNNING; state=1 set at
> [] prepare_to_wait+0x182/0x530
> Modules linked in:
> CPU: 0 PID: 4114 Comm: a.out Not tainted 4.10.0-rc3+ #59
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:15
>  dump_stack+0x292/0x398 lib/dump_stack.c:51
>  __warn+0x19f/0x1e0 kernel/panic.c:547
>  warn_slowpath_fmt+0xc5/0x110 kernel/panic.c:562
>  __might_sleep+0x149/0x1a0 kernel/sched/core.c:7732
>  slab_pre_alloc_hook mm/slab.h:408
>  slab_alloc_node mm/slub.c:2634
>  kmem_cache_alloc_node+0x14a/0x280 mm/slub.c:2744
>  __alloc_skb+0x10f/0x800 net/core/skbuff.c:219
>  alloc_skb ./include/linux/skbuff.h:926
>  alloc_tx net/atm/common.c:75

This is likely alloc_skb(..., GFP_KERNEL) in alloc_tx().  The simplest
fix for this would be simply to switch this GFP_ATOMIC.  See if this is
any better.

diff --git a/net/atm/common.c b/net/atm/common.c
index a3ca922..d84220c 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -72,7 +72,7 @@ static struct sk_buff *alloc_tx(struct atm_vcc *vcc, unsigned 
int size)
 sk_wmem_alloc_get(sk), size, sk->sk_sndbuf);
return NULL;
}
-   while (!(skb = alloc_skb(size, GFP_KERNEL)))
+   while (!(skb = alloc_skb(size, GFP_ATOMIC)))
schedule();
pr_debug("%d += %d\n", sk_wmem_alloc_get(sk), skb->truesize);
atomic_add(skb->truesize, >sk_wmem_alloc);


4.4 Backport request 4d06dd537f95 cdc_ncm: do not call usbnet_link_change from cdc_ncm_bind

2016-07-19 Thread Chas Williams
Can

4d06dd537f95 cdc_ncm: do not call usbnet_link_change from cdc_ncm_bind

be added to 4.4 stable?  This fixes CVE-2016-3951 [The second half
necessary for a complete fix, 666984c8625 ("usbnet: cleanup after bind()
in probe()"), is already present in 4.4.]

Thanks!


[PATCH net-next] ixgbe: Extend trust to allow guest to set unicast address

2016-01-05 Thread Chas Williams
When running certain routing protocols like VRRP, VF guests need the
ability to set the unicast address of the interface.  Extend the new ndo
trust feature to let the hypervisor trust a guest to set/update its own
unicast address.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index eeff3d0..63cff17 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -887,7 +887,7 @@ static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter 
*adapter,
return -1;
}
 
-   if (adapter->vfinfo[vf].pf_set_mac &&
+   if (adapter->vfinfo[vf].pf_set_mac && !adapter->vfinfo[vf].trusted &&
!ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) {
e_warn(drv,
   "VF %d attempted to override administratively set MAC 
address\n"
-- 
2.5.0

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


[PATCH net-next] ixgbe: Extend trust to allow guest to set unicast address

2016-01-01 Thread Chas Williams
When running certain routing protocols like VRRP, VF guests need the
ability to set the unicast address of the interface.  Extend the new ndo
trust feature to let the hypervisor trust a guest to set/update its own
unicast address.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index eeff3d0..63cff17 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -887,7 +887,7 @@ static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter 
*adapter,
return -1;
}
 
-   if (adapter->vfinfo[vf].pf_set_mac &&
+   if (adapter->vfinfo[vf].pf_set_mac && !adapter->vfinfo[vf].trusted &&
!ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) {
e_warn(drv,
   "VF %d attempted to override administratively set MAC 
address\n"
-- 
2.5.0

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


[PATCH net-next] ixgbe: Extend trust to allow guest to set unicast address

2015-12-31 Thread Chas Williams
When running certain routing protocols like VRRP, VF guests need the
ability to set the unicast address of the interface.  Extend the new ndo
trust feature to let the hypervisor trust a guest to set/update its own
unicast address.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index eeff3d0..63cff17 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -887,7 +887,7 @@ static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter 
*adapter,
return -1;
}
 
-   if (adapter->vfinfo[vf].pf_set_mac &&
+   if (adapter->vfinfo[vf].pf_set_mac && !adapter->vfinfo[vf].trusted &&
!ether_addr_equal(adapter->vfinfo[vf].vf_mac_addresses, new_mac)) {
e_warn(drv,
   "VF %d attempted to override administratively set MAC 
address\n"
-- 
2.5.0

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


Re: [PATCH v3 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint

2015-12-03 Thread Charles (Chas) Williams
On Thu, 2015-12-03 at 09:06 +0100, LABBE Corentin wrote:
> @@ -357,11 +357,11 @@ static int process_status(struct solos_card *card, int 
> port, struct sk_buff *skb
>   if (!str)
>   return -EIO;
>  
> - ver = simple_strtol(str, NULL, 10);
> - if (ver < 1) {
> + err = kstrtoint(str, 10, );
> + if (err || ver < 1) {
>   dev_warn(>dev->dev, "Unexpected status interrupt version 
> %d\n",
>ver);
> - return -EIO;
> + return err;


If ver < 1 then you might return a 0 here.  Always returning -EIO is
probably just fine.


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


Re: [PATCH v3 1/1] atm: solos-pci: Replace simple_strtol by kstrtoint

2015-12-03 Thread Charles (Chas) Williams
On Thu, 2015-12-03 at 13:58 +0100, LABBE Corentin wrote:
> On Thu, Dec 03, 2015 at 06:26:31AM -0500, Charles (Chas) Williams wrote:
> > On Thu, 2015-12-03 at 09:06 +0100, LABBE Corentin wrote:
> > > @@ -357,11 +357,11 @@ static int process_status(struct solos_card *card, 
> > > int port, struct sk_buff *skb
> > >   if (!str)
> > >   return -EIO;
> > >  
> > > - ver = simple_strtol(str, NULL, 10);
> > > - if (ver < 1) {
> > > + err = kstrtoint(str, 10, );
> > > + if (err || ver < 1) {
> > >   dev_warn(>dev->dev, "Unexpected status interrupt version 
> > > %d\n",
> > >ver);
> > > - return -EIO;
> > > + return err;
> > 
> > 
> > If ver < 1 then you might return a 0 here.  Always returning -EIO is
> > probably just fine.
> > 
> 
> Hello
> 
> I think the best solution is to split the test, since returning error code 
> from kstrtoint was asked by David Miller.
> if (err)
>   return err;
> if (ver < 1)
>   return -EIO;
> Thanks
> Regards

That's fine.  You just shouldn't return 0 if the ver < 1.  This isn't
timing critical code.

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


Re: [PATCH -stable] multiple backports requested

2015-11-15 Thread Charles (Chas) Williams
On Fri, 2015-11-13 at 16:10 -0500, David Miller wrote:
> From: "Charles (Chas) Williams" <3ch...@gmail.com>
> Date: Fri, 13 Nov 2015 15:13:11 -0500
> 
> > Dave, could you please add the following backports?
> > 
> > For the 3.14.y stable queue:
> 
> I am no longer handling 3.14.y -stable submissions, sorry...

To whom should I send these requests?



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


Re: [PATCH -stable] multiple backports requested

2015-11-14 Thread Charles (Chas) Williams
On Fri, 2015-11-13 at 16:10 -0500, David Miller wrote:
> From: "Charles (Chas) Williams" <3ch...@gmail.com>
> Date: Fri, 13 Nov 2015 15:13:11 -0500
> 
> > Dave, could you please add the following backports?
> > 
> > For the 3.14.y stable queue:
> 
> I am no longer handling 3.14.y -stable submissions, sorry...
> 
> > For the 4.1.y stable queue:
> > 
> > commit 74e98eb085889b0d2d4908f59f6e00026063014f
> > RDS: verify the underlying transport exists before creating a connection
> > This addresses CVE-2015-6937
> 
> Queued up for 3.18, 4.1, and 4.2.

And 3.14?


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


[PATCH -stable] multiple backports requested

2015-11-13 Thread Charles (Chas) Williams
Dave, could you please add the following backports?

For the 3.14.y stable queue:
commit 77751427a1ff25b27d47a4c36b12c3c8667855ac
ipv6: addrconf: validate new MTU before applying it
This addresses CVE-2015-0272

commit 74e98eb085889b0d2d4908f59f6e00026063014f
RDS: verify the underlying transport exists before creating a connection
This addresses CVE-2015-6937

For the 4.1.y stable queue:

commit 74e98eb085889b0d2d4908f59f6e00026063014f
RDS: verify the underlying transport exists before creating a connection
This addresses CVE-2015-6937

Thanks!


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


[PATCH -stable] virtio-net: drop NETIF_F_FRAGLIST

2015-11-10 Thread Charles (Chas) Williams
Dave, could you please add

commit 48900cb6af4282fa0fb6ff4d72a81aa3dadb5c39
virtio-net: drop NETIF_F_FRAGLIST

to your stable queues for 3.14.y and 4.1.y?

This fixes CVE-2015-5156,
https://security-tracker.debian.org/tracker/CVE-2015-5156




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


Re: [PATCH 0/2] atm: iphase: Fix misleading indention and return -ENOMEM on error

2015-10-12 Thread Charles (Chas) Williams
On Sat, 2015-10-10 at 21:47 +0200, Tillmann Heidsieck wrote:
> this series fixes two of them. The if(); warning would require
> restructuring the code to a larger extend. Beyond this there remains a
> whooping number of > 2k checkpatch.pl warnings and errors each. Those
> can be grouped into 
...
> Generally I would not mind cleaning all this up for those who have to
> make functional changes to the driver. However, I would like to know
> from the maintainers if such an afford would be welcome or not.

It doesn't bother me if you do this.  I can review it.


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


Request for stable-4.1.y stable inclusion

2015-10-05 Thread Charles (Chas) Williams
Hello Dave,

Could you please backport the following to stable-4.1.y:

commit 74e98eb085889b0d2d4908f59f6e00026063014f -- RDS: verify
the underlying transport exists before creating a connection

This fixes CVE-2015-6937.

commit 48900cb6af4282fa0fb6ff4d72a81aa3dadb5c39 -- virtio-net:
drop NETIF_F_FRAGLIST

This fixes CVE-2015-5156.

Thanks!


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


Re: [PATCH 07/12] atm: hide 'struct zatm_t_hist'

2015-09-30 Thread Charles (Chas) Williams
On Wed, 2015-09-30 at 13:26 +0200, Arnd Bergmann wrote:
> The zatm_t_hist structure is not used anywhere in the kernel, but is
> exported to user space. As we are trying to eliminate uses of time_t
> in the kernel for y2038 compatibility, the current definition triggers
> checking tools because it contains 'struct timeval'.
> 
> We can work around this by adding '#ifdef __KERNEL__'. I could not find
> out what the structure is actually used for, so this is the safe choice
> in case there is some user space tool that relies on the definition.
> 
> If we are sure that nothing in user space relies on the structure, we
> can instead remove the definition completely.

It was used by the ZATM_GETHIST ioctl which is long since gone in the
kernel driver.  You can just remove this.

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


[linux 3.14-stable] virtio-net: drop NETIF_F_FRAGLIST

2015-09-29 Thread Charles (Chas) Williams
From: Jason Wang <jasow...@redhat.com>

commit 48900cb6af4282fa0fb6ff4d72a81aa3dadb5c39 upstream.

virtio declares support for NETIF_F_FRAGLIST, but assumes
that there are at most MAX_SKB_FRAGS + 2 fragments which isn't
always true with a fraglist.

A longer fraglist in the skb will make the call to skb_to_sgvec overflow
the sg array, leading to memory corruption.

Drop NETIF_F_FRAGLIST so we only get what we can handle.

Fixes CVE-2015-5156.

Cc: Michael S. Tsirkin <m...@redhat.com>
Signed-off-by: Jason Wang <jasow...@redhat.com>
Acked-by: Michael S. Tsirkin <m...@redhat.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 841b608..5c150a0 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1652,9 +1652,9 @@ static int virtnet_probe(struct virtio_device *vdev)
/* Do we support "hardware" checksums? */
if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) {
/* This opens up the world of extra features. */
-   dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
+   dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG;
if (csum)
-   dev->features |= 
NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
+   dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
 
if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
-- 
2.1.0



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


[linux 3.14-stable] ipv6: addrconf: validate new MTU before applying it

2015-09-29 Thread Charles (Chas) Williams
From: Marcelo Leitner <mleit...@redhat.com>

commit 77751427a1ff25b27d47a4c36b12c3c8667855ac upstream.

Currently we don't check if the new MTU is valid or not and this allows
one to configure a smaller than minimum allowed by RFCs or even bigger
than interface own MTU, which is a problem as it may lead to packet
drops.

If you have a daemon like NetworkManager running, this may be exploited
by remote attackers by forging RA packets with an invalid MTU, possibly
leading to a DoS. (NetworkManager currently only validates for values
too small, but not for too big ones.)

The fix is just to make sure the new value is valid. That is, between
IPV6_MIN_MTU and interface's MTU.

Note that similar check is already performed at
ndisc_router_discovery(), for when kernel itself parses the RA.

Fixes CVE-2015-0272.

Signed-off-by: Marcelo Ricardo Leitner <mleit...@redhat.com>
Signed-off-by: Sabrina Dubroca <s...@queasysnail.net>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 net/ipv6/addrconf.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3f0ec06..7b74fca 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4793,6 +4793,21 @@ int addrconf_sysctl_forward(struct ctl_table *ctl, int 
write,
return ret;
 }
 
+static
+int addrconf_sysctl_mtu(struct ctl_table *ctl, int write,
+   void __user *buffer, size_t *lenp, loff_t *ppos)
+{
+   struct inet6_dev *idev = ctl->extra1;
+   int min_mtu = IPV6_MIN_MTU;
+   struct ctl_table lctl;
+
+   lctl = *ctl;
+   lctl.extra1 = _mtu;
+   lctl.extra2 = idev ? >dev->mtu : NULL;
+
+   return proc_dointvec_minmax(, write, buffer, lenp, ppos);
+}
+
 static void dev_disable_change(struct inet6_dev *idev)
 {
struct netdev_notifier_info info;
@@ -4944,7 +4959,7 @@ static struct addrconf_sysctl_table
.data   = _devconf.mtu6,
.maxlen = sizeof(int),
.mode   = 0644,
-   .proc_handler   = proc_dointvec,
+   .proc_handler   = addrconf_sysctl_mtu,
},
{
.procname   = "accept_ra",
-- 
2.1.0




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


[linux 3.14-stable] RDS: verify the underlying transport exists before creating a connection

2015-09-29 Thread Charles (Chas) Williams
From: Sasha Levin <sasha.le...@oracle.com>

commit 74e98eb085889b0d2d4908f59f6e00026063014f upstream.

There was no verification that an underlying transport exists when creating
a connection, this would cause dereferencing a NULL ptr.

It might happen on sockets that weren't properly bound before attempting to
send a message, which will cause a NULL ptr deref:

[135546.047719] kasan: GPF could be caused by NULL-ptr deref or user memory 
accessgeneral protection fault:  [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN
[135546.051270] Modules linked in:
[135546.051781] CPU: 4 PID: 15650 Comm: trinity-c4 Not tainted 
4.2.0-next-20150902-sasha-00041-gbaa1222-dirty #2527
[135546.053217] task: 8800835bc000 ti: 8800bc708000 task.ti: 
8800bc708000
[135546.054291] RIP: __rds_conn_create (net/rds/connection.c:194)
[135546.055666] RSP: 0018:8800bc70fab0  EFLAGS: 00010202
[135546.056457] RAX: dc00 RBX: 0f2c RCX: 
8800835bc000
[135546.057494] RDX: 0007 RSI: 8800835bccd8 RDI: 
0038
[135546.058530] RBP: 8800bc70fb18 R08: 0001 R09: 

[135546.059556] R10: ed014d7a3a23 R11: ed014d7a3a21 R12: 

[135546.060614] R13: 0001 R14: 8801ec3d R15: 

[135546.061668] FS:  7faad4ffb700() GS:88025200() 
knlGS:
[135546.062836] CS:  0010 DS:  ES:  CR0: 8005003b
[135546.063682] CR2: 846a CR3: 9d137000 CR4: 
06a0
[135546.064723] Stack:
[135546.065048]  afe2055c afe23fc1 ed00493097bf 
8801ec3d0008
[135546.066247]   00d0  
ac194a24c0586342
[135546.067438]  1100178e1f78 880320581b00 8800bc70fdd0 
880320581b00
[135546.068629] Call Trace:
[135546.069028] ? __rds_conn_create (include/linux/rcupdate.h:856 
net/rds/connection.c:134)
[135546.069989] ? rds_message_copy_from_user (net/rds/message.c:298)
[135546.071021] rds_conn_create_outgoing (net/rds/connection.c:278)
[135546.071981] rds_sendmsg (net/rds/send.c:1058)
[135546.072858] ? perf_trace_lock (include/trace/events/lock.h:38)
[135546.073744] ? lockdep_init (kernel/locking/lockdep.c:3298)
[135546.074577] ? rds_send_drop_to (net/rds/send.c:976)
[135546.075508] ? __might_fault (./arch/x86/include/asm/current.h:14 
mm/memory.c:3795)
[135546.076349] ? __might_fault (mm/memory.c:3795)
[135546.077179] ? rds_send_drop_to (net/rds/send.c:976)
[135546.078114] sock_sendmsg (net/socket.c:611 net/socket.c:620)
[135546.078856] SYSC_sendto (net/socket.c:1657)
[135546.079596] ? SYSC_connect (net/socket.c:1628)
[135546.080510] ? trace_dump_stack (kernel/trace/trace.c:1926)
[135546.081397] ? ring_buffer_unlock_commit (kernel/trace/ring_buffer.c:2479 
kernel/trace/ring_buffer.c:2558 kernel/trace/ring_buffer.c:2674)
[135546.082390] ? trace_buffer_unlock_commit (kernel/trace/trace.c:1749)
[135546.083410] ? trace_event_raw_event_sys_enter 
(include/trace/events/syscalls.h:16)
[135546.084481] ? do_audit_syscall_entry (include/trace/events/syscalls.h:16)
[135546.085438] ? trace_buffer_unlock_commit (kernel/trace/trace.c:1749)
[135546.085515] rds_ib_laddr_check(): addr 36.74.25.172 ret -99 node type -1

Fixes CVE-2015-6937.

Acked-by: Santosh Shilimkar <santosh.shilim...@oracle.com>
Signed-off-by: Sasha Levin <sasha.le...@oracle.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 net/rds/connection.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/net/rds/connection.c b/net/rds/connection.c
index 378c3a6..f5fb7d6 100644
--- a/net/rds/connection.c
+++ b/net/rds/connection.c
@@ -183,6 +183,12 @@ static struct rds_connection *__rds_conn_create(__be32 
laddr, __be32 faddr,
}
}
 
+   if (trans == NULL) {
+   kmem_cache_free(rds_conn_slab, conn);
+   conn = ERR_PTR(-ENODEV);
+   goto out;
+   }
+
conn->c_trans = trans;
 
ret = trans->conn_alloc(conn, gfp);
-- 
2.1.0



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


[PATCH net-next v2] xen-netfront: always set num queues if possible

2015-09-16 Thread Charles (Chas) Williams
If netfront connects with two (or more) queues and then reconnects with
only one queue it fails to delete or rewrite the multi-queue-num-queues
key and netback will try to use the wrong number of queues.

Always write the num-queues field if the backend has multi-queue support.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/xen-netfront.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index f821a97..9bf63c2 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1819,19 +1819,22 @@ again:
goto destroy_ring;
}
 
-   if (num_queues == 1) {
-   err = write_queue_xenstore_keys(>queues[0], , 0); /* 
flat */
-   if (err)
-   goto abort_transaction_no_dev_fatal;
-   } else {
+   if (xenbus_exists(XBT_NIL,
+ info->xbdev->otherend, "multi-queue-max-queues")) {
/* Write the number of queues */
-   err = xenbus_printf(xbt, dev->nodename, 
"multi-queue-num-queues",
-   "%u", num_queues);
+   err = xenbus_printf(xbt, dev->nodename,
+   "multi-queue-num-queues", "%u", num_queues);
if (err) {
message = "writing multi-queue-num-queues";
goto abort_transaction_no_dev_fatal;
}
+   }
 
+   if (num_queues == 1) {
+   err = write_queue_xenstore_keys(>queues[0], , 0); /* 
flat */
+   if (err)
+   goto abort_transaction_no_dev_fatal;
+   } else {
/* Write the keys for each queue */
for (i = 0; i < num_queues; ++i) {
queue = >queues[i];
-- 
2.1.0



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


Re: [Xen-devel] [PATCH net-next] xen-netfront: always set num queues if possible

2015-09-15 Thread Charles (Chas) Williams
On Tue, 2015-09-15 at 11:59 +0100, David Vrabel wrote:
> On 14/09/15 22:28, Charles (Chas) Williams wrote:
> > The xen store preserves this information across module invocations.
> > If you insmod netfront with two queues and later insmod again with one
> > queue, the backend will still believe you asked for two queues.
> 
> Can you rewrite the commit message to be clearer?
> 
> "If netfront connects with 2 (or more) queues and then reconnects with
> only 1 queue it fails to delete or rewrite the multi-queue-num-queues
> key and netback will try to use the wrong number of queues.
> 
> Always write the num-queues field if the backend has multi-queue support."

Yes I can do that.

> 
> > --- a/drivers/net/xen-netfront.c
> > +++ b/drivers/net/xen-netfront.c
> > @@ -1819,11 +1819,7 @@ again:
> > goto destroy_ring;
> > }
> >  
> > -   if (num_queues == 1) {
> > -   err = write_queue_xenstore_keys(>queues[0], , 0); /* 
> > flat */
> > -   if (err)
> > -   goto abort_transaction_no_dev_fatal;
> > -   } else {
> > +   if (xenbus_exists(xbt, dev->nodename, "multi-queue-num-queues")) {
> > /* Write the number of queues */
> > err = xenbus_printf(xbt, dev->nodename, 
> > "multi-queue-num-queues",
> > "%u", num_queues);
> 
> Isn't this broken?  It looks like it won't write the
> multi-queue-num-queues key the first time around.
> 
> It think this should be conditional on multi-queue-max-queues existing
> (which is written by the backend if multi-queue is supported).

You are right.  I am testing against the wrong key here.  I should have
tested for multi-queue-max-queues.


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


[PATCH net-next] xen-netfront: always set num queues if possible

2015-09-15 Thread Charles (Chas) Williams
If netfront connects with two (or more) queues and then reconnects with
only one queue it fails to delete or rewrite the multi-queue-num-queues
key and netback will try to use the wrong number of queues.

Always write the num-queues field if the backend has multi-queue support.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/xen-netfront.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index f821a97..7f8b7bd 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1819,11 +1819,7 @@ again:
goto destroy_ring;
}
 
-   if (num_queues == 1) {
-   err = write_queue_xenstore_keys(>queues[0], , 0); /* 
flat */
-   if (err)
-   goto abort_transaction_no_dev_fatal;
-   } else {
+   if (xenbus_exists(xbt, dev->nodename, "multi-queue-max-queues")) {
/* Write the number of queues */
err = xenbus_printf(xbt, dev->nodename, 
"multi-queue-num-queues",
"%u", num_queues);
@@ -1831,7 +1827,13 @@ again:
message = "writing multi-queue-num-queues";
goto abort_transaction_no_dev_fatal;
}
+   }
 
+   if (num_queues == 1) {
+   err = write_queue_xenstore_keys(>queues[0], , 0); /* 
flat */
+   if (err)
+   goto abort_transaction_no_dev_fatal;
+   } else {
/* Write the keys for each queue */
for (i = 0; i < num_queues; ++i) {
queue = >queues[i];
-- 
2.1.0



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


[PATCH net-next] xen-netfront: always set num queues if possible

2015-09-14 Thread Charles (Chas) Williams
The xen store preserves this information across module invocations.
If you insmod netfront with two queues and later insmod again with one
queue, the backend will still believe you asked for two queues.

Signed-off-by: Chas Williams <3ch...@gmail.com>
---
 drivers/net/xen-netfront.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index f821a97..b53a681 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1819,11 +1819,7 @@ again:
goto destroy_ring;
}
 
-   if (num_queues == 1) {
-   err = write_queue_xenstore_keys(>queues[0], , 0); /* 
flat */
-   if (err)
-   goto abort_transaction_no_dev_fatal;
-   } else {
+   if (xenbus_exists(xbt, dev->nodename, "multi-queue-num-queues")) {
/* Write the number of queues */
err = xenbus_printf(xbt, dev->nodename, 
"multi-queue-num-queues",
"%u", num_queues);
@@ -1831,7 +1827,13 @@ again:
message = "writing multi-queue-num-queues";
goto abort_transaction_no_dev_fatal;
}
+   }
 
+   if (num_queues == 1) {
+   err = write_queue_xenstore_keys(>queues[0], , 0); /* 
flat */
+   if (err)
+   goto abort_transaction_no_dev_fatal;
+   } else {
/* Write the keys for each queue */
for (i = 0; i < num_queues; ++i) {
queue = >queues[i];
-- 
2.1.0



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


[PATCH net-next] net/xen-netfront: only napi_synchronize() if running

2015-08-27 Thread Charles (Chas) Williams
From: Chas Williams 3ch...@gmail.com

If an interface isn't running napi_synchronize() will hang forever.

[  392.248403] rmmod   R  running task0   359343 0x
[  392.257671]  88003760fc88 880037193b40 880037193160 
88003760fc88
[  392.267644]  88003761 88003760fcd8 000100014c22 
81f75c40
[  392.277524]  00bc7010 88003760fca8 81796927 
81f75c40
[  392.287323] Call Trace:
[  392.291599]  [81796927] schedule+0x37/0x90
[  392.298553]  [8179985b] schedule_timeout+0x14b/0x280
[  392.306421]  [810f91b9] ? irq_free_descs+0x69/0x80
[  392.314006]  [811084d0] ? internal_add_timer+0xb0/0xb0
[  392.322125]  [81109d07] msleep+0x37/0x50
[  392.329037]  [a00ec79a] 
xennet_disconnect_backend.isra.24+0xda/0x390 [xen_netfront]
[  392.339658]  [a00ecadc] xennet_remove+0x2c/0x80 [xen_netfront]
[  392.348516]  [81481c69] xenbus_dev_remove+0x59/0xc0
[  392.356257]  [814e7217] __device_release_driver+0x87/0x120
[  392.364645]  [814e7cf8] driver_detach+0xb8/0xc0
[  392.371989]  [814e6e69] bus_remove_driver+0x59/0xe0
[  392.379883]  [814e84f0] driver_unregister+0x30/0x70
[  392.387495]  [814814b2] xenbus_unregister_driver+0x12/0x20
[  392.395908]  [a00ed89b] netif_exit+0x10/0x775 [xen_netfront]
[  392.404877]  [81124e08] SyS_delete_module+0x1d8/0x230
[  392.412804]  [8179a8ee] system_call_fastpath+0x12/0x71

Signed-off-by: Chas Williams 3ch...@gmail.com
---
 drivers/net/xen-netfront.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index f948c46..5ff0cfd 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1348,7 +1348,8 @@ static void xennet_disconnect_backend(struct 
netfront_info *info)
queue-tx_evtchn = queue-rx_evtchn = 0;
queue-tx_irq = queue-rx_irq = 0;
 
-   napi_synchronize(queue-napi);
+   if (netif_running(info-netdev))
+   napi_synchronize(queue-napi);
 
xennet_release_tx_bufs(queue);
xennet_release_rx_bufs(queue);
-- 
2.1.0



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


xen-netfront: bug with napi_synchronize()

2015-08-20 Thread Charles (Chas) Williams
I have seen some hangs in recent versions of the xen-netfront driver.
If I unload or unbind the driver immediately befor bringing up the
interface, I get a hang as show in the traceback here.


...
[  194.037351]  [810ae1a7] ? msleep+0x27/0x30
[  194.037358]  [a004b48a] ? xennet_disconnect_backend+0xfa/0x390 
[xen_netfront]
[  194.037364]  [a004b789] ? xennet_remove+0x19/0x60 [xen_netfront]
[  194.037368]  [8132971b] ? xenbus_dev_remove+0x4b/0xa0
[  194.037375]  [8137bf41] ? __device_release_driver+0x81/0x120
[  194.037378]  [8137bffd] ? device_release_driver+0x1d/0x30
[  194.037382]  [8137b340] ? unbind_store+0xf0/0x150
...

This offset in xennet_disconnect_backend is approximately in the area
of napi_synchronize().  napi_synchronize() does contain an msleep()
and nothing else would really sleep in this routine.

queue-tx_evtchn = queue-rx_evtchn = 0;
queue-tx_irq = queue-rx_irq = 0;

napi_synchronize(queue-napi);

xennet_release_tx_bufs(queue);
xennet_release_rx_bufs(queue);

Since I never started the interface, I know napi_enable() was never
called on queue-napi.  However, what is the expected behavior for
napi_synchronize() on something that was never enabled/disabled?


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


Re: converting fore200e driver to use request_firmware()

2008-02-07 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
 however, i ran into a little problem with the sbus interface.  what should
 i pass for 'struct device *' for an sbus device?

sdev-ofdev.dev should work

thanks!  that is what i needed.  so what i have works on pci and is
quite a bit cleaner than the current mess for the firmware.  the only
iffy part is the conversion of the struct fore_200e to a struct device
which is depends your bus.  perhaps it should be a seperate routine.

any comments on the following?

diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index 1c7ae30..a5303ee 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -325,81 +325,21 @@ config ATM_IA_DEBUG
  speed of the driver, and the size of your syslog files! When
  inactive, they will have only a modest impact on performance.
 
-config ATM_FORE200E_MAYBE
+config ATM_FORE200E
tristate FORE Systems 200E-series
-   depends on PCI || SBUS
+   depends on (PCI || SBUS)
---help---
  This is a driver for the FORE Systems 200E-series ATM adapter
  cards. It simultaneously supports PCA-200E and SBA-200E models
  on PCI and SBUS hosts. Say Y (or M to compile as a module
  named fore_200e) here if you have one of these ATM adapters.
 
- Note that the driver will actually be compiled only if you
- additionally enable the support for PCA-200E and/or SBA-200E
- cards.
-
  See the file file:Documentation/networking/fore200e.txt for
  further details.
 
-config ATM_FORE200E_PCA
-   bool PCA-200E support
-   depends on ATM_FORE200E_MAYBE  PCI
-   help
- Say Y here if you want your PCA-200E cards to be probed.
-
-config ATM_FORE200E_PCA_DEFAULT_FW
-   bool Use default PCA-200E firmware (normally enabled)
-   depends on ATM_FORE200E_PCA
-   help
- Use the default PCA-200E firmware data shipped with the driver.
-
- Normal users do not have to deal with the firmware stuff, so
- they should say Y here.
-
-config ATM_FORE200E_PCA_FW
-   string Pathname of user-supplied binary firmware
-   depends on ATM_FORE200E_PCA  !ATM_FORE200E_PCA_DEFAULT_FW
-   default 
-   help
- This defines the pathname of an alternative PCA-200E binary
- firmware image supplied by the user. This pathname may be
- absolute or relative to the drivers/atm directory.
-
- The driver comes with an adequate firmware image, so normal users do
- not have to supply an alternative one. They just say Y to Use
- default PCA-200E firmware instead.
-
-config ATM_FORE200E_SBA
-   bool SBA-200E support
-   depends on ATM_FORE200E_MAYBE  SBUS
-   help
- Say Y here if you want your SBA-200E cards to be probed.
-
-config ATM_FORE200E_SBA_DEFAULT_FW
-   bool Use default SBA-200E firmware (normally enabled)
-   depends on ATM_FORE200E_SBA
-   help
- Use the default SBA-200E firmware data shipped with the driver.
-
- Normal users do not have to deal with the firmware stuff, so
- they should say Y here.
-
-config ATM_FORE200E_SBA_FW
-   string Pathname of user-supplied binary firmware
-   depends on ATM_FORE200E_SBA  !ATM_FORE200E_SBA_DEFAULT_FW
-   default 
-   help
- This defines the pathname of an alternative SBA-200E binary
- firmware image supplied by the user. This pathname may be
- absolute or relative to the drivers/atm directory.
-
- The driver comes with an adequate firmware image, so normal users do
- not have to supply an alternative one. They just say Y to Use
- default SBA-200E firmware, above.
-
 config ATM_FORE200E_USE_TASKLET
bool Defer interrupt work to a tasklet
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
+   depends on ATM_FORE200E
default n
help
  This defers work to be done by the interrupt handler to a
@@ -408,7 +348,7 @@ config ATM_FORE200E_USE_TASKLET
 
 config ATM_FORE200E_TX_RETRY
int Maximum number of tx retries
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
+   depends on ATM_FORE200E
default 16
---help---
  Specifies the number of times the driver attempts to transmit
@@ -425,7 +365,7 @@ config ATM_FORE200E_TX_RETRY
 
 config ATM_FORE200E_DEBUG
int Debugging level (0-3)
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
+   depends on ATM_FORE200E
default 0
help
  Specifies the level of debugging messages issued by the driver.
@@ -436,12 +376,6 @@ config ATM_FORE200E_DEBUG
  the performances of the driver, and the size of your syslog files!
  Keep the debugging level to 0 during normal operations.
 
-config ATM_FORE200E
-   tristate
-   depends on (PCI || SBUS)  (ATM_FORE200E_PCA || ATM_FORE200E_SBA)
-   

converting fore200e driver to use request_firmware()

2008-02-06 Thread chas williams - CONTRACTOR
however, i ran into a little problem with the sbus interface.  what should
i pass for 'struct device *' for an sbus device?
--
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 net-2.6.25 4/7][ATM]: [br2864] routed support

2008-01-30 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Chung-
Chi Lo writes:
 +   } else { /* vc-mux */
 +   if (brdev-payload == p_routed) {

add line

   skb-protocol = __constant_htons(ETH_P_IP);

here just like LLC did?

 +   skb_reset_network_header(skb);
 +   skb-pkt_type = PACKET_HOST;

yes, that is missing but it needs to be a little more complicated than
that i think.  you need to examine the first byte to see if its an
ipv4 or ipv6 datagram.  something like:

struct iphdr *iph = skb_network_header(skb);

skb_reset_network_header(skb);
iph = skb_network_header(skb);
if (iph-version == 4)
skb-protocol = __constant_htons(ETH_P_IP);
else if (iph-version == 6)
skb-protocol = __constant_htons(ETH_P_IPV6);
else
/* drop the packet */
skb-pkt_type = PACKET_HOST;

how does that look?

+   } else {
+   skb_push(skb, 2);
+   if (brdev-payload == p_bridged)
+   memset(skb-data, 0, 2);
+   }

Here should be

   } else {
   if (brdev-payload == p_bridged) {
   skb_push(skb, 2);
   memset(skb-data, 0, 2);
   }
   }

Because VCMUX and routed mode doesn't need two bytes in header.

yeah, another oversight.  your fix is correct. i bet you have guessed
that we dont use vc multiplexing.
--
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 net-2.6.25 4/7][ATM]: [br2864] routed support

2008-01-26 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Chung-
Chi Lo writes:
Question to decode the encaps=VCMUX and bridge mode:

This line
skb_pull((skb, BR2684_PAD_LEN + ETH_HLEN);
should be replaced by
skb_pull((skb, BR2684_PAD_LEN);

you are correct.

By the way, this routed mode patch doesn't include encaps=VCMUX and
RFC2684 routed
protocol decapsulation?

yep.  eric believes the following should fix both problems:

commit 43e4b025ffe130cd6a292fa9ff909e39a88f849c
Author: Chas Williams - CONTRACTOR [EMAIL PROTECTED]
Date:   Sat Jan 26 07:18:26 2008 -0500

[ATM]: [br2864] fix vcmux support

From: Eric Kinzie [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 31347cb..97b422c 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -400,15 +400,20 @@ static void br2684_push(struct atm_vcc *atmvcc, struct 
sk_buff *skb)
return;
}
 
-   } else {
-   /* first 2 chars should be 0 */
-   if (*((u16 *) (skb-data)) != 0) {
-   brdev-stats.rx_errors++;
-   dev_kfree_skb(skb);
-   return;
+   } else { /* vc-mux */
+   if (brdev-payload == p_routed) {
+   skb_reset_network_header(skb);
+   skb-pkt_type = PACKET_HOST;
+   } else { /* p_bridged */
+   /* first 2 chars should be 0 */
+   if (*((u16 *) (skb-data)) != 0) {
+   brdev-stats.rx_errors++;
+   dev_kfree_skb(skb);
+   return;
+   }
+   skb_pull(skb, BR2684_PAD_LEN);
+   skb-protocol = eth_type_trans(skb, net_dev);
}
-   skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN);   /* pad, dstmac, 
srcmac, ethtype */
-   skb-protocol = eth_type_trans(skb, net_dev);
}
 
 #ifdef CONFIG_ATM_BR2684_IPFILTER
--
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 net-2.6.24][ATM]: [nicstar] delay irq setup until card is configured

2008-01-04 Thread chas williams - CONTRACTOR
if an interrupt occurs too soon, the driver oops while trying to handle
a shortage of buffers condition (caused by no buffers having been
allocated yet).

commit a3322d3d34854edf27f7950efaa93e68f5f71ace
Author: Chas Williams - CONTRACTOR [EMAIL PROTECTED]
Date:   Fri Jan 4 16:27:07 2008 -0500

[ATM]: [nicstar] delay irq setup until card is configured

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 14ced85..0c205b0 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -625,14 +625,6 @@ static int __devinit ns_init_card(int i, struct pci_dev 
*pcidev)
if (mac[i] == NULL)
   nicstar_init_eprom(card-membase);
 
-   if (request_irq(pcidev-irq, ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, 
nicstar, card) != 0)
-   {
-  printk(nicstar%d: can't allocate IRQ %d.\n, i, pcidev-irq);
-  error = 9;
-  ns_init_card_error(card, error);
-  return error;
-   }
-
/* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */
writel(0x, card-membase + VPM);
   
@@ -858,8 +850,6 @@ static int __devinit ns_init_card(int i, struct pci_dev 
*pcidev)
   card-iovpool.count++;
}
 
-   card-intcnt = 0;
-
/* Configure NICStAR */
if (card-rct_size == 4096)
   ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES;
@@ -868,6 +858,15 @@ static int __devinit ns_init_card(int i, struct pci_dev 
*pcidev)
 
card-efbie = 1;
 
+   card-intcnt = 0;
+   if (request_irq(pcidev-irq, ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, 
nicstar, card) != 0)
+   {
+  printk(nicstar%d: can't allocate IRQ %d.\n, i, pcidev-irq);
+  error = 9;
+  ns_init_card_error(card, error);
+  return error;
+   }
+
/* Register device */
card-atmdev = atm_dev_register(nicstar, atm_ops, -1, NULL);
if (card-atmdev == NULL)
--
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 net-2.6.25 5/7][ATM]: [br2864] whitespace cleanup

2007-12-29 Thread chas williams - CONTRACTOR
commit 6b11f93a718dc916198feb1099ae0cef39ce3936
Author: Chas Williams [EMAIL PROTECTED]
Date:   Sat Oct 27 08:33:40 2007 -0400

[ATM]: [br2864] whitespace cleanup

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index ccdab6c..52bf72a 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -15,7 +15,7 @@
 #define BR2684_MEDIA_802_6 (4) /* 802.6 */
 
/* used only at device creation:  */
-#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
+#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
 
 /*
  * Is there FCS inbound on this VC?  This currently isn't supported.
@@ -45,17 +45,16 @@
 #define BR2684_PAYLOAD_ROUTED   (0)
 #define BR2684_PAYLOAD_BRIDGED  (1)
 
-
 /*
  * This is for the ATM_NEWBACKENDIF call - these are like socket families:
  * the first element of the structure is the backend number and the rest
  * is per-backend specific
  */
 struct atm_newif_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
-   int media;  /* BR2684_MEDIA_*, flags in upper bits 
*/
-   charifname[IFNAMSIZ];
-   int mtu;
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
+   int media;  /* BR2684_MEDIA_*, flags in upper bits */
+   char ifname[IFNAMSIZ];
+   int mtu;
 };
 
 /*
@@ -66,10 +65,10 @@ struct atm_newif_br2684 {
 #define BR2684_FIND_BYNUM  (1)
 #define BR2684_FIND_BYIFNAME   (2)
 struct br2684_if_spec {
-   int method; /* BR2684_FIND_* */
+   int method; /* BR2684_FIND_* */
union {
-   charifname[IFNAMSIZ];
-   int devnum;
+   char ifname[IFNAMSIZ];
+   int devnum;
} spec;
 };
 
@@ -79,16 +78,16 @@ struct br2684_if_spec {
  * is per-backend specific
  */
 struct atm_backend_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
struct br2684_if_spec ifspec;
-   int fcs_in; /* BR2684_FCSIN_* */
-   int fcs_out;/* BR2684_FCSOUT_* */
-   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
-   int encaps; /* BR2684_ENCAPS_* */
-   int has_vpiid;  /* 1: use vpn_id - Unsupported */
-   __u8vpn_id[7];
-   int send_padding;   /* unsupported */
-   int min_size;   /* we will pad smaller packets than this */
+   int fcs_in; /* BR2684_FCSIN_* */
+   int fcs_out;/* BR2684_FCSOUT_* */
+   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
+   int encaps; /* BR2684_ENCAPS_* */
+   int has_vpiid;  /* 1: use vpn_id - Unsupported */
+   __u8 vpn_id[7];
+   int send_padding;   /* unsupported */
+   int min_size;   /* we will pad smaller packets than this */
 };
 
 /*
@@ -97,8 +96,8 @@ struct atm_backend_br2684 {
  * efficient per-if in/out filters, this support will be removed
  */
 struct br2684_filter {
-   __be32  prefix; /* network byte order */
-   __be32  netmask;/* 0 = disable filter */
+   __be32 prefix;  /* network byte order */
+   __be32 netmask; /* 0 = disable filter */
 };
 
 struct br2684_filter_set {
@@ -107,8 +106,8 @@ struct br2684_filter_set {
 };
 
 enum br2684_payload {
-p_routed = BR2684_PAYLOAD_ROUTED,
-p_bridged = BR2684_PAYLOAD_BRIDGED,
+   p_routed = BR2684_PAYLOAD_ROUTED,
+   p_bridged = BR2684_PAYLOAD_BRIDGED,
 };
 
 #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index d9bb2a1..f5a3794 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -1,9 +1,10 @@
 /*
-Ethernet netdevice using ATM AAL5 as underlying carrier
-(RFC1483 obsoleted by RFC2684) for Linux
-Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
- Eric Kinzie, 2006-2007, US Naval Research Laboratory
-*/
+ * Ethernet netdevice using ATM AAL5 as underlying carrier
+ * (RFC1483 obsoleted by RFC2684) for Linux
+ *
+ * Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
+ *  Eric Kinzie, 2006-2007, US Naval Research Laboratory
+ */
 
 #include linux/module.h
 #include linux/init.h
@@ -51,28 +52,24 @@ static void skb_debug(const struct sk_buff *skb)
 #define ETHERTYPE_IPV6 0x86, 0xdd
 #define PAD_BRIDGED0x00, 0x00
 
-static unsigned char ethertype_ipv4[] =
-   { ETHERTYPE_IPV4 };
-static unsigned char ethertype_ipv6[] =
-   { ETHERTYPE_IPV6 };
+static unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
+static unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
 static unsigned char llc_oui_pid_pad[] =
-   { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED

[PATCH net-2.6.25 7/7][ATM]: [he] fixing compilation when you define USE_RBPS_POOL/USE_RBPL_POOL

2007-12-29 Thread chas williams - CONTRACTOR
commit 62024377f1da8a3f5b49cfd60d892c778f5a5741
Author: Jorge Boncompte [EMAIL PROTECTED]
Date:   Thu Dec 13 16:14:40 2007 -0500

[ATM]: [he] fixing compilation when you define USE_RBPS_POOL/USE_RBPL_POOL

Signed-off-by: Jorge Boncompte [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 3b64a99..20df4bb 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1643,6 +1643,8 @@ he_stop(struct he_dev *he_dev)
 
if (he_dev-rbpl_base) {
 #ifdef USE_RBPL_POOL
+   int i;
+
for (i = 0; i  CONFIG_RBPL_SIZE; ++i) {
void *cpuaddr = he_dev-rbpl_virt[i].virt;
dma_addr_t dma_handle = he_dev-rbpl_base[i].phys;
@@ -1665,6 +1667,8 @@ he_stop(struct he_dev *he_dev)
 #ifdef USE_RBPS
if (he_dev-rbps_base) {
 #ifdef USE_RBPS_POOL
+   int i;
+
for (i = 0; i  CONFIG_RBPS_SIZE; ++i) {
void *cpuaddr = he_dev-rbps_virt[i].virt;
dma_addr_t dma_handle = he_dev-rbps_base[i].phys;
--
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 4/4] atm/ambassador: kmalloc + memset conversion to kzalloc

2007-11-27 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Rober
t P. J. Day writes:
  in any event, i just thought i'd point it out.  if you're absolutely
  sure there will never be another call to setup_dev() from somewhere
  else, then, yes, it's safe.

 I understood your opinions. and partially agree with you.
 But isn't it a unfounded fear?

i don't know, i just thought i'd mention it.  if no one thinks it's an
issue, it's certainly fine with me.

its very unlikely that setup_dev() is likely to be called from another
code path.  this patch looks fine to me.  i will take it and get it
submitted on the next merge.
-
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 1/1][ATM]: [he] initialize lock and tasklet earlier

2007-11-26 Thread chas williams - CONTRACTOR
if you are lucky (unlucky?) enough to have shared interrupts, the
interrupt handler can be called before the tasklet and lock are ready
for use.

commit 44b3e82778b0edf73147529c8b1c115d241a6a4d
Author: chas williams - CONTRACTOR [EMAIL PROTECTED]
Date:   Mon Nov 26 11:30:33 2007 -0500

[ATM]: [he] initialize lock and tasklet earlier

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index d33aba6..3b64a99 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -394,6 +394,11 @@ he_init_one(struct pci_dev *pci_dev, const struct 
pci_device_id *pci_ent)
he_dev-atm_dev-dev_data = he_dev;
atm_dev-dev_data = he_dev;
he_dev-number = atm_dev-number;
+#ifdef USE_TASKLET
+   tasklet_init(he_dev-tasklet, he_tasklet, (unsigned long) he_dev);
+#endif
+   spin_lock_init(he_dev-global_lock);
+
if (he_start(atm_dev)) {
he_stop(he_dev);
err = -ENODEV;
@@ -1173,11 +1178,6 @@ he_start(struct atm_dev *dev)
if ((err = he_init_irq(he_dev)) != 0)
return err;
 
-#ifdef USE_TASKLET
-   tasklet_init(he_dev-tasklet, he_tasklet, (unsigned long) he_dev);
-#endif
-   spin_lock_init(he_dev-global_lock);
-
/* 4.11 enable pci bus controller state machines */
host_cntl |= (OUTFF_ENB | CMDFF_ENB |
QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB);
-
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 5/5][ATM]: [br2864] whitespace cleanup

2007-10-27 Thread chas williams - CONTRACTOR
commit 6b11f93a718dc916198feb1099ae0cef39ce3936
Author: Chas Williams [EMAIL PROTECTED]
Date:   Sat Oct 27 08:33:40 2007 -0400

[ATM]: [br2864] whitespace cleanup

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index ccdab6c..52bf72a 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -15,7 +15,7 @@
 #define BR2684_MEDIA_802_6 (4) /* 802.6 */
 
/* used only at device creation:  */
-#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
+#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
 
 /*
  * Is there FCS inbound on this VC?  This currently isn't supported.
@@ -45,17 +45,16 @@
 #define BR2684_PAYLOAD_ROUTED   (0)
 #define BR2684_PAYLOAD_BRIDGED  (1)
 
-
 /*
  * This is for the ATM_NEWBACKENDIF call - these are like socket families:
  * the first element of the structure is the backend number and the rest
  * is per-backend specific
  */
 struct atm_newif_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
-   int media;  /* BR2684_MEDIA_*, flags in upper bits 
*/
-   charifname[IFNAMSIZ];
-   int mtu;
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
+   int media;  /* BR2684_MEDIA_*, flags in upper bits */
+   char ifname[IFNAMSIZ];
+   int mtu;
 };
 
 /*
@@ -66,10 +65,10 @@ struct atm_newif_br2684 {
 #define BR2684_FIND_BYNUM  (1)
 #define BR2684_FIND_BYIFNAME   (2)
 struct br2684_if_spec {
-   int method; /* BR2684_FIND_* */
+   int method; /* BR2684_FIND_* */
union {
-   charifname[IFNAMSIZ];
-   int devnum;
+   char ifname[IFNAMSIZ];
+   int devnum;
} spec;
 };
 
@@ -79,16 +78,16 @@ struct br2684_if_spec {
  * is per-backend specific
  */
 struct atm_backend_br2684 {
-   atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
+   atm_backend_t backend_num;  /* ATM_BACKEND_BR2684 */
struct br2684_if_spec ifspec;
-   int fcs_in; /* BR2684_FCSIN_* */
-   int fcs_out;/* BR2684_FCSOUT_* */
-   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
-   int encaps; /* BR2684_ENCAPS_* */
-   int has_vpiid;  /* 1: use vpn_id - Unsupported */
-   __u8vpn_id[7];
-   int send_padding;   /* unsupported */
-   int min_size;   /* we will pad smaller packets than this */
+   int fcs_in; /* BR2684_FCSIN_* */
+   int fcs_out;/* BR2684_FCSOUT_* */
+   int fcs_auto;   /* 1: fcs_{in,out} disabled if no FCS rx'ed */
+   int encaps; /* BR2684_ENCAPS_* */
+   int has_vpiid;  /* 1: use vpn_id - Unsupported */
+   __u8 vpn_id[7];
+   int send_padding;   /* unsupported */
+   int min_size;   /* we will pad smaller packets than this */
 };
 
 /*
@@ -97,8 +96,8 @@ struct atm_backend_br2684 {
  * efficient per-if in/out filters, this support will be removed
  */
 struct br2684_filter {
-   __be32  prefix; /* network byte order */
-   __be32  netmask;/* 0 = disable filter */
+   __be32 prefix;  /* network byte order */
+   __be32 netmask; /* 0 = disable filter */
 };
 
 struct br2684_filter_set {
@@ -107,8 +106,8 @@ struct br2684_filter_set {
 };
 
 enum br2684_payload {
-p_routed = BR2684_PAYLOAD_ROUTED,
-p_bridged = BR2684_PAYLOAD_BRIDGED,
+   p_routed = BR2684_PAYLOAD_ROUTED,
+   p_bridged = BR2684_PAYLOAD_BRIDGED,
 };
 
 #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index d9bb2a1..f5a3794 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -1,9 +1,10 @@
 /*
-Ethernet netdevice using ATM AAL5 as underlying carrier
-(RFC1483 obsoleted by RFC2684) for Linux
-Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
- Eric Kinzie, 2006-2007, US Naval Research Laboratory
-*/
+ * Ethernet netdevice using ATM AAL5 as underlying carrier
+ * (RFC1483 obsoleted by RFC2684) for Linux
+ *
+ * Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
+ *  Eric Kinzie, 2006-2007, US Naval Research Laboratory
+ */
 
 #include linux/module.h
 #include linux/init.h
@@ -51,28 +52,24 @@ static void skb_debug(const struct sk_buff *skb)
 #define ETHERTYPE_IPV6 0x86, 0xdd
 #define PAD_BRIDGED0x00, 0x00
 
-static unsigned char ethertype_ipv4[] =
-   { ETHERTYPE_IPV4 };
-static unsigned char ethertype_ipv6[] =
-   { ETHERTYPE_IPV6 };
+static unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
+static unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
 static unsigned char llc_oui_pid_pad[] =
-   { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED

[PATCH 3/5][ATM]: [he] This patch removes the ancient version string.

2007-10-27 Thread chas williams - CONTRACTOR
commit 41d6b7e20dd6d57bec4f14697f654c8211ff5d57
Author: Adrian Bunk [EMAIL PROTECTED]
Date:   Fri Oct 26 07:29:47 2007 -0400

[ATM]: [he] This patch removes the ancient version string.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index d33aba6..4f1c7e6 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1,5 +1,3 @@
-/* $Id: he.c,v 1.18 2003/05/06 22:57:15 chas Exp $ */
-
 /*
 
   he.c
@@ -99,10 +97,6 @@
 #define HPRINTK(fmt,args...)   do { } while (0)
 #endif /* HE_DEBUG */
 
-/* version definition */
-
-static char *version = $Id: he.c,v 1.18 2003/05/06 22:57:15 chas Exp $;
-
 /* declarations */
 
 static int he_open(struct atm_vcc *vcc);
@@ -366,7 +360,7 @@ he_init_one(struct pci_dev *pci_dev, const struct 
pci_device_id *pci_ent)
struct he_dev *he_dev = NULL;
int err = 0;
 
-   printk(KERN_INFO he: %s\n, version);
+   printk(KERN_INFO ATM he driver\n);
 
if (pci_enable_device(pci_dev))
return -EIO;
@@ -2933,7 +2927,7 @@ he_proc_read(struct atm_dev *dev, loff_t *pos, char *page)
 
left = *pos;
if (!left--)
-   return sprintf(page, %s\n, version);
+   return sprintf(page, ATM he driver\n);
 
if (!left--)
return sprintf(page, %s%s\n\n,
-
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 1/5][ATM]: atm is no longer experimental

2007-10-27 Thread chas williams - CONTRACTOR
commit f57512af6142cf14bd15012c4c627f9ebef0582a
Author: Robert P. J. Day [EMAIL PROTECTED]
Date:   Fri Oct 26 07:27:07 2007 -0400

[ATM]: atm is no longer experimental

From: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/net/atm/Kconfig b/net/atm/Kconfig
index 21ff276..754ea10 100644
--- a/net/atm/Kconfig
+++ b/net/atm/Kconfig
@@ -1,10 +1,9 @@
 #
-# Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)
+# Asynchronous Transfer Mode (ATM)
 #
 
 config ATM
-   tristate Asynchronous Transfer Mode (ATM) (EXPERIMENTAL)
-   depends on EXPERIMENTAL
+   tristate Asynchronous Transfer Mode (ATM)
---help---
  ATM is a high-speed networking technology for Local Area Networks
  and Wide Area Networks.  It uses a fixed packet size and is
@@ -20,7 +19,7 @@ config ATM
  further details.
 
 config ATM_CLIP
-   tristate Classical IP over ATM (EXPERIMENTAL)
+   tristate Classical IP over ATM
depends on ATM  INET
help
  Classical IP over ATM for PVCs and SVCs, supporting InARP and
@@ -29,7 +28,7 @@ config ATM_CLIP
  (LANE) below.
 
 config ATM_CLIP_NO_ICMP
-   bool Do NOT send ICMP if no neighbour (EXPERIMENTAL)
+   bool Do NOT send ICMP if no neighbour
depends on ATM_CLIP
help
  Normally, an ICMP host unreachable message is sent if a neighbour
@@ -39,7 +38,7 @@ config ATM_CLIP_NO_ICMP
  such neighbours are silently discarded instead.
 
 config ATM_LANE
-   tristate LAN Emulation (LANE) support (EXPERIMENTAL)
+   tristate LAN Emulation (LANE) support
depends on ATM
help
  LAN Emulation emulates services of existing LANs across an ATM
@@ -48,7 +47,7 @@ config ATM_LANE
  ELAN and Ethernet segments. You need LANE if you want to try MPOA.
 
 config ATM_MPOA
-   tristate Multi-Protocol Over ATM (MPOA) support (EXPERIMENTAL)
+   tristate Multi-Protocol Over ATM (MPOA) support
depends on ATM  INET  ATM_LANE!=n
help
  Multi-Protocol Over ATM allows ATM edge devices such as routers,
-
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][ATM]: Convert struct class_device to struct device

2007-10-27 Thread chas williams - CONTRACTOR
commit 03c544e08cfe22f0c8a952c0aed1265917dca469
Author: Kay Sievers [EMAIL PROTECTED]
Date:   Fri Oct 26 07:28:29 2007 -0400

[ATM]: Convert struct class_device to struct device

Signed-off-by: Kay Sievers [EMAIL PROTECTED]
Cc: Tony Jones [EMAIL PROTECTED]
Signed-off-by: Greg Kroah-Hartman [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
index 9ef07ed..1b88311 100644
--- a/net/atm/atm_sysfs.c
+++ b/net/atm/atm_sysfs.c
@@ -9,13 +9,15 @@
 
 #define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev)
 
-static ssize_t show_type(struct class_device *cdev, char *buf)
+static ssize_t show_type(struct device *cdev,
+struct device_attribute *attr, char *buf)
 {
struct atm_dev *adev = to_atm_dev(cdev);
return sprintf(buf, %s\n, adev-type);
 }
 
-static ssize_t show_address(struct class_device *cdev, char *buf)
+static ssize_t show_address(struct device *cdev,
+   struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -28,7 +30,8 @@ static ssize_t show_address(struct class_device *cdev, char 
*buf)
return pos - buf;
 }
 
-static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
+static ssize_t show_atmaddress(struct device *cdev,
+  struct device_attribute *attr, char *buf)
 {
unsigned long flags;
char *pos = buf;
@@ -54,7 +57,8 @@ static ssize_t show_atmaddress(struct class_device *cdev, 
char *buf)
return pos - buf;
 }
 
-static ssize_t show_carrier(struct class_device *cdev, char *buf)
+static ssize_t show_carrier(struct device *cdev,
+   struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -65,7 +69,8 @@ static ssize_t show_carrier(struct class_device *cdev, char 
*buf)
return pos - buf;
 }
 
-static ssize_t show_link_rate(struct class_device *cdev, char *buf)
+static ssize_t show_link_rate(struct device *cdev,
+ struct device_attribute *attr, char *buf)
 {
char *pos = buf;
struct atm_dev *adev = to_atm_dev(cdev);
@@ -90,22 +95,23 @@ static ssize_t show_link_rate(struct class_device *cdev, 
char *buf)
return pos - buf;
 }
 
-static CLASS_DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
-static CLASS_DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
-static CLASS_DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
-static CLASS_DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
-static CLASS_DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
-
-static struct class_device_attribute *atm_attrs[] = {
-   class_device_attr_atmaddress,
-   class_device_attr_address,
-   class_device_attr_carrier,
-   class_device_attr_type,
-   class_device_attr_link_rate,
+static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
+static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
+static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
+static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
+static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
+
+static struct device_attribute *atm_attrs[] = {
+   dev_attr_atmaddress,
+   dev_attr_address,
+   dev_attr_carrier,
+   dev_attr_type,
+   dev_attr_link_rate,
NULL
 };
 
-static int atm_uevent(struct class_device *cdev, struct kobj_uevent_env *env)
+
+static int atm_uevent(struct device *cdev, struct kobj_uevent_env *env)
 {
struct atm_dev *adev;
 
@@ -122,7 +128,7 @@ static int atm_uevent(struct class_device *cdev, struct 
kobj_uevent_env *env)
return 0;
 }
 
-static void atm_release(struct class_device *cdev)
+static void atm_release(struct device *cdev)
 {
struct atm_dev *adev = to_atm_dev(cdev);
 
@@ -131,25 +137,25 @@ static void atm_release(struct class_device *cdev)
 
 static struct class atm_class = {
.name   = atm,
-   .release= atm_release,
-   .uevent = atm_uevent,
+   .dev_release= atm_release,
+   .dev_uevent = atm_uevent,
 };
 
 int atm_register_sysfs(struct atm_dev *adev)
 {
-   struct class_device *cdev = adev-class_dev;
+   struct device *cdev = adev-class_dev;
int i, j, err;
 
cdev-class = atm_class;
-   class_set_devdata(cdev, adev);
+   dev_set_drvdata(cdev, adev);
 
-   snprintf(cdev-class_id, BUS_ID_SIZE, %s%d, adev-type, adev-number);
-   err = class_device_register(cdev);
+   snprintf(cdev-bus_id, BUS_ID_SIZE, %s%d, adev-type, adev-number);
+   err = device_register(cdev);
if (err  0)
return err;
 
for (i = 0; atm_attrs[i]; i++) {
-   err = class_device_create_file(cdev, atm_attrs[i]);
+   err = device_create_file(cdev, atm_attrs[i

[PATCH 4/5][ATM]: [br2864] routed support

2007-10-27 Thread chas williams - CONTRACTOR
commit fea6b121bcc150fc91186e5012466c91944ce64d
Author: Eric Kinzie [EMAIL PROTECTED]
Date:   Fri Oct 26 08:05:08 2007 -0400

[ATM]: [br2864] routed support

From: Eric Kinzie [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index 969fb6c..ccdab6c 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -14,6 +14,9 @@
 #define BR2684_MEDIA_FDDI  (3)
 #define BR2684_MEDIA_802_6 (4) /* 802.6 */
 
+   /* used only at device creation:  */
+#define BR2684_FLAG_ROUTED (116) /* payload is routed, not bridged */
+
 /*
  * Is there FCS inbound on this VC?  This currently isn't supported.
  */
@@ -36,13 +39,21 @@
 #define BR2684_ENCAPS_AUTODETECT (2)   /* Unsuported */
 
 /*
+ * Is this VC bridged or routed?
+ */
+
+#define BR2684_PAYLOAD_ROUTED   (0)
+#define BR2684_PAYLOAD_BRIDGED  (1)
+
+
+/*
  * This is for the ATM_NEWBACKENDIF call - these are like socket families:
  * the first element of the structure is the backend number and the rest
  * is per-backend specific
  */
 struct atm_newif_br2684 {
atm_backend_t   backend_num;/* ATM_BACKEND_BR2684 */
-   int media;  /* BR2684_MEDIA_* */
+   int media;  /* BR2684_MEDIA_*, flags in upper bits 
*/
charifname[IFNAMSIZ];
int mtu;
 };
@@ -95,6 +106,11 @@ struct br2684_filter_set {
struct br2684_filter filter;
 };
 
+enum br2684_payload {
+p_routed = BR2684_PAYLOAD_ROUTED,
+p_bridged = BR2684_PAYLOAD_BRIDGED,
+};
+
 #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
struct br2684_filter_set)
 
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 2096e5c..a3d07c2 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -359,7 +359,7 @@ struct atm_dev {
struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name;/* proc entry name */
 #endif
-   struct class_device class_dev;  /* sysfs class device */
+   struct device class_dev;/* sysfs device */
struct list_head dev_list;  /* linkage */
 };
 
@@ -461,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
BUG_ON(!test_bit(ATM_DF_REMOVED, dev-flags));
if (dev-ops-dev_close)
dev-ops-dev_close(dev);
-   class_device_put(dev-class_dev);
+   put_device(dev-class_dev);
}
 }
 
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index ba6428f..d9bb2a1 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -1,7 +1,8 @@
 /*
-Experimental ethernet netdevice using ATM AAL5 as underlying carrier
-(RFC1483 obsoleted by RFC2684) for Linux 2.4
-Author: Marcell GAL, 2000, XDSL Ltd, Hungary
+Ethernet netdevice using ATM AAL5 as underlying carrier
+(RFC1483 obsoleted by RFC2684) for Linux
+Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
+ Eric Kinzie, 2006-2007, US Naval Research Laboratory
 */
 
 #include linux/module.h
@@ -39,9 +40,27 @@ static void skb_debug(const struct sk_buff *skb)
 #define skb_debug(skb) do {} while (0)
 #endif
 
+#define BR2684_ETHERTYPE_LEN   2
+#define BR2684_PAD_LEN 2
+
+#define LLC0xaa, 0xaa, 0x03
+#define SNAP_BRIDGED   0x00, 0x80, 0xc2
+#define SNAP_ROUTED0x00, 0x00, 0x00
+#define PID_ETHERNET   0x00, 0x07
+#define ETHERTYPE_IPV4 0x08, 0x00
+#define ETHERTYPE_IPV6 0x86, 0xdd
+#define PAD_BRIDGED0x00, 0x00
+
+static unsigned char ethertype_ipv4[] =
+   { ETHERTYPE_IPV4 };
+static unsigned char ethertype_ipv6[] =
+   { ETHERTYPE_IPV6 };
 static unsigned char llc_oui_pid_pad[] =
-{ 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
-#define PADLEN (2)
+   { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
+static unsigned char llc_oui_ipv4[] =
+   { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
+static unsigned char llc_oui_ipv6[] =
+   { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
 
 enum br2684_encaps {
e_vc  = BR2684_ENCAPS_VC,
@@ -69,6 +88,7 @@ struct br2684_dev {
struct list_head brvccs; /* one device = one vcc (before xmas) */
struct net_device_stats stats;
int mac_was_set;
+   enum br2684_payload payload;
 };
 
 /*
@@ -136,6 +156,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct 
br2684_dev *brdev,
 {
struct atm_vcc *atmvcc;
int minheadroom = (brvcc-encaps == e_llc) ? 10 : 2;
+
if (skb_headroom(skb)  minheadroom) {
struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
brvcc-copies_needed++;
@@ -146,11 +167,32 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct 
br2684_dev *brdev,
}
skb = skb2;
}
-   skb_push(skb, minheadroom);
-   if (brvcc-encaps == e_llc

[PATCH 5/7][ATM]: [lanai] sram_test_word() must be __devinit

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [lanai] sram_test_word() must be __devinit

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit 9b3515b17a74eff9aad7409dd64888cf0cd03d4d
tree 6b10b2df62cd24cfc86558c70ecc761e5bcaf724
parent b7560ad591d64544359766df2f2c687e9e65
author Adrian Bunk [EMAIL PROTECTED] Thu, 12 Jul 2007 11:17:16 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Thu, 12 Jul 2007 
11:17:16 -0400

 drivers/atm/lanai.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 4e1fa50..0ac201e 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -553,8 +553,8 @@ static inline void sram_write(const struct lanai_dev *lanai,
writel(val, sram_addr(lanai, offset));
 }
 
-static int __init sram_test_word(
-   const struct lanai_dev *lanai, int offset, u32 pattern)
+static int __devinit sram_test_word(const struct lanai_dev *lanai,
+   int offset, u32 pattern)
 {
u32 readback;
sram_write(lanai, pattern, offset);
-
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 3/7][ATM]: [nicstar] Replace C code with call to ARRAY_SIZE() macro.

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [nicstar] Replace C code with call to ARRAY_SIZE() macro.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit e9e4b3e9524fd445fcc06f56678a6b7f3d1d5f3a
tree 7edafbabdafaad229fb728c1c74e6bca60a0c58c
parent 6bab08f73e2c24665a523f15a4ebe4002be38a91
author Robert P. J. Day [EMAIL PROTECTED] Wed, 11 Jul 2007 12:23:43 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:23:43 -0400

 drivers/atm/nicstarmac.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/atm/nicstarmac.c b/drivers/atm/nicstarmac.c
index 480947f..842e26c 100644
--- a/drivers/atm/nicstarmac.c
+++ b/drivers/atm/nicstarmac.c
@@ -134,7 +134,7 @@ nicstar_read_eprom_status( virt_addr_t base )
/* Send read instruction */
val = NICSTAR_REG_READ( base, NICSTAR_REG_GENERAL_PURPOSE )  0xFFF0;
 
-   for (i=0; isizeof rdsrtab/sizeof rdsrtab[0]; i++)
+   for (i=0; iARRAY_SIZE(rdsrtab); i++)
{
NICSTAR_REG_WRITE( base, NICSTAR_REG_GENERAL_PURPOSE,
(val | rdsrtab[i]) );
-
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/7][ATM]: Eliminate dead config variable CONFIG_BR2684_FAST_TRANS.

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: Eliminate dead config variable CONFIG_BR2684_FAST_TRANS.

From: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit 6bab08f73e2c24665a523f15a4ebe4002be38a91
tree 2c6d28e064934b097f37b3b766900b7bb77264b4
parent ffc2850a65ef863fe52650e5e1bc7ac3e098bbb8
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 12:19:31 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:19:31 -0400

 net/atm/br2684.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index faa6aaf..c0f6861 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -460,11 +460,7 @@ static void br2684_push(struct atm_vcc *atmvcc, struct 
sk_buff *skb)
skb_pull(skb, plen);
skb_set_mac_header(skb, -ETH_HLEN);
skb-pkt_type = PACKET_HOST;
-#ifdef CONFIG_BR2684_FAST_TRANS
-   skb-protocol = ((u16 *) skb-data)[-1];
-#else  /* some protocols might require this: */
skb-protocol = br_type_trans(skb, net_dev);
-#endif /* CONFIG_BR2684_FAST_TRANS */
 #else
skb_pull(skb, plen - ETH_HLEN);
skb-protocol = eth_type_trans(skb, net_dev);
-
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 1/7][ATM]: Replacing kmalloc/memset combination with kzalloc.

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: Replacing kmalloc/memset combination with kzalloc.

Signed-off-by: vignesh babu [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit ffc2850a65ef863fe52650e5e1bc7ac3e098bbb8
tree 1e66e6f29dbda236b826cfdd6ce1b053d15224d9
parent 99d24edeb6abc6ca3a0d0fbdb83c664c04403c8c
author vignesh babu [EMAIL PROTECTED] Wed, 11 Jul 2007 12:15:49 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:15:49 -0400

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

diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 54b92d2..2df38bb 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -292,13 +292,12 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, 
u32 parent,
}
}
DPRINTK(atm_tc_change: new id %x\n,classid);
-   flow = kmalloc(sizeof(struct atm_flow_data)+hdr_len,GFP_KERNEL);
+   flow = kzalloc(sizeof(struct atm_flow_data)+hdr_len, GFP_KERNEL);
DPRINTK(atm_tc_change: flow %p\n,flow);
if (!flow) {
error = -ENOBUFS;
goto err_out;
}
-   memset(flow,0,sizeof(*flow));
flow-filter_list = NULL;
if (!(flow-q = qdisc_create_dflt(sch-dev,pfifo_qdisc_ops,classid)))
flow-q = noop_qdisc;
-
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 7/7][ATM]: [idt77252] Rename CONFIG_ATM_IDT77252_SEND_IDLE to not resemble a Kconfig variable

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [idt77252] Rename CONFIG_ATM_IDT77252_SEND_IDLE to not resemble a 
Kconfig variable

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit c6023af8babdaefc46d8ac7e3293f4bb87537422
tree f9aaecd241f8263b58caa6929f8b84002227c176
parent 15fa4d7e8fda822d42bc202fe390b52309ee9d86
author Robert P. J. Day [EMAIL PROTECTED] Thu, 12 Jul 2007 14:52:10 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Thu, 12 Jul 2007 
14:52:10 -0400

 drivers/atm/idt77252.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index 3800bc0..ebd1b66 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -65,7 +65,7 @@ static char const rcsid[] =
 static unsigned int vpibits = 1;
 
 
-#define CONFIG_ATM_IDT77252_SEND_IDLE 1
+#define ATM_IDT77252_SEND_IDLE 1
 
 
 /*
@@ -3404,7 +3404,7 @@ init_card(struct atm_dev *dev)
conf =  SAR_CFG_TX_FIFO_SIZE_9 |/* Use maximum fifo size */
SAR_CFG_RXSTQ_SIZE_8k | /* Receive Status Queue is 8k */
SAR_CFG_IDLE_CLP |  /* Set CLP on idle cells */
-#ifndef CONFIG_ATM_IDT77252_SEND_IDLE
+#ifndef ATM_IDT77252_SEND_IDLE
SAR_CFG_NO_IDLE |   /* Do not send idle cells */
 #endif
0;
@@ -3541,7 +3541,7 @@ init_card(struct atm_dev *dev)
printk(%s: Linkrate on ATM line : %u bit/s, %u cell/s.\n,
   card-name, linkrate, card-link_pcr);
 
-#ifdef CONFIG_ATM_IDT77252_SEND_IDLE
+#ifdef ATM_IDT77252_SEND_IDLE
card-utopia_pcr = card-link_pcr;
 #else
card-utopia_pcr = (16000 / 8 / 54);
-
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/7][ATM]: [lanai] change VENDOR to DEVICE

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [lanai] change VENDOR to DEVICE

There were 2 bad named macros in pci_ids (LANAI 2 and IHB). Rename it to
DEVICE, because it's device id. Also some cleanup in the pci_device_id
table (use PCI_VDEVICE).

Cc: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Jiri Slaby [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit b7560ad591d64544359766df2f2c687e9e65
tree fc9f8bdd2bf0f16de90cf9576220cff586ce4d8b
parent e9e4b3e9524fd445fcc06f56678a6b7f3d1d5f3a
author Jiri Slaby [EMAIL PROTECTED] Wed, 11 Jul 2007 12:26:48 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 11 Jul 2007 
12:26:48 -0400

 drivers/atm/lanai.c |   14 --
 include/linux/pci_ids.h |4 ++--
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 09f477d..4e1fa50 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -246,8 +246,8 @@ struct lanai_vcc {
 };
 
 enum lanai_type {
-   lanai2  = PCI_VENDOR_ID_EF_ATM_LANAI2,
-   lanaihb = PCI_VENDOR_ID_EF_ATM_LANAIHB
+   lanai2  = PCI_DEVICE_ID_EF_ATM_LANAI2,
+   lanaihb = PCI_DEVICE_ID_EF_ATM_LANAIHB
 };
 
 struct lanai_dev_stats {
@@ -2631,14 +2631,8 @@ static int __devinit lanai_init_one(struct pci_dev *pci,
 }
 
 static struct pci_device_id lanai_pci_tbl[] = {
-   {
-   PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAI2,
-   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
-   },
-   {
-   PCI_VENDOR_ID_EF, PCI_VENDOR_ID_EF_ATM_LANAIHB,
-   PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0
-   },
+   { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_LANAI2) },
+   { PCI_VDEVICE(EF, PCI_DEVICE_ID_EF_ATM_LANAIHB) },
{ 0, }  /* terminal entry */
 };
 MODULE_DEVICE_TABLE(pci, lanai_pci_tbl);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 75c4d4d..a260a94 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1383,8 +1383,8 @@
 #define PCI_VENDOR_ID_EF   0x111a
 #define PCI_DEVICE_ID_EF_ATM_FPGA  0x
 #define PCI_DEVICE_ID_EF_ATM_ASIC  0x0002
-#define PCI_VENDOR_ID_EF_ATM_LANAI20x0003
-#define PCI_VENDOR_ID_EF_ATM_LANAIHB   0x0005
+#define PCI_DEVICE_ID_EF_ATM_LANAI20x0003
+#define PCI_DEVICE_ID_EF_ATM_LANAIHB   0x0005
 
 #define PCI_VENDOR_ID_IDT  0x111d
 #define PCI_DEVICE_ID_IDT_IDT77201 0x0001
-
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/7][ATM]: [drivers] ioremap balanced with iounmap

2007-07-16 Thread chas williams - CONTRACTOR
[ATM]: [drivers] ioremap balanced with iounmap

Signed-off-by: Amol Lad [EMAIL PROTECTED]
Signed-off-by: chas williams [EMAIL PROTECTED]

---
commit 15fa4d7e8fda822d42bc202fe390b52309ee9d86
tree bb741ef4aba074d449f6199522f746a64c3ab244
parent 9b3515b17a74eff9aad7409dd64888cf0cd03d4d
author Amol Lad [EMAIL PROTECTED] Thu, 12 Jul 2007 14:47:50 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Thu, 12 Jul 2007 
14:47:50 -0400

 drivers/atm/eni.c|   19 +++
 drivers/atm/firestream.c |   14 +-
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 0d3a38b..0789528 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1745,7 +1745,8 @@ static int __devinit eni_do_init(struct atm_dev *dev)
printk(KERN_ERR KERN_ERR DEV_LABEL (itf %d): bad 
magic - expected 0x%x, got 0x%x\n,dev-number,
ENI155_MAGIC,(unsigned) readl(eprom-magic));
-   return -EINVAL;
+   error = -EINVAL;
+   goto unmap;
}
}
eni_dev-phy = base+PHY_BASE;
@@ -1772,17 +1773,27 @@ static int __devinit eni_do_init(struct atm_dev *dev)
printk()\n);
printk(KERN_ERR DEV_LABEL (itf %d): ERROR - wrong id 0x%x\n,
dev-number,(unsigned) eni_in(MID_RES_ID_MCON));
-   return -EINVAL;
+   error = -EINVAL;
+   goto unmap;
}
error = eni_dev-asic ? get_esi_asic(dev) : get_esi_fpga(dev,base);
-   if (error) return error;
+   if (error)
+   goto unmap;
for (i = 0; i  ESI_LEN; i++)
printk(%s%02X,i ? - : ,dev-esi[i]);
printk()\n);
printk(KERN_NOTICE DEV_LABEL (itf %d): %s,%s\n,dev-number,
eni_in(MID_RES_ID_MCON)  0x200 ? ASIC : FPGA,
media_name[eni_in(MID_RES_ID_MCON)  DAUGTHER_ID]);
-   return suni_init(dev);
+
+   error = suni_init(dev);
+   if (error)
+   goto unmap;
+out:
+   return error;
+unmap:
+   iounmap(base);
+   goto out;
 }
 
 
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 38b688f..737cea4 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1710,7 +1710,7 @@ static int __devinit fs_init (struct fs_dev *dev)
/* This bit is documented as RESERVED */
if (isr  ISR_INIT_ERR) {
printk (KERN_ERR Error initializing the FS... \n);
-   return 1;
+   goto unmap;
}
if (isr  ISR_INIT) {
fs_dprintk (FS_DEBUG_INIT, Ha! Initialized OK!\n);
@@ -1723,7 +1723,7 @@ static int __devinit fs_init (struct fs_dev *dev)
 
if (!to) {
printk (KERN_ERR timeout initializing the FS... \n);
-   return 1;
+   goto unmap;
}
 
/* XXX fix for fs155 */
@@ -1803,7 +1803,7 @@ static int __devinit fs_init (struct fs_dev *dev)
if (!dev-atm_vccs) {
printk (KERN_WARNING Couldn't allocate memory for VCC buffers. 
Woops!\n);
/* XXX Clean up. */
-   return 1;
+   goto unmap;
}
 
dev-tx_inuse = kzalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
@@ -1813,7 +1813,7 @@ static int __devinit fs_init (struct fs_dev *dev)
if (!dev-tx_inuse) {
printk (KERN_WARNING Couldn't allocate memory for tx_inuse 
bits!\n);
/* XXX Clean up. */
-   return 1;
+   goto unmap;
}
/* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
/* -- RAS2 : FS50 only: Default is OK. */
@@ -1840,7 +1840,7 @@ static int __devinit fs_init (struct fs_dev *dev)
if (request_irq (dev-irq, fs_irq, IRQF_SHARED, firestream, dev)) {
printk (KERN_WARNING couldn't get irq %d for firestream.\n, 
pci_dev-irq);
/* XXX undo all previous stuff... */
-   return 1;
+   goto unmap;
}
fs_dprintk (FS_DEBUG_INIT, Grabbed irq %d for dev at %p.\n, dev-irq, 
dev);
   
@@ -1890,6 +1890,9 @@ static int __devinit fs_init (struct fs_dev *dev)
   
func_exit ();
return 0;
+unmap:
+   iounmap(dev-base);
+   return 1;
 }
 
 static int __devinit firestream_init_one (struct pci_dev *pci_dev,
@@ -2012,6 +2015,7 @@ static void __devexit firestream_remove_one (struct 
pci_dev *pdev)
for (i=0;i  FS_NR_RX_QUEUES;i++)
free_queue (dev, dev-rx_rq[i]);
 
+   iounmap(dev-base);
fs_dprintk (FS_DEBUG_ALLOC, Free fs-dev: %p\n, dev);
nxtdev = dev-next;
kfree (dev);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body

Re: [PATCH 4/7][ATM]: [lanai] change VENDOR to DEVICE

2007-07-16 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
Because of this and the sch_atm.c rejects, I guess you're
not generating these patches against Linus's current tree.

i was working against your net-2.6 tree.  i will checkout the linus tree
and check before submitting patches.
-
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] Introduce BROKEN_ON_64BIT facility

2006-10-02 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Jeff Garzik writes:
Several driver have been marked as dependent on CONFIG_32BIT in the
past, when they should really be dependent on this new
CONFIG_BROKEN_ON_64BIT option, because the 32BIT marker was due to bugs
rather than fundamentals.

some of the drivers in atm are already marked with !64BIT and some
need to be marked.  this might be more complete for drivers/atm/Kconfig:

diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index cfa5af8..f4e0978 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -139,7 +139,7 @@ config ATM_ENI_BURST_RX_2W
 
 config ATM_FIRESTREAM
tristate Fujitsu FireStream (FS50/FS155) 
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  Driver for the Fujitsu FireStream 155 (MB86697) and
  FireStream 50 (MB86695) ATM PCI chips.
@@ -149,7 +149,7 @@ config ATM_FIRESTREAM
 
 config ATM_ZATM
tristate ZeitNet ZN1221/ZN1225
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  Driver for the ZeitNet ZN1221 (MMF) and ZN1225 (UTP-5) 155 Mbps ATM
  adapters.
@@ -173,7 +173,7 @@ #  bool '  Enable extended debugging
 #   fi
 config ATM_NICSTAR
tristate IDT 77201 (NICStAR) (ForeRunnerLE)
-   depends on PCI  ATM  !64BIT
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  The NICStAR chipset family is used in a large number of ATM NICs for
  25 and for 155 Mbps, including IDT cards and the Fore ForeRunnerLE
@@ -241,7 +241,7 @@ config ATM_IDT77252_USE_SUNI
 
 config ATM_AMBASSADOR
tristate Madge Ambassador (Collage PCI 155 Server)
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  This is a driver for ATMizer based ATM card produced by Madge
  Networks Ltd. Say Y (or M to compile as a module named ambassador)
@@ -265,7 +265,7 @@ config ATM_AMBASSADOR_DEBUG
 
 config ATM_HORIZON
tristate Madge Horizon [Ultra] (Collage PCI 25 and Collage PCI 155 
Client)
-   depends on PCI  ATM
+   depends on PCI  ATM  BROKEN_ON_64BIT
help
  This is a driver for the Horizon chipset ATM adapter cards once
  produced by Madge Networks Ltd. Say Y (or M to compile as a module
@@ -289,7 +289,7 @@ config ATM_HORIZON_DEBUG
 
 config ATM_IA
tristate Interphase ATM PCI x575/x525/x531
-   depends on PCI  ATM  !64BIT
+   depends on PCI  ATM  BROKEN_ON_64BIT
---help---
  This is a driver for the Interphase (i)ChipSAR adapter cards
  which include a variety of variants in term of the size of the
-
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: ATM bug found

2006-10-01 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Jeff Garzik writes:
If alloc_shaper() argument 'unlimited' is true, then pcr is never 
assigned a value.  However, the caller of alloc_shaper() always tests 
the pcr value, regardless of whether or not 'unlimited' is true.

when unlimited is true, this means ubr.  alloc_shaper() creates a queue
to use for all ubr (best effort) traffic.  ubr doesnt count against tx_bw
so its handled a bit differently.  alloc_shaper() should return a 0 for
the pcr since this gets assigned to the vcc's qos parameters.  min_pcr =
0 and max_pcr = 0 means best effort.

still generates a warning from gcc though.

[ATM]: [zatm] always *pcr in alloc_shaper()

Signed-off-by: Chas Williams [EMAIL PROTECTED]

diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index c491ec4..083c5d3 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -800,6 +800,7 @@ static int alloc_shaper(struct atm_dev *
i = m = 1;
zatm_dev-ubr_ref_cnt++;
zatm_dev-ubr = shaper;
+   *pcr = 0;
}
else {
if (min) {
-
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 1/3][ATM]: kmalloc to kzalloc patches for drivers/atm

2006-10-01 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: kmalloc to kzalloc patches for drivers/atm

Signed-off-by: Om Narasimhan [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 339d365266211690a446773e3eb9d864637a71bb
tree d48530e7ba716797687d2831f0f5148cda4a999a
parent f69365e8b58c325546d2e090c9019737436e0712
author Om Narasimhan [EMAIL PROTECTED] Sat, 30 Sep 2006 22:00:22 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 30 Sep 2006 
22:00:22 -0400

 drivers/atm/adummy.c |6 ++
 drivers/atm/firestream.c |   12 +++-
 drivers/atm/he.c |4 +---
 drivers/atm/horizon.c|4 +---
 drivers/atm/idt77252.c   |   23 ++-
 drivers/atm/lanai.c  |8 +---
 drivers/atm/zatm.c   |6 ++
 7 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index 6cc93de..ac2c108 100644
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -113,15 +113,13 @@ static int __init adummy_init(void)
 
printk(KERN_ERR adummy: version %s\n, DRV_VERSION);
 
-   adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
+   adummy_dev = kzalloc(sizeof(struct adummy_dev),
   GFP_KERNEL);
if (!adummy_dev) {
-   printk(KERN_ERR DEV_LABEL : kmalloc() failed\n);
+   printk(KERN_ERR DEV_LABEL : kzalloc() failed\n);
err = -ENOMEM;
goto out;
}
-   memset(adummy_dev, 0, sizeof(struct adummy_dev));
-
atm_dev = atm_dev_register(DEV_LABEL, adummy_ops, -1, NULL);
if (!atm_dev) {
printk(KERN_ERR DEV_LABEL : atm_dev_register() failed\n);
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 38fc054..7c75adf 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1784,7 +1784,7 @@ static int __devinit fs_init (struct fs_
write_fs (dev, RAM, (1  (28 - FS155_VPI_BITS - 
FS155_VCI_BITS)) - 1);
dev-nchannels = FS155_NR_CHANNELS;
}
-   dev-atm_vccs = kmalloc (dev-nchannels * sizeof (struct atm_vcc *), 
+   dev-atm_vccs = kcalloc (dev-nchannels, sizeof (struct atm_vcc *), 
 GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc atmvccs: %p(%Zd)\n,
dev-atm_vccs, dev-nchannels * sizeof (struct atm_vcc *));
@@ -1794,9 +1794,8 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-atm_vccs, 0, dev-nchannels * sizeof (struct atm_vcc *));
 
-   dev-tx_inuse = kmalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
+   dev-tx_inuse = kzalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc tx_inuse: %p(%d)\n, 
dev-atm_vccs, dev-nchannels / 8);
 
@@ -1805,8 +1804,6 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-tx_inuse, 0, dev-nchannels / 8);
-
/* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
/* -- RAS2 : FS50 only: Default is OK. */
 
@@ -1893,14 +1890,11 @@ static int __devinit firestream_init_one
if (pci_enable_device(pci_dev)) 
goto err_out;
 
-   fs_dev = kmalloc (sizeof (struct fs_dev), GFP_KERNEL);
+   fs_dev = kzalloc (sizeof (struct fs_dev), GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc fs-dev: %p(%Zd)\n,
fs_dev, sizeof (struct fs_dev));
if (!fs_dev)
goto err_out;
-
-   memset (fs_dev, 0, sizeof (struct fs_dev));
-  
atm_dev = atm_dev_register(fs, ops, -1, NULL);
if (!atm_dev)
goto err_out_free_fs_dev;
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index f2511b4..b22a914 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -383,14 +383,12 @@ he_init_one(struct pci_dev *pci_dev, con
}
pci_set_drvdata(pci_dev, atm_dev);
 
-   he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev),
+   he_dev = kzalloc(sizeof(struct he_dev),
GFP_KERNEL);
if (!he_dev) {
err = -ENOMEM;
goto init_one_failure;
}
-   memset(he_dev, 0, sizeof(struct he_dev));
-
he_dev-pci_dev = pci_dev;
he_dev-atm_dev = atm_dev;
he_dev-atm_dev-dev_data = he_dev;
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index d1113e8..209dba1 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -2719,7 +2719,7 @@ static int __devinit hrz_probe(struct pc
goto out_disable;
}
 
-   dev = kmalloc(sizeof(hrz_dev), GFP_KERNEL);
+   dev = kzalloc(sizeof(hrz_dev), GFP_KERNEL);
if (!dev) {
// perhaps we

[PATCH 2/3][ATM]: [ambassador] Change the return type to reflect reality

2006-10-01 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [ambassador] Change the return type to reflect reality

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit d7b1207f84d681df2e46c6f22ca153eb7f0944cb
tree 9204a7e7f6812bd683a0079a9a9177ec400fadbd
parent 339d365266211690a446773e3eb9d864637a71bb
author Jeff Garzik [EMAIL PROTECTED] Sun, 01 Oct 2006 10:23:44 -0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sun, 01 Oct 2006 
10:23:44 -0400

 drivers/atm/ambassador.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 4521a24..da599e6 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -915,8 +915,8 @@ #endif
 
 /** make rate (not quite as much fun as Horizon) **/
 
-static unsigned int make_rate (unsigned int rate, rounding r,
-  u16 * bits, unsigned int * actual) {
+static int make_rate (unsigned int rate, rounding r,
+ u16 * bits, unsigned int * actual) {
   unsigned char exp = -1; // hush gcc
   unsigned int man = -1;  // hush gcc
   
-
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 3/3][ATM]: [zatm] always *pcr in alloc_shaper()

2006-10-01 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [zatm] always *pcr in alloc_shaper()

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit ae0e261f74750f57c963349f5c09c8057d5eee32
tree 5e9358ef3fd7d00e3be7a1862afa62a6852c8cb6
parent d7b1207f84d681df2e46c6f22ca153eb7f0944cb
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sun, 01 Oct 2006 11:14:19 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sun, 01 Oct 2006 
11:14:19 -0400

 drivers/atm/zatm.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
index c491ec4..083c5d3 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
@@ -800,6 +800,7 @@ static int alloc_shaper(struct atm_dev *
i = m = 1;
zatm_dev-ubr_ref_cnt++;
zatm_dev-ubr = shaper;
+   *pcr = 0;
}
else {
if (min) {
-
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: ATM bug found

2006-10-01 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Mitchell Blank Jr writes:
The fix is for alloc_shaper() should really do *pcr = ATM_MAX_PCR in
the if (ubr) stanza.  Chas, want to submit that in the next batch
of patches?

i dont think you can do that.  pcr gets assigned to .min_pcr and .min_pcr
= ATM_MAX_PCR has a different meaning.  it should probably be set to 0.
there is no minimum or maximum pcr for ubr.  you get what you get.
-
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: ATM firestream bug

2006-10-01 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],Jeff Garzik writes:
1) not safe on 64-bit

firestream is not the only driver that's likely 32-bit safe only.
zatm, nicstar, horizon and ambassdor all use virt_to_bus().

2) variable 'tmc0' is indeed potentially used uninit'd, in particular if 
make_rate() returns an error (use occurs before error check).

i will fix this later.
-
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 3/8][ATM]: [lec] header indent, comment and whitespace cleanup

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] header indent, comment and whitespace cleanup

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit ad9e9d30230b99dd41921b61a506c41e168e1a84
tree cc1e31605aaf3d473c4f3c8e26d9a1f9b98e72b7
parent 55300d040155e883eb8d3dd39d381c95080719e6
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 18:18:44 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 
18:18:44 -0400

 include/linux/atmlec.h |  119 ++---
 net/atm/lec.h  |  172 ++--
 net/atm/lec_arpc.h |  148 +
 3 files changed, 235 insertions(+), 204 deletions(-)

diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
index f267f24..e7f1a75 100644
--- a/include/linux/atmlec.h
+++ b/include/linux/atmlec.h
@@ -1,9 +1,7 @@
 /*
- * 
- * ATM Lan Emulation Daemon vs. driver interface
- *
- * [EMAIL PROTECTED]
+ * ATM Lan Emulation Daemon driver interface
  *
+ * Marko Kiiskila [EMAIL PROTECTED]
  */
 
 #ifndef _ATMLEC_H_
@@ -13,76 +11,87 @@ #include linux/atmapi.h
 #include linux/atmioc.h
 #include linux/atm.h
 #include linux/if_ether.h
+
 /* ATM lec daemon control socket */
-#define ATMLEC_CTRL _IO('a',ATMIOC_LANE)
-#define ATMLEC_DATA _IO('a',ATMIOC_LANE+1)
-#define ATMLEC_MCAST _IO('a',ATMIOC_LANE+2)
+#define ATMLEC_CTRL_IO('a', ATMIOC_LANE)
+#define ATMLEC_DATA_IO('a', ATMIOC_LANE+1)
+#define ATMLEC_MCAST   _IO('a', ATMIOC_LANE+2)
 
 /* Maximum number of LEC interfaces (tweakable) */
 #define MAX_LEC_ITF 48
 
-/* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
+/*
+ * From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
  * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
  * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
  */
 #define NUM_TR_DEVS 8
 
-typedef enum { 
-l_set_mac_addr,   l_del_mac_addr, 
-l_svc_setup, 
-l_addr_delete,l_topology_change, 
-l_flush_complete, l_arp_update,
-l_narp_req, /* LANE2 mandates the use of this */
-l_config, l_flush_tran_id, 
-l_set_lecid,  l_arp_xmt,
-l_rdesc_arp_xmt,
-l_associate_req,
-l_should_bridge   /* should we bridge this MAC? */
+typedef enum {
+   l_set_mac_addr,
+   l_del_mac_addr,
+   l_svc_setup,
+   l_addr_delete,
+   l_topology_change,
+   l_flush_complete,
+   l_arp_update,
+   l_narp_req, /* LANE2 mandates the use of this */
+   l_config,
+   l_flush_tran_id,
+   l_set_lecid,
+   l_arp_xmt,
+   l_rdesc_arp_xmt,
+   l_associate_req,
+   l_should_bridge /* should we bridge this MAC? */
 } atmlec_msg_type;
 
 #define ATMLEC_MSG_TYPE_MAX l_should_bridge
 
 struct atmlec_config_msg {
-unsigned int maximum_unknown_frame_count;
-unsigned int max_unknown_frame_time;
-unsigned short max_retry_count;
-unsigned int aging_time;
-unsigned int forward_delay_time;
-unsigned int arp_response_time;
-unsigned int flush_timeout;
-unsigned int path_switching_delay;
-unsigned int  lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */
-int mtu;
-int is_proxy;
+   unsigned int maximum_unknown_frame_count;
+   unsigned int max_unknown_frame_time;
+   unsigned short max_retry_count;
+   unsigned int aging_time;
+   unsigned int forward_delay_time;
+   unsigned int arp_response_time;
+   unsigned int flush_timeout;
+   unsigned int path_switching_delay;
+   unsigned int lane_version;  /* LANE2: 1 for LANEv1, 2 for LANEv2 */
+   int mtu;
+   int is_proxy;
 };
- 
+
 struct atmlec_msg {
-atmlec_msg_type type;
-int sizeoftlvs;/* LANE2: if != 0, tlvs follow */ 
-union {
-struct {
-unsigned char mac_addr[ETH_ALEN];
-unsigned char atm_addr[ATM_ESA_LEN];
-unsigned int flag;/* Topology_change flag, 
-  remoteflag, permanent flag,
-  lecid, transaction id */
-unsigned int targetless_le_arp; /* LANE2 */
-unsigned int no_source_le_narp; /* LANE2 */
-} normal;
-struct atmlec_config_msg config;
-struct {
-uint16_t lec_id; /* requestor 
lec_id  */
-uint32_t tran_id;/* transaction id 
   */
-unsigned char mac_addr[ETH_ALEN];/* dst mac addr   
   */
-unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM 
addr */
-} proxy;
-/* For mapping LE_ARP

[PATCH 4/8][ATM]: [lec] convert lec_arp_table to hlist

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] convert lec_arp_table to hlist

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit cf14c654bcb812dae6ed85075777a19e1e02bee1
tree d01bc707baf050862e676e5609081ba1cc22aca1
parent ad9e9d30230b99dd41921b61a506c41e168e1a84
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 18:52:59 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 
18:52:59 -0400

 net/atm/lec.c  |  442 +++-
 net/atm/lec.h  |8 -
 net/atm/lec_arpc.h |2 
 3 files changed, 170 insertions(+), 282 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 13aeacf..87fb0c2 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -806,7 +806,7 @@ #endif
dev_kfree_skb(skb);
return;
}
-   if (priv-lec_arp_empty_ones) {
+   if (!hlist_empty(priv-lec_arp_empty_ones)) {
lec_arp_check_empties(priv, vcc, skb);
}
skb-dev = dev;
@@ -998,29 +998,32 @@ static void lec_info(struct seq_file *se
 struct lec_state {
unsigned long flags;
struct lec_priv *locked;
-   struct lec_arp_table *entry;
+   struct hlist_node *node;
struct net_device *dev;
int itf;
int arp_table;
int misc_table;
 };
 
-static void *lec_tbl_walk(struct lec_state *state, struct lec_arp_table *tbl,
+static void *lec_tbl_walk(struct lec_state *state, struct hlist_head *tbl,
  loff_t *l)
 {
-   struct lec_arp_table *e = state-entry;
+   struct hlist_node *e = state-node;
+   struct lec_arp_table *tmp;
 
if (!e)
-   e = tbl;
+   e = tbl-first;
if (e == (void *)1) {
-   e = tbl;
+   e = tbl-first;
--*l;
}
-   for (; e; e = e-next) {
+
+   hlist_for_each_entry_from(tmp, e, next) {
if (--*l  0)
break;
}
-   state-entry = e;
+   state-node = e;
+
return (*l  0) ? state : NULL;
 }
 
@@ -1031,7 +1034,7 @@ static void *lec_arp_walk(struct lec_sta
int p;
 
for (p = state-arp_table; p  LEC_ARP_TABLE_SIZE; p++) {
-   v = lec_tbl_walk(state, priv-lec_arp_tables[p], l);
+   v = lec_tbl_walk(state, priv-lec_arp_tables[p], l);
if (v)
break;
}
@@ -1042,10 +1045,10 @@ static void *lec_arp_walk(struct lec_sta
 static void *lec_misc_walk(struct lec_state *state, loff_t *l,
   struct lec_priv *priv)
 {
-   struct lec_arp_table *lec_misc_tables[] = {
-   priv-lec_arp_empty_ones,
-   priv-lec_no_forward,
-   priv-mcast_fwds
+   struct hlist_head *lec_misc_tables[] = {
+   priv-lec_arp_empty_ones,
+   priv-lec_no_forward,
+   priv-mcast_fwds
};
void *v = NULL;
int q;
@@ -1112,7 +1115,7 @@ static void *lec_seq_start(struct seq_fi
state-locked = NULL;
state-arp_table = 0;
state-misc_table = 0;
-   state-entry = (void *)1;
+   state-node = (void *)1;
 
return *pos ? lec_get_idx(state, *pos) : (void *)1;
 }
@@ -1148,9 +1151,10 @@ static int lec_seq_show(struct seq_file 
else {
struct lec_state *state = seq-private;
struct net_device *dev = state-dev;
+   struct lec_arp_table *entry = hlist_entry(state-node, struct 
lec_arp_table, next);
 
seq_printf(seq, %s , dev-name);
-   lec_info(seq, state-entry);
+   lec_info(seq, entry);
}
return 0;
 }
@@ -1455,8 +1459,11 @@ static void lec_arp_init(struct lec_priv
unsigned short i;
 
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
-   priv-lec_arp_tables[i] = NULL;
+   INIT_HLIST_HEAD(priv-lec_arp_tables[i]);
}
+INIT_HLIST_HEAD(priv-lec_arp_empty_ones);
+INIT_HLIST_HEAD(priv-lec_no_forward);
+INIT_HLIST_HEAD(priv-mcast_fwds);
spin_lock_init(priv-lec_arp_lock);
init_timer(priv-lec_arp_timer);
priv-lec_arp_timer.expires = jiffies + LEC_ARP_REFRESH_INTERVAL;
@@ -1479,7 +1486,7 @@ static void lec_arp_clear_vccs(struct le
vcc-user_back = NULL;
vcc-push = entry-old_push;
vcc_release_async(vcc, -EPIPE);
-   vcc = NULL;
+   entry-vcc = NULL;
}
if (entry-recv_vcc) {
entry-recv_vcc-push = entry-old_recv_push;
@@ -1493,27 +1500,17 @@ static void lec_arp_clear_vccs(struct le
  * LANE2: Add to the end of the list to satisfy 8.1.13
  */
 static inline void
-lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add)
+lec_arp_add(struct lec_priv *priv, struct lec_arp_table *entry

[PATCH 5/8][ATM]: [lec] old_close is no longer used

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] old_close is no longer used

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 693b186c2a764f62e017db4b7ed39298831d99e8
tree d054ccd10917693803070634a21481b09361b126
parent cf14c654bcb812dae6ed85075777a19e1e02bee1
author chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 18:54:09 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Wed, 20 Sep 2006 
18:54:09 -0400

 net/atm/lec_arpc.h |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/net/atm/lec_arpc.h b/net/atm/lec_arpc.h
index 3cc2eba..69aeb07 100644
--- a/net/atm/lec_arpc.h
+++ b/net/atm/lec_arpc.h
@@ -24,9 +24,6 @@ struct lec_arp_table {
void (*old_recv_push) (struct atm_vcc *vcc, struct sk_buff *skb);
/* Push that leads to daemon */
 
-   void (*old_close) (struct atm_vcc *vcc);
-   /* We want to see when this vcc gets 
closed */
-
unsigned long last_used;/* For expiry */
unsigned long timestamp;/* Used for various timestamping things:
 * 1. FLUSH started 
-
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/8][ATM]: [lec] use work queue instead of timer for lec arp expiry

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] use work queue instead of timer for lec arp expiry

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 0152dcfb9d42e203ff26d1619158c9664cfbf2d9
tree 24d0a36e52e7d4e86dd7bf1422ae9948011a194d
parent 693b186c2a764f62e017db4b7ed39298831d99e8
author chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 07:22:57 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 
07:22:57 -0400

 net/atm/lec.c |   17 +++--
 net/atm/lec.h |2 +-
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 87fb0c2..8a9f9ab 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1442,7 +1442,7 @@ #define DEBUG_ARP_TABLE 0
 
 #define LEC_ARP_REFRESH_INTERVAL (3*HZ)
 
-static void lec_arp_check_expire(unsigned long data);
+static void lec_arp_check_expire(void *data);
 static void lec_arp_expire_arp(unsigned long data);
 
 /* 
@@ -1465,11 +1465,8 @@ static void lec_arp_init(struct lec_priv
 INIT_HLIST_HEAD(priv-lec_no_forward);
 INIT_HLIST_HEAD(priv-mcast_fwds);
spin_lock_init(priv-lec_arp_lock);
-   init_timer(priv-lec_arp_timer);
-   priv-lec_arp_timer.expires = jiffies + LEC_ARP_REFRESH_INTERVAL;
-   priv-lec_arp_timer.data = (unsigned long)priv;
-   priv-lec_arp_timer.function = lec_arp_check_expire;
-   add_timer(priv-lec_arp_timer);
+   INIT_WORK(priv-lec_arp_work, lec_arp_check_expire, priv);
+   schedule_delayed_work(priv-lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
 }
 
 static void lec_arp_clear_vccs(struct lec_arp_table *entry)
@@ -1719,7 +1716,7 @@ static void lec_arp_destroy(struct lec_p
struct lec_arp_table *entry;
int i;
 
-   del_timer_sync(priv-lec_arp_timer);
+   cancel_rearming_delayed_work(priv-lec_arp_work);
 
/*
 * Remove all entries
@@ -1865,10 +1862,10 @@ static void lec_arp_expire_vcc(unsigned 
  *   to ESI_FORWARD_DIRECT. This causes the flush period to end
  *   regardless of the progress of the flush protocol.
  */
-static void lec_arp_check_expire(unsigned long data)
+static void lec_arp_check_expire(void *data)
 {
unsigned long flags;
-   struct lec_priv *priv = (struct lec_priv *)data;
+   struct lec_priv *priv = data;
struct hlist_node *node, *next;
struct lec_arp_table *entry;
unsigned long now;
@@ -1930,7 +1927,7 @@ static void lec_arp_check_expire(unsigne
}
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
 
-   mod_timer(priv-lec_arp_timer, jiffies + LEC_ARP_REFRESH_INTERVAL);
+   schedule_delayed_work(priv-lec_arp_work, LEC_ARP_REFRESH_INTERVAL);
 }
 
 /*
diff --git a/net/atm/lec.h b/net/atm/lec.h
index 8a6cb64..5bf3544 100644
--- a/net/atm/lec.h
+++ b/net/atm/lec.h
@@ -93,7 +93,7 @@ struct lec_priv {
spinlock_t lec_arp_lock;
struct atm_vcc *mcast_vcc;  /* Default Multicast Send VCC */
struct atm_vcc *lecd;
-   struct timer_list lec_arp_timer;/* C10 */
+   struct work_struct lec_arp_work;/* C10 */
unsigned int maximum_unknown_frame_count;
/*
 * Within the period of time 
defined by this variable, the client will send 
-
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 7/8][ATM]: [lec] add reference counting to lec_arp entries

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] add reference counting to lec_arp entries

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 397725689277192a899da4009cd078bab8f6ee2d
tree 3bba44e1549229947ed332bb6263c704cabd55c7
parent 0152dcfb9d42e203ff26d1619158c9664cfbf2d9
author chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 07:28:18 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 
07:28:18 -0400

 net/atm/lec.c  |   42 --
 net/atm/lec_arpc.h |1 +
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 8a9f9ab..c865f68 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -107,6 +107,19 @@ static void lec_vcc_added(struct lec_pri
struct sk_buff *skb));
 static void lec_vcc_close(struct lec_priv *priv, struct atm_vcc *vcc);
 
+/* must be done under lec_arp_lock */
+static inline void lec_arp_hold(struct lec_arp_table *entry)
+{
+   atomic_inc(entry-usage);
+}
+
+static inline void lec_arp_put(struct lec_arp_table *entry)
+{
+   if (atomic_dec_and_test(entry-usage))
+   kfree(entry);
+}
+
+
 static struct lane2_ops lane2_ops = {
lane2_resolve,  /* resolve, spec 3.1.3 */
lane2_associate_req,/* associate_req,   spec 3.1.4 */
@@ -795,7 +808,7 @@ #endif
entry = lec_arp_find(priv, src);
if (entry  entry-vcc != vcc) {
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
}
}
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
@@ -1726,7 +1739,7 @@ static void lec_arp_destroy(struct lec_p
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
hlist_for_each_entry_safe(entry, node, next, 
priv-lec_arp_tables[i], next) {
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-lec_arp_tables[i]);
}
@@ -1735,7 +1748,7 @@ static void lec_arp_destroy(struct lec_p
del_timer_sync(entry-timer);
lec_arp_clear_vccs(entry);
hlist_del(entry-next);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-lec_arp_empty_ones);

@@ -1743,7 +1756,7 @@ static void lec_arp_destroy(struct lec_p
del_timer_sync(entry-timer);
lec_arp_clear_vccs(entry);
hlist_del(entry-next);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-lec_no_forward);
 
@@ -1751,7 +1764,7 @@ static void lec_arp_destroy(struct lec_p
/* No timer, LANEv2 7.1.20 and 2.3.5.3 */
lec_arp_clear_vccs(entry);
hlist_del(entry-next);
-   kfree(entry);
+   lec_arp_put(entry);
}
INIT_HLIST_HEAD(priv-mcast_fwds);
priv-mcast_vcc = NULL;
@@ -1799,6 +1812,7 @@ static struct lec_arp_table *make_entry(
to_return-last_used = jiffies;
to_return-priv = priv;
skb_queue_head_init(to_return-tx_wait);
+   atomic_set(to_return-usage, 1);
return to_return;
 }
 
@@ -1843,7 +1857,7 @@ static void lec_arp_expire_vcc(unsigned 
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
 
lec_arp_clear_vccs(to_remove);
-   kfree(to_remove);
+   lec_arp_put(to_remove);
 }
 
 /*
@@ -1891,7 +1905,7 @@ static void lec_arp_check_expire(void *d
/* Remove entry */
DPRINTK(LEC:Entry timed out\n);
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
} else {
/* Something else */
if ((entry-status == ESI_VC_PENDING ||
@@ -2045,7 +2059,7 @@ lec_addr_delete(struct lec_priv *priv, u
 (permanent ||
!(entry-flags  LEC_PERMANENT_FLAG))) {
lec_arp_remove(priv, entry);
-   kfree(entry);
+   lec_arp_put(entry);
}
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
return 0;
@@ -2094,7 +2108,7 @@ lec_arp_update(struct lec_priv *priv, un
tmp-old_push = entry-old_push;
tmp-last_used = jiffies;
del_timer(entry-timer);
-   kfree(entry

[PATCH 8/8][ATM]: [lec] use refcnt to protect lec_arp_entries outside lock

2006-09-29 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: [lec] use refcnt to protect lec_arp_entries outside lock

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 74391472d01cdd483714b807c9417a0279ed75d5
tree a191d09973b569f0562d9d433c324bbe80a08560
parent 397725689277192a899da4009cd078bab8f6ee2d
author chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 22:07:01 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Mon, 25 Sep 2006 
22:07:01 -0400

 net/atm/lec.c |   34 --
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index c865f68..9e635a0 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -396,7 +396,7 @@ #endif
priv-stats.tx_dropped++;
dev_kfree_skb(skb);
}
-   return 0;
+   goto out;
}
 #if DUMP_PACKETS  0
printk(%s:sending to vpi:%d vci:%d\n, dev-name, vcc-vpi, vcc-vci);
@@ -428,6 +428,9 @@ #endif /* DUMP_PACKETS  0 */
netif_wake_queue(dev);
}
 
+out:
+   if (entry)
+   lec_arp_put(entry);
dev-trans_start = jiffies;
return 0;
 }
@@ -1888,6 +1891,7 @@ static void lec_arp_check_expire(void *d
 
DPRINTK(lec_arp_check_expire %p\n, priv);
now = jiffies;
+restart:
spin_lock_irqsave(priv-lec_arp_lock, flags);
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
hlist_for_each_entry_safe(entry, node, next, 
priv-lec_arp_tables[i], next) {
@@ -1927,14 +1931,16 @@ static void lec_arp_check_expire(void *d
time_after_eq(now, entry-timestamp +
  priv-path_switching_delay)) {
struct sk_buff *skb;
+   struct atm_vcc *vcc = entry-vcc;
 
-   while ((skb =
-   skb_dequeue(entry-tx_wait)) !=
-  NULL)
-   lec_send(entry-vcc, skb,
-entry-priv);
+   lec_arp_hold(entry);
+   
spin_unlock_irqrestore(priv-lec_arp_lock, flags);
+   while ((skb = 
skb_dequeue(entry-tx_wait)) != NULL)
+   lec_send(vcc, skb, entry-priv);
entry-last_used = jiffies;
entry-status = ESI_FORWARD_DIRECT;
+   lec_arp_put(entry);
+   goto restart;
}
}
}
@@ -1977,6 +1983,7 @@ static struct atm_vcc *lec_arp_resolve(s
if (entry-status == ESI_FORWARD_DIRECT) {
/* Connection Ok */
entry-last_used = jiffies;
+   lec_arp_hold(entry);
*ret_entry = entry;
found = entry-vcc;
goto out;
@@ -2007,6 +2014,7 @@ static struct atm_vcc *lec_arp_resolve(s
 * or BUS flood limit was reached for an entry which is
 * in ESI_ARP_PENDING or ESI_VC_PENDING state.
 */
+   lec_arp_hold(entry);
*ret_entry = entry;
DPRINTK(lec: entry-status %d entry-vcc %p\n, entry-status,
entry-vcc);
@@ -2335,18 +2343,24 @@ static void lec_flush_complete(struct le
int i;
 
DPRINTK(LEC:lec_flush_complete %lx\n, tran_id);
+restart:
spin_lock_irqsave(priv-lec_arp_lock, flags);
for (i = 0; i  LEC_ARP_TABLE_SIZE; i++) {
hlist_for_each_entry(entry, node, priv-lec_arp_tables[i], 
next) {
if (entry-flush_tran_id == tran_id
 entry-status == ESI_FLUSH_PENDING) {
struct sk_buff *skb;
+   struct atm_vcc *vcc = entry-vcc;
 
-   while ((skb =
-   skb_dequeue(entry-tx_wait)) != NULL)
-   lec_send(entry-vcc, skb, entry-priv);
+   lec_arp_hold(entry);
+   spin_unlock_irqrestore(priv-lec_arp_lock, 
flags);
+   while ((skb = skb_dequeue(entry-tx_wait)) != 
NULL)
+   lec_send(vcc, skb, entry-priv);
+   entry-last_used = jiffies;
entry-status = ESI_FORWARD_DIRECT;
+   lec_arp_put(entry);
DPRINTK(LEC_ARP: Flushed\n

Re: [PATCH] [ATM] he: Fix __init/__devinit conflict

2006-09-25 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
Chas, as a subsystem maintainer, if you change a submitter's patch in
a significant and non-trivial way, you should at least mention a brief
reason why you did that.  In this case, why did you delete all of
Roland's __init/__devinit transformations except one when they all
were necessary to fix this bug?

i submitted roland patch without modification and therefore
without comment.  i did change the author field of the patch
unintentionally (which wont happen in the future).
-
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


[RFC] indenting/whitespace/comment clean for lane client

2006-09-19 Thread chas williams - CONTRACTOR
its rather big (4000+ lines) so i am posting a url here instead.
this reduces net/atm/lec.c by about 17k.

ftp://ftp.cmf.nrl.navy.mil/pub/chas/netdev/lec-cleanup-diff
-
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 1/3][ATM]: [he] he_init_one() is declared __devinit, but calls __init functions

2006-09-16 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [he] he_init_one() is declared __devinit, but calls __init functions

he_init_one() is declared __devinit, but calls lots of init functions
that are marked __init.  However, if CONFIG_HOTPLUG is enabled,
__devinit functions go into normal .text, which leads to

WARNING: drivers/atm/he.o - Section mismatch: reference to .init.text:
from .text between 'he_start' (at offset 0x2130) and 'he_service_tbrq'

Fix this by changing the __init functions to __devinit.

Signed-off-by: Roland Dreier [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit c0361a8558796e5af9c5d4e8d4900e4dc44c2e4e
tree 9ad8e4378eb731b220f1e91f1d92b3122f4d6565
parent 96086141b3a9dcde8f0946ae01f9faa55ac0bf4d
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 15:44:55 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 
15:44:55 -0400

 drivers/atm/he.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index dd96123..4598b1f 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -454,7 +454,7 @@ #define NONZERO (1  14)
return (NONZERO | (exp  9) | (rate  0x1ff));
 }
 
-static void __init
+static void __devinit
 he_init_rx_lbfp0(struct he_dev *he_dev)
 {
unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -485,7 +485,7 @@ he_init_rx_lbfp0(struct he_dev *he_dev)
he_writel(he_dev, he_dev-r0_numbuffs, RLBF0_C);
 }
 
-static void __init
+static void __devinit
 he_init_rx_lbfp1(struct he_dev *he_dev)
 {
unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -516,7 +516,7 @@ he_init_rx_lbfp1(struct he_dev *he_dev)
he_writel(he_dev, he_dev-r1_numbuffs, RLBF1_C);
 }
 
-static void __init
+static void __devinit
 he_init_tx_lbfp(struct he_dev *he_dev)
 {
unsigned i, lbm_offset, lbufd_index, lbuf_addr, lbuf_count;
@@ -546,7 +546,7 @@ he_init_tx_lbfp(struct he_dev *he_dev)
he_writel(he_dev, lbufd_index - 1, TLBF_T);
 }
 
-static int __init
+static int __devinit
 he_init_tpdrq(struct he_dev *he_dev)
 {
he_dev-tpdrq_base = pci_alloc_consistent(he_dev-pci_dev,
@@ -568,7 +568,7 @@ he_init_tpdrq(struct he_dev *he_dev)
return 0;
 }
 
-static void __init
+static void __devinit
 he_init_cs_block(struct he_dev *he_dev)
 {
unsigned clock, rate, delta;
@@ -664,7 +664,7 @@ he_init_cs_block(struct he_dev *he_dev)
 
 }
 
-static int __init
+static int __devinit
 he_init_cs_block_rcm(struct he_dev *he_dev)
 {
unsigned (*rategrid)[16][16];
@@ -785,7 +785,7 @@ #define RTGTBL_OFFSET 0x400
return 0;
 }
 
-static int __init
+static int __devinit
 he_init_group(struct he_dev *he_dev, int group)
 {
int i;
@@ -955,7 +955,7 @@ #endif
return 0;
 }
 
-static int __init
+static int __devinit
 he_init_irq(struct he_dev *he_dev)
 {
int i;
-
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/3][ATM]: [he] don't hold the device lock when upcalling

2006-09-16 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [he] don't hold the device lock when upcalling

This can create a deadlock/lock ordering problem with other layers that
want to use the transmit (or other) path of the card at that time.

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit fc6b6284e9383bd8d9fd95210fbc5e3c54ccc65d
tree cfb6beef3334433e331d27f453d0c3901bd7c5c2
parent c0361a8558796e5af9c5d4e8d4900e4dc44c2e4e
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 15:49:53 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 
15:49:53 -0400

 drivers/atm/he.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index 4598b1f..55ca7d8 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1928,7 +1928,9 @@ #endif
 #ifdef notdef
ATM_SKB(skb)-vcc = vcc;
 #endif
+   spin_unlock(he_dev-global_lock);
vcc-push(vcc, skb);
+   spin_lock(he_dev-global_lock);
 
atomic_inc(vcc-stats-rx);
 
-
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 3/3][ATM]: potential NULL pointer dereference in clip_mkip()

2006-09-16 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: potential NULL pointer dereference in clip_mkip()

http://article.gmane.org/gmane.linux.kernel/445717

When re-processing received data, a struct sk_buff pointer skb may be
dereferenced after a free operation.

From: Frederik Deweerdt [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 87409562aeed5fb2b85dc2f9bddca0a1bbde8c37
tree 0885b8bd2b8881201de422877abd8979861c44de
parent fc6b6284e9383bd8d9fd95210fbc5e3c54ccc65d
author chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 15:55:01 
-0400
committer chas williams - CONTRACTOR [EMAIL PROTECTED] Sat, 16 Sep 2006 
15:55:01 -0400

 net/atm/clip.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/atm/clip.c b/net/atm/clip.c
index 7ce7bfe..0dfa3a4 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -500,9 +500,9 @@ static int clip_mkip(struct atm_vcc *vcc
} else {
unsigned int len = skb-len;
 
-   clip_push(vcc, skb);
PRIV(skb-dev)-stats.rx_packets--;
PRIV(skb-dev)-stats.rx_bytes -= len;
+   clip_push(vcc, skb);
}
return 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 1/1][ATM]: [he] when transmit fails, unmap the dma regions

2006-09-07 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [he] when transmit fails, unmap the dma regions

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit e2c84ae30cb2dca23afb5e811c108e235f941c3d
tree a4acb86e2e10baa5ac651e566a550e0af0c55507
parent 0d60b74cf4354672e4586ca2bedde6695db43165
author chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 17:04:14 -0400
committer chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 17:04:14 -0400

 drivers/atm/he.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index d369130..dd96123 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -2282,6 +2282,8 @@ __enqueue_tpd(struct he_dev *he_dev, str
TPDRQ_MASK(he_readl(he_dev, TPDRQ_B_H)));
 
if (new_tail == he_dev-tpdrq_head) {
+   int slot;
+
hprintk(tpdrq full (cid 0x%x)\n, cid);
/*
 * FIXME
@@ -2289,6 +2291,13 @@ __enqueue_tpd(struct he_dev *he_dev, str
 * after service_tbrq, service the backlog
 * for now, we just drop the pdu
 */
+   for (slot = 0; slot  TPD_MAXIOV; ++slot) {
+   if (tpd-iovec[slot].addr)
+   pci_unmap_single(he_dev-pci_dev,
+   tpd-iovec[slot].addr,
+   tpd-iovec[slot].len  
TPD_LEN_MASK,
+   
PCI_DMA_TODEVICE);
+   }
if (tpd-skb) {
if (tpd-vcc-pop)
tpd-vcc-pop(tpd-vcc, tpd-skb);
-
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 1/2][ATM]: Move linux/device.h include in linux/atmdev.h to #ifdef __KERNEL__ section

2006-09-07 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: Move linux/device.h include in linux/atmdev.h to #ifdef __KERNEL__ 
section

linux/device.h header is not included in the David Woodhouse's
kernel-headers git tree which is used for userspace kernel headers. Which
results in compile errors when building iproute2.

Signed-off-by: Ismail Donmez [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 0293994f3f7a3a4bc4db6e286473e9b422b8f582
tree b8b24f8e3025e23dbeb61dc101ca1f35f8efaf8e
parent 837a0955d484497fc6b0b1991d9cf77fb74f15e8
author chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:14:26 -0400
committer chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:14:26 -0400

 include/linux/atmdev.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 41788a3..2096e5c 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -7,7 +7,6 @@ #ifndef LINUX_ATMDEV_H
 #define LINUX_ATMDEV_H
 
 
-#include linux/device.h
 #include linux/atmapi.h
 #include linux/atm.h
 #include linux/atmioc.h
@@ -210,6 +209,7 @@ #define ATM_VF2TXT_MAP \
 
 #ifdef __KERNEL__
 
+#include linux/device.h
 #include linux/wait.h /* wait_queue_head_t */
 #include linux/time.h /* struct timeval */
 #include linux/net.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


[PATCH 2/2][ATM]: proper prototypes in net/atm/mpc.h (and reduce ifdef clutter)

2006-09-07 Thread chas williams - CONTRACTOR
please consider for 2.6.19 -- thanks!

[ATM]: proper prototypes in net/atm/mpc.h (and reduce ifdef clutter)

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 0d60b74cf4354672e4586ca2bedde6695db43165
tree 6d87bc63ee248fee449133cb62614f963fc97f54
parent 0293994f3f7a3a4bc4db6e286473e9b422b8f582
author chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:56:26 -0400
committer chas williams [EMAIL PROTECTED] Thu, 07 Sep 2006 15:56:26 -0400

 net/atm/mpc.c |   11 ---
 net/atm/mpc.h |8 
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 0070466..b87c2a8 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -98,11 +98,6 @@ static struct notifier_block mpoa_notifi
0
 };
 
-#ifdef CONFIG_PROC_FS
-extern int mpc_proc_init(void);
-extern void mpc_proc_clean(void);
-#endif
-
 struct mpoa_client *mpcs = NULL; /* FIXME */
 static struct atm_mpoa_qos *qos_head = NULL;
 static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
@@ -1439,12 +1434,8 @@ static __init int atm_mpoa_init(void)
 {
register_atm_ioctl(atm_ioctl_ops);
 
-#ifdef CONFIG_PROC_FS
if (mpc_proc_init() != 0)
printk(KERN_INFO mpoa: failed to initialize /proc/mpoa\n);
-   else
-   printk(KERN_INFO mpoa: /proc/mpoa initialized\n);
-#endif
 
printk(mpc.c:  __DATE__   __TIME__  initialized\n);
 
@@ -1457,9 +1448,7 @@ static void __exit atm_mpoa_cleanup(void
struct atm_mpoa_qos *qos, *nextqos;
struct lec_priv *priv;
 
-#ifdef CONFIG_PROC_FS
mpc_proc_clean();
-#endif
 
del_timer(mpc_timer);
unregister_netdevice_notifier(mpoa_notifier);
diff --git a/net/atm/mpc.h b/net/atm/mpc.h
index 863ddf6..3c7981a 100644
--- a/net/atm/mpc.h
+++ b/net/atm/mpc.h
@@ -50,4 +50,12 @@ int atm_mpoa_delete_qos(struct atm_mpoa_
 struct seq_file;
 void atm_mpoa_disp_qos(struct seq_file *m);
 
+#ifdef CONFIG_PROC_FS
+int mpc_proc_init(void);
+void mpc_proc_clean(void);
+#else
+#define mpc_proc_init() (0)
+#define mpc_proc_clean() do { } while(0)
+#endif
+
 #endif /* _MPC_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


Re: [PATCH] clear skb cb on IP input

2006-07-16 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
From: Herbert Xu [EMAIL PROTECTED]
 At least this lets us get rid of a few other memsets :)
 
Applied, good spotting :-)  I remember when we added those
things.

But I'm beginning to think that the onus of this may in fact fall upon
the devices, in fact.  Loopback is one of the few devices where the
control block might not be cleared out, due to uses in the output
path.  Devices predominantly provide a zero'd out control block in the
skb on packet receive.

the atm layer has the same problem.  some atm device drivers use the
skb cb field, so it needs to be zero'ed by the next upper layer (clip,
lane) before being passed to the ip layer.  its also possible that the
atm layer should clone the skb before passing to the next layer which
would also zeroize the cb.

Other opinions welcome...

why does the input side of the ip layer believe the cb contains valid
data?  it should zero the contents of the cb, or just fill in the cb
correctly when the packet arrives at its doorstop.
-
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] correct dev_alloc_skb kerneldoc

2006-07-14 Thread chas williams - CONTRACTOR
In message [EMAIL PROTECTED],David Miller writes:
From: Christoph Hellwig [EMAIL PROTECTED]
Date: Thu, 13 Jul 2006 22:36:16 +0200
  - drivers/atm/{idt77252.c, nicstar.c}, drivers/usb/atm/usbatm.c:
  These use private skb queues and do odd things.  I can't see
  any point for using dev_alloc_skb with it's additional headroom
  reservation here.

as i recall, for simple rfc1483 encapsulation, the LLC/SNAP header of 8
bytes needs to be replaced by an ether header of 14 bytes.  its likely
this is the reason dev_alloc_skb() is used.  most of the other drivers
use atm_alloc_charge() which does a skb_reserve(), but these drivers
dont dma directly into a skb.

Any of these cases that DMA into the skb allocated will need
the headroom, as explained by the PowerPC folks.

this only works for ordinary ip traffic (which i admit is the most
common case).  but since the nicstar/idt77252 devices have a peak
speed of 155Mb/s i doubt they would suffer much.  considering they still
use virt_to_bus/bus_to_virt i would be a bit surprised if they worked
(atleast on ppc64).  they can be simply converted to alloc_skb() and
manually skb_reserve() a little overhead.

usbatm should probably be converted to use atm_alloc_charge() since
the vcc is known at this point unlike the nicstar/idt77252 case.
-
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 1/2][ATM]: Typo in drivers/atm/Kconfig...

2006-07-07 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: Typo in drivers/atm/Kconfig...

From: Matt LaPlante [EMAIL PROTECTED]
Signed-off-by: Charles Williams [EMAIL PROTECTED]

---
commit 8bbf3465e23c41b92931e2d2172c184ccd1d2510
tree d1620632c703f8d67790a4f9971f154949399740
parent d0cddc7d78816bf6ceae9730eb51d78a73a62c15
author chas williams [EMAIL PROTECTED] Thu, 06 Jul 2006 12:38:03 -0400
committer chas williams [EMAIL PROTECTED] Thu, 06 Jul 2006 12:38:03 -0400

 drivers/atm/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index 01a9f1c..cfa5af8 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -398,7 +398,7 @@ config ATM_FORE200E_USE_TASKLET
default n
help
  This defers work to be done by the interrupt handler to a
- tasklet instead of hanlding everything at interrupt time.  This
+ tasklet instead of handling everything at interrupt time.  This
  may improve the responsive of the host.
 
 config ATM_FORE200E_TX_RETRY
-
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/2][ATM]: fix possible recursive locking in skb_migrate()

2006-07-07 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: fix possible recursive locking in skb_migrate()

ok this is a real potential deadlock in a way, it takes two locks of 2
skbuffs without doing any kind of lock ordering; I think the following
patch should fix it. Just sort the lock taking order by address of the
skb.. it's not pretty but it's the best this can do in a minimally
invasive way.

Signed-off-by: Arjan van de Ven [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit c895a2f42057801ca096f5155e85bc2b2f381250
tree ee64100fdd0302fe5c12ce6c153eea8b94010f2b
parent 8bbf3465e23c41b92931e2d2172c184ccd1d2510
author chas williams [EMAIL PROTECTED] Fri, 07 Jul 2006 18:11:30 -0400
committer chas williams [EMAIL PROTECTED] Fri, 07 Jul 2006 18:11:30 -0400

 net/atm/ipcommon.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/net/atm/ipcommon.c b/net/atm/ipcommon.c
index 4b1faca..1d3de42 100644
--- a/net/atm/ipcommon.c
+++ b/net/atm/ipcommon.c
@@ -25,22 +25,27 @@ #endif
 /*
  * skb_migrate appends the list at from to to, emptying from in the
  * process. skb_migrate is atomic with respect to all other skb operations on
- * from and to. Note that it locks both lists at the same time, so beware
- * of potential deadlocks.
+ * from and to. Note that it locks both lists at the same time, so to deal
+ * with the lock ordering, the locks are taken in address order.
  *
  * This function should live in skbuff.c or skbuff.h.
  */
 
 
-void skb_migrate(struct sk_buff_head *from,struct sk_buff_head *to)
+void skb_migrate(struct sk_buff_head *from, struct sk_buff_head *to)
 {
unsigned long flags;
struct sk_buff *skb_from = (struct sk_buff *) from;
struct sk_buff *skb_to = (struct sk_buff *) to;
struct sk_buff *prev;
 
-   spin_lock_irqsave(from-lock,flags);
-   spin_lock(to-lock);
+   if ((unsigned long) from  (unsigned long) to) {
+   spin_lock_irqsave(from-lock, flags);
+   spin_lock_nested(to-lock, SINGLE_DEPTH_NESTING);
+   } else {
+   spin_lock_irqsave(to-lock, flags);
+   spin_lock_nested(from-lock, SINGLE_DEPTH_NESTING);
+   }
prev = from-prev;
from-next-prev = to-prev;
prev-next = skb_to;
@@ -51,7 +56,7 @@ void skb_migrate(struct sk_buff_head *fr
from-prev = skb_from;
from-next = skb_from;
from-qlen = 0;
-   spin_unlock_irqrestore(from-lock,flags);
+   spin_unlock_irqrestore(from-lock, flags);
 }
 
 
-
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 3/4][ATM]: [suni] change suni_init to __devinit

2006-06-28 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [suni] change suni_init to __devinit

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 4768199f3a5582378164820cc74251e485a01292
tree fd27293baebffd029ae53a6efe18913cfb68cada
parent 3d63ef0340a7f49a72f5eaa33f08b38fa78d48e1
author chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 19:56:00 -0400
committer chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 19:56:00 -0400

 drivers/atm/he.c   |2 +-
 drivers/atm/suni.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index fde9334..a486eb1 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -1018,7 +1018,7 @@ he_init_irq(struct he_dev *he_dev)
return 0;
 }
 
-static int __init
+static int __devinit
 he_start(struct atm_dev *dev)
 {
struct he_dev *he_dev;
diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
index b1d063c..f04f39c 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -289,7 +289,7 @@ static const struct atmphy_ops suni_ops 
 };
 
 
-int suni_init(struct atm_dev *dev)
+int __devinit suni_init(struct atm_dev *dev)
 {
unsigned char mri;
 
-
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 1/4][ATM]: [idt77105] should be __devinit not __init

2006-06-28 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: [idt77105] should be __devinit not __init

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 51403ade3cedfc85f1f41d81cb3a227f9ce2366f
tree f9cf0143466de92eda0080e27240d4b53c130c18
parent 982703b5b38b314081d79ebc657fc06b1b6fe6b6
author chas williams [EMAIL PROTECTED] Sun, 28 May 2006 22:14:23 -0400
committer chas williams [EMAIL PROTECTED] Sun, 28 May 2006 22:14:23 -0400

 drivers/atm/idt77105.c |2 +-
 drivers/atm/idt77105.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 0aabfc2..325325a 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -358,7 +358,7 @@ static const struct atmphy_ops idt77105_
 };
 
 
-int idt77105_init(struct atm_dev *dev)
+int __devinit idt77105_init(struct atm_dev *dev)
 {
dev-phy = idt77105_ops;
return 0;
diff --git a/drivers/atm/idt77105.h b/drivers/atm/idt77105.h
index 8ba8218..3fd2bc8 100644
--- a/drivers/atm/idt77105.h
+++ b/drivers/atm/idt77105.h
@@ -76,7 +76,7 @@ #define IDT77105_CTRSEL_RCC   0x02/* W, R
 #define IDT77105_CTRSEL_RHEC   0x01/* W, Rx HEC Error Counter */
 
 #ifdef __KERNEL__
-int idt77105_init(struct atm_dev *dev) __init;
+int idt77105_init(struct atm_dev *dev);
 #endif
 
 /*
-
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/4][ATM]: basic sysfs support for ATM devices

2006-06-28 Thread chas williams - CONTRACTOR
please consider for 2.6.18 -- thanks!

[ATM]: basic sysfs support for ATM devices

From: Roman Kagan [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 034e4008acda89bc2422541e077f2dbfd530b717
tree e528e0e6f2d69c729f2daf6618df22133b3e4818
parent 4768199f3a5582378164820cc74251e485a01292
author chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 20:24:44 -0400
committer chas williams [EMAIL PROTECTED] Mon, 26 Jun 2006 20:24:44 -0400

 include/linux/atmdev.h |4 +
 net/atm/Makefile   |2 -
 net/atm/atm_sysfs.c|  176 
 net/atm/common.c   |7 ++
 net/atm/common.h   |2 +
 net/atm/resources.c|   22 +-
 net/atm/resources.h|2 +
 7 files changed, 209 insertions(+), 6 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 1eb238a..41788a3 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -7,6 +7,7 @@ #ifndef LINUX_ATMDEV_H
 #define LINUX_ATMDEV_H
 
 
+#include linux/device.h
 #include linux/atmapi.h
 #include linux/atm.h
 #include linux/atmioc.h
@@ -358,6 +359,7 @@ #ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name;/* proc entry name */
 #endif
+   struct class_device class_dev;  /* sysfs class device */
struct list_head dev_list;  /* linkage */
 };
 
@@ -459,7 +461,7 @@ static inline void atm_dev_put(struct at
BUG_ON(!test_bit(ATM_DF_REMOVED, dev-flags));
if (dev-ops-dev_close)
dev-ops-dev_close(dev);
-   kfree(dev);
+   class_device_put(dev-class_dev);
}
 }
 
diff --git a/net/atm/Makefile b/net/atm/Makefile
index d581875..89656d6 100644
--- a/net/atm/Makefile
+++ b/net/atm/Makefile
@@ -2,7 +2,7 @@ #
 # Makefile for the ATM Protocol Families.
 #
 
-atm-y  := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o 
raw.o resources.o
+atm-y  := addr.o pvc.o signaling.o svc.o ioctl.o common.o atm_misc.o 
raw.o resources.o atm_sysfs.o
 mpoa-objs  := mpc.o mpoa_caches.o mpoa_proc.o
 
 obj-$(CONFIG_ATM) += atm.o
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c
new file mode 100644
index 000..5df4b9a
--- /dev/null
+++ b/net/atm/atm_sysfs.c
@@ -0,0 +1,176 @@
+/* ATM driver model support. */
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/kobject.h
+#include linux/atmdev.h
+#include common.h
+#include resources.h
+
+#define to_atm_dev(cldev) container_of(cldev, struct atm_dev, class_dev)
+
+static ssize_t show_type(struct class_device *cdev, char *buf)
+{
+   struct atm_dev *adev = to_atm_dev(cdev);
+   return sprintf(buf, %s\n, adev-type);
+}
+
+static ssize_t show_address(struct class_device *cdev, char *buf)
+{
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+   int i;
+
+   for (i = 0; i  (ESI_LEN - 1); i++)
+   pos += sprintf(pos, %02x:, adev-esi[i]);
+   pos += sprintf(pos, %02x\n, adev-esi[i]);
+
+   return pos - buf;
+}
+
+static ssize_t show_atmaddress(struct class_device *cdev, char *buf)
+{
+unsigned long flags;
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+struct atm_dev_addr *aaddr;
+   int bin[] = { 1, 2, 10, 6, 1 }, *fmt = bin;
+   int i, j;
+
+spin_lock_irqsave(adev-lock, flags);
+list_for_each_entry(aaddr, adev-local, entry) {
+   for(i = 0, j = 0; i  ATM_ESA_LEN; ++i, ++j) {
+   if (j == *fmt) {
+   pos += sprintf(pos, .);
+   ++fmt;
+   j = 0;
+   }
+   pos += sprintf(pos, %02x, 
aaddr-addr.sas_addr.prv[i]);
+   }
+   pos += sprintf(pos, \n);
+   }
+spin_unlock_irqrestore(adev-lock, flags);
+
+   return pos - buf;
+}
+
+static ssize_t show_carrier(struct class_device *cdev, char *buf)
+{
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+
+   pos += sprintf(pos, %d\n,
+  adev-signal == ATM_PHY_SIG_LOST ? 0 : 1);
+   
+   return pos - buf;
+}
+
+static ssize_t show_link_rate(struct class_device *cdev, char *buf)
+{
+   char *pos = buf;
+   struct atm_dev *adev = to_atm_dev(cdev);
+   int link_rate;
+
+   /* show the link rate, not the data rate */
+   switch (adev-link_rate) {
+   case ATM_OC3_PCR:
+   link_rate = 15552;
+   break;
+   case ATM_OC12_PCR:
+   link_rate = 62208;
+   break;
+   case ATM_25_PCR:
+   link_rate = 2560;
+   break;
+   default:
+   link_rate = adev-link_rate * 8 * 53

[PATCH 1/2][ATM]: convert atm_dev_mutex from semaphore to mutex

2006-03-02 Thread chas williams - CONTRACTOR
please consider for 2.6.17 -- thanks!

[ATM]: convert atm_dev_mutex from semaphore to mutex

Signed-off-by: Ingo Molnar [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 072ab3c1dc3a841129d7b9affee95ced61d5f3d8
tree 3c10b2cece06d39cbd83ae318b3d64a142053295
parent 02ffc5995920ec858bd6cde41dff81237ca1a28f
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:21:49 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:21:49 
-0500

 net/atm/common.c|4 ++--
 net/atm/resources.c |   32 +---
 net/atm/resources.h |3 ++-
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -451,12 +451,12 @@ int vcc_connect(struct socket *sock, int
dev = try_then_request_module(atm_dev_lookup(itf), 
atm-device-%d, itf);
} else {
dev = NULL;
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
if (!list_empty(atm_devs)) {
dev = list_entry(atm_devs.next, struct atm_dev, 
dev_list);
atm_dev_hold(dev);
}
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
}
if (!dev)
return -ENODEV;
diff --git a/net/atm/resources.c b/net/atm/resources.c
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -18,6 +18,8 @@
 #include linux/bitops.h
 #include linux/capability.h
 #include linux/delay.h
+#include linux/mutex.h
+
 #include net/sock.h   /* for struct sock */
 
 #include common.h
@@ -26,7 +28,7 @@
 
 
 LIST_HEAD(atm_devs);
-DECLARE_MUTEX(atm_dev_mutex);
+DEFINE_MUTEX(atm_dev_mutex);
 
 static struct atm_dev *__alloc_atm_dev(const char *type)
 {
@@ -65,9 +67,9 @@ struct atm_dev *atm_dev_lookup(int numbe
 {
struct atm_dev *dev;
 
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
dev = __atm_dev_lookup(number);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
return dev;
 }
 
@@ -83,11 +85,11 @@ struct atm_dev *atm_dev_register(const c
type);
return NULL;
}
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
if (number != -1) {
if ((inuse = __atm_dev_lookup(number))) {
atm_dev_put(inuse);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
kfree(dev);
return NULL;
}
@@ -112,12 +114,12 @@ struct atm_dev *atm_dev_register(const c
printk(KERN_ERR atm_dev_register: 
   atm_proc_dev_register failed for dev %s\n,
   type);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
kfree(dev);
return NULL;
}
list_add_tail(dev-dev_list, atm_devs);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
 
return dev;
 }
@@ -133,9 +135,9 @@ void atm_dev_deregister(struct atm_dev *
 * with same number can appear, such we need deregister proc, 
 * release async all vccs and remove them from vccs list too
 */
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
list_del(dev-dev_list);
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
 
atm_dev_release_vccs(dev);
atm_proc_dev_deregister(dev);
@@ -196,16 +198,16 @@ int atm_dev_ioctl(unsigned int cmd, void
return -EFAULT;
if (get_user(len, iobuf-length))
return -EFAULT;
-   down(atm_dev_mutex);
+   mutex_lock(atm_dev_mutex);
list_for_each(p, atm_devs)
size += sizeof(int);
if (size  len) {
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
return -E2BIG;
}
tmp_buf = kmalloc(size, GFP_ATOMIC);
if (!tmp_buf) {
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
return -ENOMEM;
}
tmp_p = tmp_buf;
@@ -213,7 +215,7 @@ int atm_dev_ioctl(unsigned int cmd, void
dev = list_entry(p, struct atm_dev, dev_list);
*tmp_p++ = dev-number;
}
-   up(atm_dev_mutex);
+   mutex_unlock(atm_dev_mutex);
error = ((copy_to_user(buf, tmp_buf, size)) ||
put_user(size, iobuf-length

[PATCH 2/2][ATM]: [fore200e] fix section mismatch warnings

2006-03-02 Thread chas williams - CONTRACTOR
please apply to 2.6.16 tree -- thanks!

[ATM]: [fore200e] fix section mismatch warnings

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit bb03a1d97c7f1fff1cb7330c13e9cf5ded8aaa3e
tree 46f8397d1da9edee9cd6c95ba726afa677493d74
parent de5fd01e049c1ffe9ef5e4a1ecd23c837305b52f
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 10:46:13 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 10:46:13 
-0500

 drivers/atm/fore200e.c |   36 ++--
 1 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -555,7 +555,7 @@ fore200e_pca_reset(struct fore200e* fore
 }
 
 
-static int __init
+static int __devinit
 fore200e_pca_map(struct fore200e* fore200e)
 {
 DPRINTK(2, device %s being mapped in memory\n, fore200e-name);
@@ -589,7 +589,7 @@ fore200e_pca_unmap(struct fore200e* fore
 }
 
 
-static int __init
+static int __devinit
 fore200e_pca_configure(struct fore200e* fore200e)
 {
 struct pci_dev* pci_dev = (struct pci_dev*)fore200e-bus_dev;
@@ -2125,7 +2125,7 @@ fore200e_change_qos(struct atm_vcc* vcc,
 }
 
 
-static int __init
+static int __devinit
 fore200e_irq_request(struct fore200e* fore200e)
 {
 if (request_irq(fore200e-irq, fore200e_interrupt, SA_SHIRQ, 
fore200e-name, fore200e-atm_dev)  0) {
@@ -2148,7 +2148,7 @@ fore200e_irq_request(struct fore200e* fo
 }
 
 
-static int __init
+static int __devinit
 fore200e_get_esi(struct fore200e* fore200e)
 {
 struct prom_data* prom = fore200e_kmalloc(sizeof(struct prom_data), 
GFP_KERNEL | GFP_DMA);
@@ -2180,7 +2180,7 @@ fore200e_get_esi(struct fore200e* fore20
 }
 
 
-static int __init
+static int __devinit
 fore200e_alloc_rx_buf(struct fore200e* fore200e)
 {
 int scheme, magn, nbr, size, i;
@@ -2245,7 +2245,7 @@ fore200e_alloc_rx_buf(struct fore200e* f
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_bs_queue(struct fore200e* fore200e)
 {
 int scheme, magn, i;
@@ -2308,7 +2308,7 @@ fore200e_init_bs_queue(struct fore200e* 
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_rx_queue(struct fore200e* fore200e)
 {
 struct host_rxq* rxq =  fore200e-host_rxq;
@@ -2368,7 +2368,7 @@ fore200e_init_rx_queue(struct fore200e* 
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_tx_queue(struct fore200e* fore200e)
 {
 struct host_txq* txq =  fore200e-host_txq;
@@ -2431,7 +2431,7 @@ fore200e_init_tx_queue(struct fore200e* 
 }
 
 
-static int __init
+static int __devinit
 fore200e_init_cmd_queue(struct fore200e* fore200e)
 {
 struct host_cmdq* cmdq =  fore200e-host_cmdq;
@@ -2487,7 +2487,7 @@ fore200e_param_bs_queue(struct fore200e*
 }
 
 
-static int __init
+static int __devinit
 fore200e_initialize(struct fore200e* fore200e)
 {
 struct cp_queues __iomem * cpq;
@@ -2539,7 +2539,7 @@ fore200e_initialize(struct fore200e* for
 }
 
 
-static void __init
+static void __devinit
 fore200e_monitor_putc(struct fore200e* fore200e, char c)
 {
 struct cp_monitor __iomem * monitor = fore200e-cp_monitor;
@@ -2551,7 +2551,7 @@ fore200e_monitor_putc(struct fore200e* f
 }
 
 
-static int __init
+static int __devinit
 fore200e_monitor_getc(struct fore200e* fore200e)
 {
 struct cp_monitor __iomem * monitor = fore200e-cp_monitor;
@@ -2576,7 +2576,7 @@ fore200e_monitor_getc(struct fore200e* f
 }
 
 
-static void __init
+static void __devinit
 fore200e_monitor_puts(struct fore200e* fore200e, char* str)
 {
 while (*str) {
@@ -2591,7 +2591,7 @@ fore200e_monitor_puts(struct fore200e* f
 }
 
 
-static int __init
+static int __devinit
 fore200e_start_fw(struct fore200e* fore200e)
 {
 int   ok;
@@ -2622,7 +2622,7 @@ fore200e_start_fw(struct fore200e* fore2
 }
 
 
-static int __init
+static int __devinit
 fore200e_load_fw(struct fore200e* fore200e)
 {
 u32* fw_data = (u32*) fore200e-bus-fw_data;
@@ -2648,7 +2648,7 @@ fore200e_load_fw(struct fore200e* fore20
 }
 
 
-static int __init
+static int __devinit
 fore200e_register(struct fore200e* fore200e)
 {
 struct atm_dev* atm_dev;
@@ -2675,7 +2675,7 @@ fore200e_register(struct fore200e* fore2
 }
 
 
-static int __init
+static int __devinit
 fore200e_init(struct fore200e* fore200e)
 {
 if (fore200e_register(fore200e)  0)
@@ -2721,7 +2721,7 @@ fore200e_init(struct fore200e* fore200e)
return -EBUSY;
 
 fore200e_supply(fore200e);
-
+
 /* all done, board initialization is now complete */
 fore200e-state = FORE200E_STATE_COMPLETE;
 return 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 2/2][ATM]: [drivers] kzalloc() conversion in drivers/atm

2006-03-02 Thread chas williams - CONTRACTOR
please consider for 2.6.17 tree -- thanks!

[ATM]: [drivers] kzalloc() conversion in drivers/atm

Signed-off-by: Eric Sesterhenn [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit b8fc35b0d286fd1c7d0ef4f31508d05ead85a35e
tree 9f8dafc67c191c97df4e1f787709053cb4083495
parent 072ab3c1dc3a841129d7b9affee95ced61d5f3d8
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:45:27 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 12:45:27 
-0500

 drivers/atm/adummy.c |5 ++---
 drivers/atm/firestream.c |   10 +++---
 drivers/atm/he.c |3 +--
 drivers/atm/idt77252.c   |   18 ++
 drivers/atm/iphase.c |6 ++
 drivers/atm/zatm.c   |   12 ++--
 6 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
--- a/drivers/atm/adummy.c
+++ b/drivers/atm/adummy.c
@@ -114,14 +114,13 @@ static int __init adummy_init(void)
 
printk(KERN_ERR adummy: version %s\n, DRV_VERSION);
 
-   adummy_dev = (struct adummy_dev *) kmalloc(sizeof(struct adummy_dev),
+   adummy_dev = (struct adummy_dev *) kzalloc(sizeof(struct adummy_dev),
   GFP_KERNEL);
if (!adummy_dev) {
-   printk(KERN_ERR DEV_LABEL : kmalloc() failed\n);
+   printk(KERN_ERR DEV_LABEL : kzalloc() failed\n);
err = -ENOMEM;
goto out;
}
-   memset(adummy_dev, 0, sizeof(struct adummy_dev));
 
atm_dev = atm_dev_register(DEV_LABEL, adummy_ops, -1, NULL);
if (!atm_dev) {
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1782,7 +1782,7 @@ static int __devinit fs_init (struct fs_
write_fs (dev, RAM, (1  (28 - FS155_VPI_BITS - 
FS155_VCI_BITS)) - 1);
dev-nchannels = FS155_NR_CHANNELS;
}
-   dev-atm_vccs = kmalloc (dev-nchannels * sizeof (struct atm_vcc *), 
+   dev-atm_vccs = kcalloc(dev-nchannels, sizeof (struct atm_vcc *), 
 GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc atmvccs: %p(%Zd)\n,
dev-atm_vccs, dev-nchannels * sizeof (struct atm_vcc *));
@@ -1792,9 +1792,8 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-atm_vccs, 0, dev-nchannels * sizeof (struct atm_vcc *));
 
-   dev-tx_inuse = kmalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
+   dev-tx_inuse = kzalloc (dev-nchannels / 8 /* bits/byte */ , 
GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc tx_inuse: %p(%d)\n, 
dev-atm_vccs, dev-nchannels / 8);
 
@@ -1803,7 +1802,6 @@ static int __devinit fs_init (struct fs_
/* XXX Clean up. */
return 1;
}
-   memset (dev-tx_inuse, 0, dev-nchannels / 8);
 
/* -- RAS1 : FS155 and 50 differ. Default (0) should be OK for both */
/* -- RAS2 : FS50 only: Default is OK. */
@@ -1891,14 +1889,12 @@ static int __devinit firestream_init_one
if (pci_enable_device(pci_dev)) 
goto err_out;
 
-   fs_dev = kmalloc (sizeof (struct fs_dev), GFP_KERNEL);
+   fs_dev = kzalloc (sizeof (struct fs_dev), GFP_KERNEL);
fs_dprintk (FS_DEBUG_ALLOC, Alloc fs-dev: %p(%Zd)\n,
fs_dev, sizeof (struct fs_dev));
if (!fs_dev)
goto err_out;
 
-   memset (fs_dev, 0, sizeof (struct fs_dev));
-  
atm_dev = atm_dev_register(fs, ops, -1, NULL);
if (!atm_dev)
goto err_out_free_fs_dev;
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -384,13 +384,12 @@ he_init_one(struct pci_dev *pci_dev, con
}
pci_set_drvdata(pci_dev, atm_dev);
 
-   he_dev = (struct he_dev *) kmalloc(sizeof(struct he_dev),
+   he_dev = (struct he_dev *) kzalloc(sizeof(struct he_dev),
GFP_KERNEL);
if (!he_dev) {
err = -ENOMEM;
goto init_one_failure;
}
-   memset(he_dev, 0, sizeof(struct he_dev));
 
he_dev-pci_dev = pci_dev;
he_dev-atm_dev = atm_dev;
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -642,10 +642,9 @@ alloc_scq(struct idt77252_dev *card, int
 {
struct scq_info *scq;
 
-   scq = (struct scq_info *) kmalloc(sizeof(struct scq_info), GFP_KERNEL);
+   scq = (struct scq_info *) kzalloc(sizeof(struct scq_info), GFP_KERNEL);
if (!scq)
return NULL;
-   memset(scq, 0, sizeof(struct scq_info));
 
scq-base = pci_alloc_consistent(card-pcidev, SCQ_SIZE,
 scq-paddr);
@@ -2142,10 +2141,9

[PATCH 1/2][ATM]: keep atmsvc failure messages quiet

2006-03-02 Thread chas williams - CONTRACTOR
please apply to 2.6.16 tree -- thanks!

[ATM]: keep atmsvc failure messages quiet

Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 02ffc5995920ec858bd6cde41dff81237ca1a28f
tree 97f2f65c624bfa45e9e28f50fe024317c9cd1797
parent bb03a1d97c7f1fff1cb7330c13e9cf5ded8aaa3e
author chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 11:03:53 -0500
committer chas williams [EMAIL PROTECTED](none) Thu, 02 Mar 2006 11:03:53 
-0500

 net/atm/signaling.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/net/atm/signaling.c b/net/atm/signaling.c
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -39,25 +39,19 @@ static DECLARE_WAIT_QUEUE_HEAD(sigd_slee
 static void sigd_put_skb(struct sk_buff *skb)
 {
 #ifdef WAIT_FOR_DEMON
-   static unsigned long silence;
DECLARE_WAITQUEUE(wait,current);
 
add_wait_queue(sigd_sleep,wait);
while (!sigd) {
set_current_state(TASK_UNINTERRUPTIBLE);
-   if (time_after(jiffies, silence) || silence == 0) {
-   printk(KERN_INFO atmsvc: waiting for signaling demon 
-   ...\n);
-   silence = (jiffies+30*HZ)|1;
-   }
+   DPRINTK(atmsvc: waiting for signaling demon...\n);
schedule();
}
current-state = TASK_RUNNING;
remove_wait_queue(sigd_sleep,wait);
 #else
if (!sigd) {
-   if (net_ratelimit())
-   printk(KERN_WARNING atmsvc: no signaling demon\n);
+   DPRINTK(atmsvc: no signaling demon\n);
kfree_skb(skb);
return;
}
-
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 1/11][ATM]: always return the first interface for ATM_ITF_ANY

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: always return the first interface for ATM_ITF_ANY

From: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit d86bc37841a99650cb17debfaa1ed59f7a9a4431
tree f8b60fc436ac81bfaca70363f441aaf44aa123ba
parent 03153af17b6af2d0cd77d20431b847724c594c3e
author chas williams [EMAIL PROTECTED](none) Sat, 26 Nov 2005 15:44:02 -0500
committer chas williams [EMAIL PROTECTED](none) Sat, 26 Nov 2005 15:44:02 
-0500

 net/atm/common.c |   30 ++
 1 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -423,33 +423,23 @@ int vcc_connect(struct socket *sock, int
if (vcc-qos.txtp.traffic_class == ATM_ANYCLASS ||
vcc-qos.rxtp.traffic_class == ATM_ANYCLASS)
return -EINVAL;
-   if (itf != ATM_ITF_ANY) {
+   if (likely(itf != ATM_ITF_ANY)) {
dev = atm_dev_lookup(itf);
-   if (!dev)
-   return -ENODEV;
-   error = __vcc_connect(vcc, dev, vpi, vci);
-   if (error) {
-   atm_dev_put(dev);
-   return error;
-   }
} else {
-   struct list_head *p, *next;
-
dev = NULL;
spin_lock(atm_dev_lock);
-   list_for_each_safe(p, next, atm_devs) {
-   dev = list_entry(p, struct atm_dev, dev_list);
+   if (!list_empty(atm_devs)) {
+   dev = list_entry(atm_devs.next, struct atm_dev, 
dev_list);
atm_dev_hold(dev);
-   spin_unlock(atm_dev_lock);
-   if (!__vcc_connect(vcc, dev, vpi, vci))
-   break;
-   atm_dev_put(dev);
-   dev = NULL;
-   spin_lock(atm_dev_lock);
}
spin_unlock(atm_dev_lock);
-   if (!dev)
-   return -ENODEV;
+   }
+   if (!dev)
+   return -ENODEV;
+   error = __vcc_connect(vcc, dev, vpi, vci);
+   if (error) {
+   atm_dev_put(dev);
+   return error;
}
if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC)
set_bit(ATM_VF_PARTIAL,vcc-flags);
-
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 3/11][ATM]: [lanai] better constification

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: [lanai] better constification

Signed-off-by: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit f3dd8fc6b754e8f52a14e538e9d149ffd11020e6
tree ccbd02ec6064ff8caff9291fbb512f0ab0b72e11
parent b98f2b10207afc5fe6be9c382d0a187e65f46756
author chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:26:40 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:26:40 
-0500

 drivers/atm/lanai.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -305,7 +305,7 @@ struct lanai_dev {
  * vci with their bit set
  */
 static void vci_bitfield_iterate(struct lanai_dev *lanai,
-   /*const*/ unsigned long *lp,
+   const unsigned long *lp,
void (*func)(struct lanai_dev *,vci_t vci))
 {
vci_t vci = find_first_bit(lp, NUM_VCI);
@@ -951,7 +951,7 @@ static int __devinit eeprom_read(struct 
 /* read a big-endian 4-byte value out of eeprom */
 static inline u32 eeprom_be4(const struct lanai_dev *lanai, int address)
 {
-   return be32_to_cpup((u32 *) (lanai-eeprom[address]));
+   return be32_to_cpup((const u32 *) lanai-eeprom[address]);
 }
 
 /* Checksum/validate EEPROM contents */
@@ -1160,7 +1160,7 @@ static inline int vcc_tx_space(const str
 }
 
 /* test if VCC is currently backlogged */
-static inline int vcc_is_backlogged(/*const*/ struct lanai_vcc *lvcc)
+static inline int vcc_is_backlogged(const struct lanai_vcc *lvcc)
 {
return !skb_queue_empty(lvcc-tx.backlog);
 }
@@ -1395,7 +1395,8 @@ static void vcc_rx_aal5(struct lanai_vcc
 {
int size;
struct sk_buff *skb;
-   /*const*/ u32 *x, *end = lvcc-rx.buf.start[endptr * 4];
+   const u32 *x;
+   u32 *end = lvcc-rx.buf.start[endptr * 4];
int n = ((unsigned long) end) - ((unsigned long) lvcc-rx.buf.ptr);
if (n  0)
n += lanai_buf_size(lvcc-rx.buf);
@@ -2111,7 +2112,7 @@ static int lanai_normalize_ci(struct lan
  * shifted by that much as we compute
  *
  */
-static int pcr_to_cbricg(/*const*/ struct atm_qos *qos)
+static int pcr_to_cbricg(const struct atm_qos *qos)
 {
int rounddown = 0;  /* 1 = Round PCR down, i.e. round ICG _up_ */
int x, icg, pcr = atm_pcr_goal(qos-txtp);
-
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/11][ATM]: atm_pcr_goal() doesn't modify its argument's contents -- mark it as const

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: atm_pcr_goal() doesn't modify its argument's contents -- mark it as const

Signed-off-by: Mitchell Blank Jr [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit b98f2b10207afc5fe6be9c382d0a187e65f46756
tree db44e643a4b65fa0e6b0c75553281768c1c7e381
parent 91e7c544b889ffeb066a8880b6b7b5e451ca23a9
author chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:22:06 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:22:06 
-0500

 include/linux/atmdev.h |2 +-
 net/atm/atm_misc.c |   11 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -468,7 +468,7 @@ static inline void atm_dev_put(struct at
 int atm_charge(struct atm_vcc *vcc,int truesize);
 struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
 gfp_t gfp_flags);
-int atm_pcr_goal(struct atm_trafprm *tp);
+int atm_pcr_goal(const struct atm_trafprm *tp);
 
 void vcc_release_async(struct atm_vcc *vcc, int reply);
 
diff --git a/net/atm/atm_misc.c b/net/atm/atm_misc.c
--- a/net/atm/atm_misc.c
+++ b/net/atm/atm_misc.c
@@ -74,11 +74,14 @@ struct sk_buff *atm_alloc_charge(struct 
  */
 
 
-int atm_pcr_goal(struct atm_trafprm *tp)
+int atm_pcr_goal(const struct atm_trafprm *tp)
 {
-   if (tp-pcr  tp-pcr != ATM_MAX_PCR) return -tp-pcr;
-   if (tp-min_pcr  !tp-pcr) return tp-min_pcr;
-   if (tp-max_pcr != ATM_MAX_PCR) return -tp-max_pcr;
+   if (tp-pcr  tp-pcr != ATM_MAX_PCR)
+   return -tp-pcr;
+   if (tp-min_pcr  !tp-pcr)
+   return tp-min_pcr;
+   if (tp-max_pcr != ATM_MAX_PCR)
+   return -tp-max_pcr;
return 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 4/11][ATM]: [lanai] lanai missing unregister

2005-11-29 Thread chas williams - CONTRACTOR
please apply to 2.6 -- thanks!

[ATM]: [lanai] lanai missing unregister

Signed-off-by: Dave Jones [EMAIL PROTECTED]
Signed-off-by: Chas Williams [EMAIL PROTECTED]

---
commit 3d4d9c94921f1239ec36edc47aa830d567c9a17d
tree 98649d1ac17a5dcf8943f0c47c1ed509de047b5d
parent f3dd8fc6b754e8f52a14e538e9d149ffd11020e6
author chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:50:31 -0500
committer chas williams [EMAIL PROTECTED](none) Mon, 21 Nov 2005 12:50:31 
-0500

 drivers/atm/lanai.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -2761,6 +2761,7 @@ static void __exit lanai_module_exit(voi
 * gone, so there isn't much to do
 */
DPRINTK(cleanup_module()\n);
+   pci_unregister_driver(lanai_driver);
 }
 
 module_init(lanai_module_init);
-
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   >