* Re: [PATCH 1/5] net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag
From: Wolfram Sang @ 2010-05-22 13:06 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linux-arm-kernel@lists.infradead.org, netdev, Nicolas Pitre
In-Reply-To: <1274525683.1931.139.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 708 bytes --]
On Sat, May 22, 2010 at 08:54:43PM +1000, Benjamin Herrenschmidt wrote:
> This moves the various known Marvell PHY IDs to include/linux/marvell_phy.h
> along with dev_flags definitions for use by the driver.
I think this one from the driver should go there, too:
#define M1145_DEV_FLAGS_RESISTANCE 0x00000001
(which makes me wonder how this flag was set as it was not exported before)
and thus yours could be maybe like
#define M1118_DEV_FLAGS_ALT_LED_INIT 0x00000001
(or 1 << 0)
?
Otherwise looks good enough to me.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: QoS weirdness : HTB accuracy
From: Julien Vehent @ 2010-05-22 14:29 UTC (permalink / raw)
To: Philip A. Prindeville; +Cc: Netdev, netfilter
In-Reply-To: <4BF32BB0.7010700@redfish-solutions.com>
On Tue, 18 May 2010 18:07:12 -0600, "Philip A. Prindeville"
<philipp_subx@redfish-solutions.com> wrote:
>
> Sorry for the late response: could this be an "aliasing" issue caused
> by sampling intervals (granularity)?
>
> -Philip
I was, in fact, an error in my ruleset. I had put the 'linklayer atm' at
both the branch and leaf levels, so the overhead was computed twice,
creating those holes in the bandwidth.
Julien
^ permalink raw reply
* [regression] fib6_del() bug from 2.6.34-rc1 still present in 2.6.34
From: Julien BLACHE @ 2010-05-22 15:55 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
Hi,
[subscribed to lkml but not netdev, Cc me on replies]
I'm seeing a warning in fib6_del() that is very close to what was
reported by Emil S Tantilov back in march/april for 2.6.34-rc1:
<http://kerneltrap.org/mailarchive/linux-netdev/2010/4/9/6274401/thread>
It looks like there hasn't been a fix, other than what was mentioned in
this thread for net-next and Emil reported that it did not fix it for
him. So it looks like it's still there, alive and kicking.
This is the warning I'm getting:
------------[ cut here ]------------
WARNING: at net/ipv6/ip6_fib.c:1160 fib6_del+0x506/0x5b0()
Hardware name: MacBookPro2,2
Modules linked in: sco bnep rfcomm l2cap crc16 cpufreq_userspace cpufreq_powersave cpufreq_conservative nfsd nfs lockd auth_rpcgss sunrpc uinput btusb ath9k ath9k_common mac80211 ath9k_hw ath isight_firmware joydev cfg80211 i2c_i801 ohci1394 ieee1394 [last unloaded: scsi_wait_scan]
Pid: 4020, comm: ifconfig Not tainted 2.6.34 #1
Call Trace:
[<ffffffff810389d3>] ? warn_slowpath_common+0x73/0xb0
[<ffffffff8142f956>] ? fib6_del+0x506/0x5b0
[<ffffffff8102ceb3>] ? __wake_up+0x43/0x70
[<ffffffff813c68ef>] ? netlink_broadcast+0x21f/0x410
[<ffffffff8142c2ab>] ? __ip6_del_rt+0x4b/0x80
[<ffffffff8142c436>] ? ip6_del_rt+0x26/0x30
[<ffffffff81426dff>] ? __ipv6_ifa_notify+0x15f/0x200
[<ffffffff81428d99>] ? addrconf_ifdown+0x159/0x350
[<ffffffff8142915d>] ? addrconf_notify+0xed/0x920
[<ffffffff81043d33>] ? lock_timer_base+0x33/0x70
[<ffffffff810445ab>] ? mod_timer+0x11b/0x1a0
[<ffffffff81054826>] ? notifier_call_chain+0x46/0x70
[<ffffffff813b1ae5>] ? __dev_notify_flags+0x65/0x90
[<ffffffff813b1b4b>] ? dev_change_flags+0x3b/0x70
[<ffffffff813fd2a2>] ? devinet_ioctl+0x602/0x750
[<ffffffff813a12ea>] ? T.945+0x1a/0x50
[<ffffffff813a1589>] ? sock_ioctl+0x59/0x2a0
[<ffffffff810bee55>] ? vfs_ioctl+0x35/0xd0
[<ffffffff810bf018>] ? do_vfs_ioctl+0x88/0x570
[<ffffffff810bf549>] ? sys_ioctl+0x49/0x80
[<ffffffff810023eb>] ? system_call_fastpath+0x16/0x1b
---[ end trace b5a833c8e5539431 ]---
I can reliably reproduce it on both ath9k and sky2 with the
following sequence:
# ifconfig eth0 up
# ifconfig eth0 add 2001:7a8:5dd7:123::12/64
# ifconfig eth0 down
# ifconfig eth0 up
# ifconfig eth0 add 2001:7a8:5dd7:123::12/64 <=== fails
# ifconfig eth0 down <=== triggers the warning
Note that this sequence is equivalent to:
# ifup eth0
# ifdown eth0
# ifup eth0 (will fail because it cannot add the v6 address)
# ifconfig eth0 down
This regression breaks ifupdown as it always tries to add the v6 address
when configuring the interface. It's a behaviour change compared to
previous kernel versions.
It looks like triggering this warning a couple times (3-4) in a row ends
up locking up the machine, too.
I can test patches etc.
JB.
--
Julien BLACHE <http://www.jblache.org>
<jb@jblache.org> GPG KeyID 0xF5D65169
^ permalink raw reply
* null dereference in ethoc_probe()
From: Dan Carpenter @ 2010-05-22 15:55 UTC (permalink / raw)
To: thomas; +Cc: netdev
The patch 0baa080c75c: "ethoc: use system memory as buffer" introduced a
potential null dereference.
1060 free:
1061 if (priv->dma_alloc)
^^^^^^^^^^^^^^^
priv can be null here.
1062 dma_free_coherent(NULL, priv->dma_alloc, priv->membase,
1063 netdev->mem_start);
1064 free_netdev(netdev);
Also I think the error handling is not as complete as it should be. It
seems like we should call devm_iounmap() and release some of the other
resources as well.
regards,
dan carpenter
^ permalink raw reply
* [PATCH 01/12] caif: remove unused #include <linux/version.h>
From: Huang Weiyi @ 2010-05-22 17:11 UTC (permalink / raw)
To: davem; +Cc: netdev, Huang Weiyi
Remove unused #include <linux/version.h>('s) in
drivers/net/caif/caif_serial.c
Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
---
drivers/net/caif/caif_serial.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 09257ca..b259650 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -5,7 +5,6 @@
*/
#include <linux/init.h>
-#include <linux/version.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/types.h>
--
1.6.1.3
^ permalink raw reply related
* [PATCH 03/12] caif: remove unused #include <linux/version.h>
From: Huang Weiyi @ 2010-05-22 17:11 UTC (permalink / raw)
To: davem; +Cc: netdev, Huang Weiyi
Remove unused #include <linux/version.h>('s) in
net/caif/caif_dev.c
net/caif/chnl_net.c
Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
---
net/caif/caif_dev.c | 1 -
net/caif/chnl_net.c | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index e2b86f1..a5f1559 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -9,7 +9,6 @@
* and Sakari Ailus <sakari.ailus@nokia.com>
*/
-#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/if_arp.h>
diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
index 610966a..49c4a7b 100644
--- a/net/caif/chnl_net.c
+++ b/net/caif/chnl_net.c
@@ -5,7 +5,6 @@
* License terms: GNU General Public License (GPL) version 2
*/
-#include <linux/version.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/module.h>
--
1.6.1.3
^ permalink raw reply related
* [PATCH 12/12] caif: remove duplicated #include
From: Huang Weiyi @ 2010-05-22 17:13 UTC (permalink / raw)
To: davem; +Cc: netdev, Huang Weiyi
Remove duplicated #include('s) in
net/caif/caif_socket.c
Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
---
net/caif/caif_socket.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index c3a70c5..a9681c3 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -15,7 +15,6 @@
#include <linux/poll.h>
#include <linux/tcp.h>
#include <linux/uaccess.h>
-#include <linux/mutex.h>
#include <linux/debugfs.h>
#include <linux/caif/caif_socket.h>
#include <asm/atomic.h>
--
1.6.1.3
^ permalink raw reply related
* Re: VLANs, bonding redux: vlan state does not follow ethernet
From: George B. @ 2010-05-22 17:47 UTC (permalink / raw)
To: netdev
In-Reply-To: <AANLkTim9nKSOdTW9YcrfNNJCmZoJ6t40mY_9f60GrWuG@mail.gmail.com>
On Fri, May 21, 2010 at 11:45 PM, George B. <georgeb@gmail.com> wrote:
> On Fri, May 21, 2010 at 11:24 PM, George B. <georgeb@gmail.com> wrote:
>> Using 2.6.34 I am trying to remove bottlenecks. Instead of bonding
>> two ethernet interfaces and applying vlans to the bond, I am applying
>> the vlans to the ethernet and bonding the vlans creating a separate
>> bond interface for each vlan.
>>
>> The trouble now is that the bond interface does not see when the
>> ethernet interface goes down. The vlan reports to the bonding driver
>> that it is up when the ethernet it is connected to is down. This
>> results in packet loss through the bond interface as the bond driver
>> attempts to use that vlan.
>>
>> eth1 shows having no link:
>>
>> root@sandbox:/proc/net# ethtool eth1
>> Settings for eth1:
>> Supported ports: [ TP ]
>> Supported link modes: 10baseT/Half 10baseT/Full
>> 100baseT/Half 100baseT/Full
>> 1000baseT/Full
>> Supports auto-negotiation: Yes
>> Advertised link modes: 10baseT/Half 10baseT/Full
>> 100baseT/Half 100baseT/Full
>> 1000baseT/Full
>> Advertised pause frame use: No
>> Advertised auto-negotiation: Yes
>> Link partner advertised link modes: Not reported
>> Link partner advertised pause frame use: No
>> Link partner advertised auto-negotiation: No
>> Speed: Unknown!
>> Duplex: Unknown! (255)
>> Port: Twisted Pair
>> PHYAD: 1
>> Transceiver: internal
>> Auto-negotiation: on
>> MDI-X: Unknown
>> Supports Wake-on: pumbag
>> Wake-on: g
>> Current message level: 0x00000001 (1)
>> Link detected: no
>>
>> bonding driver says eth1.99 reports MII status up:
>>
>> root@sandbox:/proc/net# cat bonding/bond0
>> Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
>>
>> Bonding Mode: load balancing (round-robin)
>> MII Status: up
>> MII Polling Interval (ms): 0
>> Up Delay (ms): 0
>> Down Delay (ms): 0
>>
>> Slave Interface: eth0.99
>> MII Status: up
>> Link Failure Count: 0
>> Permanent HW addr: 00:26:9e:1c:d3:3e
>>
>> Slave Interface: eth1.99
>> MII Status: up
>> Link Failure Count: 0
>> Permanent HW addr: 00:26:9e:1c:d3:3f
>>
>> is there some parameter I can give that tells the vlan driver to
>> follow the state of the interface it is attached to? Having a vlan
>> that reports being up all the time even when its underlying interface
>> is down is less than useful. It would seem intuitive that a vlan's
>> state would follow that of the interface it is attached to.
>>
>> root@sandbox:/proc/net# cat vlan/eth0.99
>> eth0.99 VID: 99 REORDER_HDR: 1 dev->priv_flags: 21
>> total frames received 32
>> total bytes received 4735
>> Broadcast/Multicast Rcvd 0
>>
>> total frames transmitted 50
>> total bytes transmitted 3852
>> total headroom inc 0
>> total encap on xmit 0
>> Device: eth0
>> INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
>> EGRESS priority mappings:
>> root@sandbox:/proc/net# cat vlan/eth1.99
>> eth1.99 VID: 99 REORDER_HDR: 1 dev->priv_flags: 21
>> total frames received 0
>> total bytes received 0
>> Broadcast/Multicast Rcvd 0
>>
>> total frames transmitted 0
>> total bytes transmitted 0
>> total headroom inc 0
>> total encap on xmit 0
>> Device: eth1
>> INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
>> EGRESS priority mappings:
>>
>> root@sandbox:/proc/net# ping 10.1.99.1
>> PING 10.1.99.1 (10.1.99.1) 56(84) bytes of data.
>> 64 bytes from 10.1.99.1: icmp_seq=2 ttl=255 time=0.299 ms
>> 64 bytes from 10.1.99.1: icmp_seq=4 ttl=255 time=0.311 ms
>> 64 bytes from 10.1.99.1: icmp_seq=6 ttl=255 time=0.325 ms
>> 64 bytes from 10.1.99.1: icmp_seq=8 ttl=255 time=0.291 ms
>> 64 bytes from 10.1.99.1: icmp_seq=10 ttl=255 time=0.308 ms
>>
>> George
>>
>
> But interestingly, mii-tool reports the correct result:
>
> root@sandbox:/usr/src/linux-source-2.6.34/Documentation/networking#
> mii-tool -v eth1.99
>
> eth1.99: no link
> product info: vendor 00:50:43, model 10 rev 0
> basic mode: autonegotiation enabled
> basic status: no link
> capabilities: 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
> advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
>
I can't use arp monitor because when I do that it just flips back and
forth each second between slaves each monitor period:
May 22 10:45:28 sandbox kernel: [69276.450013] bonding: bond0: making
interface eth0.99 the new active one.
May 22 10:45:29 sandbox kernel: [69277.450010] bonding: bond0: link
status definitely up for interface eth1.99.
May 22 10:45:30 sandbox kernel: [69278.450009] bonding: bond0: link
status definitely down for interface eth0.99, disabl
ing it
May 22 10:45:30 sandbox kernel: [69278.450012] bonding: bond0: making
interface eth1.99 the new active one.
May 22 10:45:31 sandbox kernel: [69279.450009] bonding: bond0: link
status definitely up for interface eth0.99.
May 22 10:45:32 sandbox kernel: [69280.450009] bonding: bond0: link
status definitely down for interface eth1.99, disabl
ing it
May 22 10:45:32 sandbox kernel: [69280.450012] bonding: bond0: making
interface eth0.99 the new active one.
May 22 10:45:33 sandbox kernel: [69281.450012] bonding: bond0: link
status definitely up for interface eth1.99.
May 22 10:45:34 sandbox kernel: [69282.450009] bonding: bond0: link
status definitely down for interface eth0.99, disabl
ing it
May 22 10:45:34 sandbox kernel: [69282.450012] bonding: bond0: making
interface eth1.99 the new active one.
May 22 10:45:35 sandbox kernel: [69283.450012] bonding: bond0: link
status definitely up for interface eth0.99.
May 22 10:45:36 sandbox kernel: [69284.450009] bonding: bond0: link
status definitely down for interface eth1.99, disabl
ing it
May 22 10:45:36 sandbox kernel: [69284.450012] bonding: bond0: making
interface eth0.99 the new active one.
May 22 10:45:37 sandbox kernel: [69285.450012] bonding: bond0: link
status definitely up for interface eth1.99.
May 22 10:45:38 sandbox kernel: [69286.450008] bonding: bond0: link
status definitely down for interface eth0.99, disabl
ing it
May 22 10:45:38 sandbox kernel: [69286.450011] bonding: bond0: making
interface eth1.99 the new active one.
May 22 10:45:39 sandbox kernel: [69287.450010] bonding: bond0: link
status definitely up for interface eth0.99.
May 22 10:45:40 sandbox kernel: [69288.450008] bonding: bond0: link
status definitely down for interface eth1.99, disabl
ing it
This is with both physical links up. The arp monitor just causes the
links to constantly fail back and forth each arp_monitor interval.
^ permalink raw reply
* RE: ixgbe: macvlan on PF/VF when SRIOV is enabled
From: Rose, Gregory V @ 2010-05-22 17:53 UTC (permalink / raw)
To: Shirley Ma, Kirsher, Jeffrey T
Cc: davem@davemloft.net, kvm@vger.kernel.org, netdev@vger.kernel.org,
e1000-devel@lists.sourceforge.net
In-Reply-To: <1274473846.8701.25.camel@localhost.localdomain>
>-----Original Message-----
>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>On Behalf Of Shirley Ma
>Sent: Friday, May 21, 2010 1:31 PM
>To: Kirsher, Jeffrey T
>Cc: davem@davemloft.net; kvm@vger.kernel.org; netdev@vger.kernel.org;
>e1000-devel@lists.sourceforge.net
>Subject: ixgbe: macvlan on PF/VF when SRIOV is enabled
>
>Hello Jeff,
>
>macvlan doesn't work on PF when SRIOV is enabled. Creating macvlan has
>been successful, but ping (icmp request) goes to VF interface not
>PF/macvlan even arp entry is correct. I patched ixgbe driver, and
>macvlan/PF has worked with the patch. But I am not sure whether it is
>right since I don't have the HW spec. What I did for ixgbe driver was:
>
>1. PF's rar index is 0, VMDQ index is adatper->num_vfs;
>2. VF's rar is based on rar_used_count and mc_addr_in_rar_count, VMDQ
>index is ;
>3. PF's secondary addresses is PF's rar index + i, VMDQ index is
>adapter->num_vfs.
As of 2.6.34 the ixgbe driver does not support multiple queues for macvlan.
Support for multiple queues for macvlan will come in a subsequent release.
>
>
>Before I submit the patch, I want to understand the right index
>assignment for both rar index and VMDQ index, when SRIOV enabled:
>1. VMDQ index for PF is adapter->num_vfs, or 0? rar index is 0?
>2. PF's secondary address rar index is based on
>rar_used_count/mc_addr_in_rar_count?
>2. VF's VPDQ index is based on vf number?
>3. VF's rar index is vf + 1, or should be based on rar_used_count?
>
>I am also working on macvlan on VF. The question here is whether macvlan
>on VF should work or not? Looks like ixgbevf secondary addresses are not
>in receiver address filter, so macvlan on VF doesn't work.
The VF driver does not support macvlan. Future releases may but there
are no immediate plans to support it.
- Greg Rose
Intel Corp.
Lan Access Division
^ permalink raw reply
* [patch] ipmr: off by one in __ipmr_fill_mroute()
From: Dan Carpenter @ 2010-05-22 17:54 UTC (permalink / raw)
To: netdev
Cc: Alexey Kuznetsov, Pekka Savola (ipv6), James Morris,
Hideaki YOSHIFUJI, Patrick McHardy, Eric Dumazet,
kernel-janitors@vger.kernel.org David S. Miller
This fixes a smatch warning:
net/ipv4/ipmr.c +1917 __ipmr_fill_mroute(12) error: buffer overflow
'(mrt)->vif_table' 32 <= 32
The ipv6 version had the same issue.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 4588910..856123f 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1911,7 +1911,7 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
struct rtattr *mp_head;
/* If cache is unresolved, don't try to parse IIF and OIF */
- if (c->mfc_parent > MAXVIFS)
+ if (c->mfc_parent >= MAXVIFS)
return -ENOENT;
if (VIF_EXISTS(mrt, c->mfc_parent))
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index bd9e7d3..073071f 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -2017,7 +2017,7 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,
struct rtattr *mp_head;
/* If cache is unresolved, don't try to parse IIF and OIF */
- if (c->mf6c_parent > MAXMIFS)
+ if (c->mf6c_parent >= MAXMIFS)
return -ENOENT;
if (MIF_EXISTS(mrt, c->mf6c_parent))
^ permalink raw reply related
* [patch] e1000e: change logical negate to bitwise
From: Dan Carpenter @ 2010-05-22 19:45 UTC (permalink / raw)
To: Jeff Kirsher
Cc: Jesse Brandeburg, Bruce Allan, Alex Duyck, PJ Waskiewicz,
John Ronciak, David S. Miller, e1000-devel, netdev,
kernel-janitors
The bitwise negate is intended here. With the logical negate the
condition is always false.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 24507f3..57a7e41 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2554,7 +2554,7 @@ static void e1000_init_manageability_pt(struct e1000_adapter *adapter)
mdef = er32(MDEF(i));
/* Ignore filters with anything other than IPMI ports */
- if (mdef & !(E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664))
+ if (mdef & ~(E1000_MDEF_PORT_623 | E1000_MDEF_PORT_664))
continue;
/* Enable this decision filter in MANC2H */
^ permalink raw reply related
* Re: VLANs, bonding redux: vlan state does not follow ethernet
From: George B. @ 2010-05-22 20:01 UTC (permalink / raw)
To: netdev
In-Reply-To: <AANLkTimar_hs5zpvbB6iGUg3b9UqgUASqlhMtK81ccXZ@mail.gmail.com>
On Sat, May 22, 2010 at 10:47 AM, George B. <georgeb@gmail.com> wrote:
> This is with both physical links up. The arp monitor just causes the
> links to constantly fail back and forth each arp_monitor interval.
>
I can get it to work with miimon and use_carrier=1 with the vlan
interface (works to the raw ethernet without the use_carrier).
It would be nice, though, for arp_monitor to actually work as by
monitoring an IP on the core switch it would allow me to detect a
failed uplink from the access switch.
^ permalink raw reply
* [patch] sctp: dubious bitfields in sctp_transport
From: Dan Carpenter @ 2010-05-22 20:20 UTC (permalink / raw)
To: Vlad Yasevich
Cc: Sridhar Samudrala, David S. Miller, Wei Yongjun, linux-sctp,
netdev, kernel-janitors
Sparse complains because these one-bit bitfields are signed.
include/net/sctp/structs.h:879:24: error: dubious one-bit signed bitfield
include/net/sctp/structs.h:889:31: error: dubious one-bit signed bitfield
include/net/sctp/structs.h:895:26: error: dubious one-bit signed bitfield
include/net/sctp/structs.h:898:31: error: dubious one-bit signed bitfield
include/net/sctp/structs.h:901:27: error: dubious one-bit signed bitfield
It doesn't cause a problem in the current code, but it would be better
to clean it up. This was introduced by c0058a35aacc7: "sctp: Save some
room in the sctp_transport by using bitfields".
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
It looks like this header is exported to user space. I don't know if
that makes a difference.
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 6173c61..4b86011 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -876,7 +876,7 @@ struct sctp_transport {
/* Reference counting. */
atomic_t refcnt;
- int dead:1,
+ __u32 dead:1,
/* RTO-Pending : A flag used to track if one of the DATA
* chunks sent to this address is currently being
* used to compute a RTT. If this flag is 0,
^ permalink raw reply related
* bug report: xfrm: potential null deref in xfrm_bundle_lookup()
From: Dan Carpenter @ 2010-05-22 20:24 UTC (permalink / raw)
To: timo.teras; +Cc: netdev
This is a smatch thing. I couldn't tell if it was a real issue so I
thought I would send this mail to the experts. :)
net/xfrm/xfrm_policy.c +1679 xfrm_bundle_lookup(51)
error: we previously assumed 'xdst' could be null.
1672 new_xdst = xfrm_resolve_and_create_bundle(pols, num_pols, fl, family, dst_orig);
1673 if (IS_ERR(new_xdst)) {
1674 err = PTR_ERR(new_xdst);
1675 if (err != -EAGAIN)
1676 goto error;
1677 if (oldflo == NULL)
1678 goto make_dummy_bundle;
1679 dst_hold(&xdst->u.dst);
^^^^^^^^^^^
Can xdst be NULL here? It would have to be something like
oldflo gets passed in as null and __xfrm_policy_lookup() fails.
1680 return oldflo;
1681 }
regards,
dan carpenter
^ permalink raw reply
* [patch] pppoe: uninitialized variable in pppoe_flush_dev()
From: Dan Carpenter @ 2010-05-22 20:27 UTC (permalink / raw)
To: Michal Ostrowski
Cc: David S. Miller, Eric Dumazet, Jiri Pirko, Denys Fedoryschenko,
netdev, kernel-janitors
This assignment got deleted along with the checks by mistake. This
comes from: 8753d29fd "pppoe: remove unnecessary checks in
pppoe_flush_dev"
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index b1b93ff..805b64d 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -289,6 +289,7 @@ static void pppoe_flush_dev(struct net_device *dev)
struct pppoe_net *pn;
int i;
+ pn = pppoe_pernet(dev_net(dev));
write_lock_bh(&pn->hash_lock);
for (i = 0; i < PPPOE_HASH_SIZE; i++) {
struct pppox_sock *po = pn->hash_table[i];
^ permalink raw reply related
* [patch] caif: remove unneeded null check in caif_connect()
From: Dan Carpenter @ 2010-05-22 20:43 UTC (permalink / raw)
To: Sjur Braendeland
Cc: Eric Dumazet, David S. Miller, linux-kernel, netdev,
kernel-janitors
We already dereferenced uaddr towards the start of the function when we
checked that "uaddr->sa_family != AF_CAIF". Both the check here and the
earlier check were added in bece7b2398d0: "caif: Rewritten socket
implementation". Before that patch, we assumed that we recieved a valid
pointer for uaddr, and based on that, I have removed this check.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index c3a70c5..bd67bb3 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -890,8 +890,7 @@ static int caif_connect(struct socket *sock, struct sockaddr *uaddr,
sk_stream_kill_queues(&cf_sk->sk);
err = -EINVAL;
- if (addr_len != sizeof(struct sockaddr_caif) ||
- !uaddr)
+ if (addr_len != sizeof(struct sockaddr_caif))
goto out;
memcpy(&cf_sk->conn_req.sockaddr, uaddr,
^ permalink raw reply related
* [patch] caif: cleanup: remove duplicate checks
From: Dan Carpenter @ 2010-05-22 20:45 UTC (permalink / raw)
To: netdev; +Cc: Sjur Braendeland, Stephen Rothwell, kernel-janitors,
David S. Miller
These checks merely duplicate the things we've asserted already. In the
case of the checks for null we've already dereferenced those variables
as well.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c
index df43f26..cc2f072 100644
--- a/net/caif/cfcnfg.c
+++ b/net/caif/cfcnfg.c
@@ -313,14 +313,10 @@ cfcnfg_linkup_rsp(struct cflayer *layer, u8 channel_id, enum cfctrl_srv serv,
caif_assert(phyinfo->phy_layer != NULL);
caif_assert(phyinfo->phy_layer->id == phyid);
- if (phyinfo != NULL &&
- phyinfo->phy_ref_count++ == 0 &&
- phyinfo->phy_layer != NULL &&
+ if (phyinfo->phy_ref_count++ == 0 &&
phyinfo->phy_layer->modemcmd != NULL) {
- caif_assert(phyinfo->phy_layer->id == phyid);
phyinfo->phy_layer->modemcmd(phyinfo->phy_layer,
_CAIF_MODEMCMD_PHYIF_USEFULL);
-
}
adapt_layer->id = channel_id;
^ permalink raw reply related
* Re: [PATCH 1/5] net/phy/marvell: Expose IDs and flags in a .h and add dns323 LEDs setup flag
From: Benjamin Herrenschmidt @ 2010-05-22 22:53 UTC (permalink / raw)
To: Wolfram Sang; +Cc: netdev, linux-arm-kernel@lists.infradead.org, Nicolas Pitre
In-Reply-To: <20100522130624.GA28561@pengutronix.de>
On Sat, 2010-05-22 at 15:06 +0200, Wolfram Sang wrote:
> On Sat, May 22, 2010 at 08:54:43PM +1000, Benjamin Herrenschmidt wrote:
> > This moves the various known Marvell PHY IDs to include/linux/marvell_phy.h
> > along with dev_flags definitions for use by the driver.
>
> I think this one from the driver should go there, too:
>
> #define M1145_DEV_FLAGS_RESISTANCE 0x00000001
>
> (which makes me wonder how this flag was set as it was not exported before)
I missed that one indeed.
> and thus yours could be maybe like
>
> #define M1118_DEV_FLAGS_ALT_LED_INIT 0x00000001
>
> (or 1 << 0)
Right, it should be 2. I'd rather keep the "DNS323" name in there
since the LED setup is specific to that NAS and somebody else might
need a different one. If we end up in the long run with too many
of them, we'll find a better solution, but we aren't there yet.
> Otherwise looks good enough to me.
Ok, thanks. I'll respin the whole lot soon.
Cheers,
Ben.
^ permalink raw reply
* [PATCH 0/7] ISDN patches for 2.6.35
From: Tilman Schmidt @ 2010-05-23 0:24 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Karsten Keil, Hansjoerg Lipp,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp
Karsten, David,
following are seven patches to the CAPI subsystem and the Gigaset
driver I'd like to see included in kernel release 2.6.35.
The first three respond to user reports about an observed hang of
the userspace command "capiinit stop".
The others are cleanups from the ongoing driver development.
Thanks,
Tilman
Tilman Schmidt (7):
Documentation/isdn: CAPI controller interface amendment
isdn/capi: make reset_ctr op truly optional
isdn/gigaset: remove dummy CAPI method implementations
isdn/gigaset: adjust usb_gigaset tty write buffer limit
isdn/gigaset: avoid copying AT commands twice
isdn/gigaset: ignore irrelevant device responses
isdn/gigaset: drop obsolete FIXME comment
Documentation/isdn/INTERFACE.CAPI | 8 +-
drivers/isdn/capi/kcapi.c | 6 +
drivers/isdn/gigaset/bas-gigaset.c | 51 ++-----------
drivers/isdn/gigaset/capi.c | 28 -------
drivers/isdn/gigaset/common.c | 2
drivers/isdn/gigaset/ev-layer.c | 142 ++++++++++++-------------------------
drivers/isdn/gigaset/gigaset.h | 9 --
drivers/isdn/gigaset/interface.c | 36 +++++++--
drivers/isdn/gigaset/ser-gigaset.c | 27 +------
drivers/isdn/gigaset/usb-gigaset.c | 29 +------
10 files changed, 117 insertions(+), 221 deletions(-)
^ permalink raw reply
* [PATCH 1/7] Documentation/isdn: CAPI controller interface amendment
From: Tilman Schmidt @ 2010-05-23 0:24 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Karsten Keil, Hansjoerg Lipp,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp
In-Reply-To: <20100522-patch-gigaset-00.tilman-ZTO5kqT2PaM@public.gmane.org>
Mention that the CAPI controller methods load_firmware() and
reset_ctr() are asynchronous, and should signal completion.
Impact: documentation
Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>
---
Documentation/isdn/INTERFACE.CAPI | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Documentation/isdn/INTERFACE.CAPI b/Documentation/isdn/INTERFACE.CAPI
index f172091..309eb5e 100644
--- a/Documentation/isdn/INTERFACE.CAPI
+++ b/Documentation/isdn/INTERFACE.CAPI
@@ -113,12 +113,16 @@ char *driver_name
int (*load_firmware)(struct capi_ctr *ctrlr, capiloaddata *ldata)
(optional) pointer to a callback function for sending firmware and
configuration data to the device
+ The function may return before the operation has completed.
+ Completion must be signalled by a call to capi_ctr_ready().
Return value: 0 on success, error code on error
Called in process context.
void (*reset_ctr)(struct capi_ctr *ctrlr)
- (optional) pointer to a callback function for performing a reset on
- the device, releasing all registered applications
+ (optional) pointer to a callback function for stopping the device,
+ releasing all registered applications
+ The function may return before the operation has completed.
+ Completion must be signalled by a call to capi_ctr_down().
Called in process context.
void (*register_appl)(struct capi_ctr *ctrlr, u16 applid,
--
1.6.5.3.298.g39add
^ permalink raw reply related
* [PATCH 2/7] isdn/capi: make reset_ctr op truly optional
From: Tilman Schmidt @ 2010-05-23 0:25 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Karsten Keil, Hansjoerg Lipp,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp
In-Reply-To: <20100522-patch-gigaset-00.tilman-ZTO5kqT2PaM@public.gmane.org>
The CAPI controller operation reset_ctr is marked as optional, and
not all drivers do implement it. Add a check to the kernel CAPI
whether it exists before trying to call it.
Impact: oops prevention
Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>
---
drivers/isdn/capi/kcapi.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index bd00dce..bde3c88 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -1147,6 +1147,12 @@ load_unlock_out:
if (ctr->state == CAPI_CTR_DETECTED)
goto reset_unlock_out;
+ if (ctr->reset_ctr == NULL) {
+ printk(KERN_DEBUG "kcapi: reset: no reset function\n");
+ retval = -ESRCH;
+ goto reset_unlock_out;
+ }
+
ctr->reset_ctr(ctr);
retval = wait_on_ctr_state(ctr, CAPI_CTR_DETECTED);
--
1.6.5.3.298.g39add
^ permalink raw reply related
* [PATCH 3/7] isdn/gigaset: remove dummy CAPI method implementations
From: Tilman Schmidt @ 2010-05-23 0:25 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Karsten Keil, Hansjoerg Lipp,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp
In-Reply-To: <20100522-patch-gigaset-00.tilman-ZTO5kqT2PaM@public.gmane.org>
Dummy implementations for the optional CAPI controller operations
load_firmware and reset_ctr can cause userspace callers to hang
indefinitely. It's better not to implement them at all.
Impact: bugfix
Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>
---
drivers/isdn/gigaset/capi.c | 28 ++--------------------------
1 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index 964a55f..e72f86b 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -933,30 +933,6 @@ void gigaset_isdn_stop(struct cardstate *cs)
*/
/*
- * load firmware
- */
-static int gigaset_load_firmware(struct capi_ctr *ctr, capiloaddata *data)
-{
- struct cardstate *cs = ctr->driverdata;
-
- /* AVM specific operation, not needed for Gigaset -- ignore */
- dev_notice(cs->dev, "load_firmware ignored\n");
-
- return 0;
-}
-
-/*
- * reset (deactivate) controller
- */
-static void gigaset_reset_ctr(struct capi_ctr *ctr)
-{
- struct cardstate *cs = ctr->driverdata;
-
- /* AVM specific operation, not needed for Gigaset -- ignore */
- dev_notice(cs->dev, "reset_ctr ignored\n");
-}
-
-/*
* register CAPI application
*/
static void gigaset_register_appl(struct capi_ctr *ctr, u16 appl,
@@ -2213,8 +2189,8 @@ int gigaset_isdn_regdev(struct cardstate *cs, const char *isdnid)
iif->ctr.driverdata = cs;
strncpy(iif->ctr.name, isdnid, sizeof(iif->ctr.name));
iif->ctr.driver_name = "gigaset";
- iif->ctr.load_firmware = gigaset_load_firmware;
- iif->ctr.reset_ctr = gigaset_reset_ctr;
+ iif->ctr.load_firmware = NULL;
+ iif->ctr.reset_ctr = NULL;
iif->ctr.register_appl = gigaset_register_appl;
iif->ctr.release_appl = gigaset_release_appl;
iif->ctr.send_message = gigaset_send_message;
--
1.6.5.3.298.g39add
^ permalink raw reply related
* [PATCH 4/7] isdn/gigaset: adjust usb_gigaset tty write buffer limit
From: Tilman Schmidt @ 2010-05-23 0:26 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Karsten Keil, Hansjoerg Lipp,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp
In-Reply-To: <20100522-patch-gigaset-00.tilman-ZTO5kqT2PaM@public.gmane.org>
The usb_gigaset driver's write buffer limit was different from those
of the other hardware modules for no good reason. Set it to the same
value as the others, derived from the Siemens documentation.
Impact: cosmetic
Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>
---
drivers/isdn/gigaset/usb-gigaset.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 76dbb20..f65cf7d 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -39,7 +39,8 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
#define GIGASET_MODULENAME "usb_gigaset"
#define GIGASET_DEVNAME "ttyGU"
-#define IF_WRITEBUF 2000 /* arbitrary limit */
+/* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */
+#define IF_WRITEBUF 264
/* Values for the Gigaset M105 Data */
#define USB_M105_VENDOR_ID 0x0681
--
1.6.5.3.298.g39add
^ permalink raw reply related
* [PATCH 5/7] isdn/gigaset: avoid copying AT commands twice
From: Tilman Schmidt @ 2010-05-23 0:26 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Karsten Keil, Hansjoerg Lipp,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp
In-Reply-To: <20100522-patch-gigaset-00.tilman-ZTO5kqT2PaM@public.gmane.org>
Change the Gigaset driver's internal write_cmd interface to accept a
cmdbuf structure instead of a string. This avoids copying formatted
AT commands a second time.
Impact: optimization
Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>
---
drivers/isdn/gigaset/bas-gigaset.c | 51 +++++-------------------
drivers/isdn/gigaset/ev-layer.c | 75 ++++++++++++++++-------------------
drivers/isdn/gigaset/gigaset.h | 4 +-
drivers/isdn/gigaset/interface.c | 36 ++++++++++++++---
drivers/isdn/gigaset/ser-gigaset.c | 27 ++----------
drivers/isdn/gigaset/usb-gigaset.c | 26 ++----------
6 files changed, 85 insertions(+), 134 deletions(-)
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 47a5ffe..2dab531 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -1913,65 +1913,41 @@ static int start_cbsend(struct cardstate *cs)
* USB transmission is started if necessary.
* parameters:
* cs controller state structure
- * buf command string to send
- * len number of bytes to send (max. IF_WRITEBUF)
- * wake_tasklet tasklet to run when transmission is completed
- * (NULL if none)
+ * cb command buffer structure
* return value:
* number of bytes queued on success
* error code < 0 on error
*/
-static int gigaset_write_cmd(struct cardstate *cs,
- const unsigned char *buf, int len,
- struct tasklet_struct *wake_tasklet)
+static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
{
- struct cmdbuf_t *cb;
unsigned long flags;
int rc;
gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
- "CMD Transmit", len, buf);
-
- if (len <= 0) {
- /* nothing to do */
- rc = 0;
- goto notqueued;
- }
+ "CMD Transmit", cb->len, cb->buf);
/* translate "+++" escape sequence sent as a single separate command
* into "close AT channel" command for error recovery
* The next command will reopen the AT channel automatically.
*/
- if (len == 3 && !memcmp(buf, "+++", 3)) {
+ if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) {
+ kfree(cb);
rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT);
- goto notqueued;
- }
-
- if (len > IF_WRITEBUF)
- len = IF_WRITEBUF;
- cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC);
- if (!cb) {
- dev_err(cs->dev, "%s: out of memory\n", __func__);
- rc = -ENOMEM;
- goto notqueued;
+ if (cb->wake_tasklet)
+ tasklet_schedule(cb->wake_tasklet);
+ return rc < 0 ? rc : cb->len;
}
- memcpy(cb->buf, buf, len);
- cb->len = len;
- cb->offset = 0;
- cb->next = NULL;
- cb->wake_tasklet = wake_tasklet;
-
spin_lock_irqsave(&cs->cmdlock, flags);
cb->prev = cs->lastcmdbuf;
if (cs->lastcmdbuf)
cs->lastcmdbuf->next = cb;
else {
cs->cmdbuf = cb;
- cs->curlen = len;
+ cs->curlen = cb->len;
}
- cs->cmdbytes += len;
+ cs->cmdbytes += cb->len;
cs->lastcmdbuf = cb;
spin_unlock_irqrestore(&cs->cmdlock, flags);
@@ -1988,12 +1964,7 @@ static int gigaset_write_cmd(struct cardstate *cs,
}
rc = start_cbsend(cs);
spin_unlock_irqrestore(&cs->lock, flags);
- return rc < 0 ? rc : len;
-
-notqueued: /* request handled without queuing */
- if (wake_tasklet)
- tasklet_schedule(wake_tasklet);
- return rc;
+ return rc < 0 ? rc : cb->len;
}
/* gigaset_write_room
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 206c380..84a8901 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -799,48 +799,27 @@ static void schedule_init(struct cardstate *cs, int state)
static void send_command(struct cardstate *cs, const char *cmd, int cid,
int dle, gfp_t kmallocflags)
{
- size_t cmdlen, buflen;
- char *cmdpos, *cmdbuf, *cmdtail;
+ struct cmdbuf_t *cb;
+ size_t buflen;
- cmdlen = strlen(cmd);
- buflen = 11 + cmdlen;
- if (unlikely(buflen <= cmdlen)) {
- dev_err(cs->dev, "integer overflow in buflen\n");
+ buflen = strlen(cmd) + 12; /* DLE ( A T 1 2 3 4 5 <cmd> DLE ) \0 */
+ cb = kmalloc(sizeof(struct cmdbuf_t) + buflen, kmallocflags);
+ if (!cb) {
+ dev_err(cs->dev, "%s: out of memory\n", __func__);
return;
}
-
- cmdbuf = kmalloc(buflen, kmallocflags);
- if (unlikely(!cmdbuf)) {
- dev_err(cs->dev, "out of memory\n");
- return;
- }
-
- cmdpos = cmdbuf + 9;
- cmdtail = cmdpos + cmdlen;
- memcpy(cmdpos, cmd, cmdlen);
-
- if (cid > 0 && cid <= 65535) {
- do {
- *--cmdpos = '0' + cid % 10;
- cid /= 10;
- ++cmdlen;
- } while (cid);
- }
-
- cmdlen += 2;
- *--cmdpos = 'T';
- *--cmdpos = 'A';
-
- if (dle) {
- cmdlen += 4;
- *--cmdpos = '(';
- *--cmdpos = 0x10;
- *cmdtail++ = 0x10;
- *cmdtail++ = ')';
- }
-
- cs->ops->write_cmd(cs, cmdpos, cmdlen, NULL);
- kfree(cmdbuf);
+ if (cid > 0 && cid <= 65535)
+ cb->len = snprintf(cb->buf, buflen,
+ dle ? "\020(AT%d%s\020)" : "AT%d%s",
+ cid, cmd);
+ else
+ cb->len = snprintf(cb->buf, buflen,
+ dle ? "\020(AT%s\020)" : "AT%s",
+ cmd);
+ cb->offset = 0;
+ cb->next = NULL;
+ cb->wake_tasklet = NULL;
+ cs->ops->write_cmd(cs, cb);
}
static struct at_state_t *at_state_from_cid(struct cardstate *cs, int cid)
@@ -1242,8 +1221,22 @@ static void do_action(int action, struct cardstate *cs,
break;
case ACT_HUPMODEM:
/* send "+++" (hangup in unimodem mode) */
- if (cs->connected)
- cs->ops->write_cmd(cs, "+++", 3, NULL);
+ if (cs->connected) {
+ struct cmdbuf_t *cb;
+
+ cb = kmalloc(sizeof(struct cmdbuf_t) + 3, GFP_ATOMIC);
+ if (!cb) {
+ dev_err(cs->dev, "%s: out of memory\n",
+ __func__);
+ return;
+ }
+ memcpy(cb->buf, "+++", 3);
+ cb->len = 3;
+ cb->offset = 0;
+ cb->next = NULL;
+ cb->wake_tasklet = NULL;
+ cs->ops->write_cmd(cs, cb);
+ }
break;
case ACT_RING:
/* get fresh AT state structure for new CID */
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index d32efb6..eb2fdac 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -575,9 +575,7 @@ struct bas_bc_state {
struct gigaset_ops {
/* Called from ev-layer.c/interface.c for sending AT commands to the
device */
- int (*write_cmd)(struct cardstate *cs,
- const unsigned char *buf, int len,
- struct tasklet_struct *wake_tasklet);
+ int (*write_cmd)(struct cardstate *cs, struct cmdbuf_t *cb);
/* Called from interface.c for additional device control */
int (*write_room)(struct cardstate *cs);
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index c9f28dd..f45d686 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -339,7 +339,8 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
{
struct cardstate *cs;
- int retval = -ENODEV;
+ struct cmdbuf_t *cb;
+ int retval;
cs = (struct cardstate *) tty->driver_data;
if (!cs) {
@@ -355,18 +356,39 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
if (!cs->connected) {
gig_dbg(DEBUG_IF, "not connected");
retval = -ENODEV;
- } else if (!cs->open_count)
+ goto done;
+ }
+ if (!cs->open_count) {
dev_warn(cs->dev, "%s: device not opened\n", __func__);
- else if (cs->mstate != MS_LOCKED) {
+ retval = -ENODEV;
+ goto done;
+ }
+ if (cs->mstate != MS_LOCKED) {
dev_warn(cs->dev, "can't write to unlocked device\n");
retval = -EBUSY;
- } else {
- retval = cs->ops->write_cmd(cs, buf, count,
- &cs->if_wake_tasklet);
+ goto done;
+ }
+ if (count <= 0) {
+ /* nothing to do */
+ retval = 0;
+ goto done;
}
- mutex_unlock(&cs->mutex);
+ cb = kmalloc(sizeof(struct cmdbuf_t) + count, GFP_KERNEL);
+ if (!cb) {
+ dev_err(cs->dev, "%s: out of memory\n", __func__);
+ retval = -ENOMEM;
+ goto done;
+ }
+ memcpy(cb->buf, buf, count);
+ cb->len = count;
+ cb->offset = 0;
+ cb->next = NULL;
+ cb->wake_tasklet = &cs->if_wake_tasklet;
+ retval = cs->ops->write_cmd(cs, cb);
+done:
+ mutex_unlock(&cs->mutex);
return retval;
}
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index e96c058..d151dcb 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -241,30 +241,13 @@ static void flush_send_queue(struct cardstate *cs)
* return value:
* number of bytes queued, or error code < 0
*/
-static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
- int len, struct tasklet_struct *wake_tasklet)
+static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
{
- struct cmdbuf_t *cb;
unsigned long flags;
gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
- "CMD Transmit", len, buf);
-
- if (len <= 0)
- return 0;
-
- cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC);
- if (!cb) {
- dev_err(cs->dev, "%s: out of memory!\n", __func__);
- return -ENOMEM;
- }
-
- memcpy(cb->buf, buf, len);
- cb->len = len;
- cb->offset = 0;
- cb->next = NULL;
- cb->wake_tasklet = wake_tasklet;
+ "CMD Transmit", cb->len, cb->buf);
spin_lock_irqsave(&cs->cmdlock, flags);
cb->prev = cs->lastcmdbuf;
@@ -272,9 +255,9 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
cs->lastcmdbuf->next = cb;
else {
cs->cmdbuf = cb;
- cs->curlen = len;
+ cs->curlen = cb->len;
}
- cs->cmdbytes += len;
+ cs->cmdbytes += cb->len;
cs->lastcmdbuf = cb;
spin_unlock_irqrestore(&cs->cmdlock, flags);
@@ -282,7 +265,7 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
if (cs->connected)
tasklet_schedule(&cs->write_tasklet);
spin_unlock_irqrestore(&cs->lock, flags);
- return len;
+ return cb->len;
}
/*
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index f65cf7d..4a66338 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -494,29 +494,13 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
}
/* Send command to device. */
-static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
- int len, struct tasklet_struct *wake_tasklet)
+static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
{
- struct cmdbuf_t *cb;
unsigned long flags;
gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
DEBUG_TRANSCMD : DEBUG_LOCKCMD,
- "CMD Transmit", len, buf);
-
- if (len <= 0)
- return 0;
- cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC);
- if (!cb) {
- dev_err(cs->dev, "%s: out of memory\n", __func__);
- return -ENOMEM;
- }
-
- memcpy(cb->buf, buf, len);
- cb->len = len;
- cb->offset = 0;
- cb->next = NULL;
- cb->wake_tasklet = wake_tasklet;
+ "CMD Transmit", cb->len, cb->buf);
spin_lock_irqsave(&cs->cmdlock, flags);
cb->prev = cs->lastcmdbuf;
@@ -524,9 +508,9 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
cs->lastcmdbuf->next = cb;
else {
cs->cmdbuf = cb;
- cs->curlen = len;
+ cs->curlen = cb->len;
}
- cs->cmdbytes += len;
+ cs->cmdbytes += cb->len;
cs->lastcmdbuf = cb;
spin_unlock_irqrestore(&cs->cmdlock, flags);
@@ -534,7 +518,7 @@ static int gigaset_write_cmd(struct cardstate *cs, const unsigned char *buf,
if (cs->connected)
tasklet_schedule(&cs->write_tasklet);
spin_unlock_irqrestore(&cs->lock, flags);
- return len;
+ return cb->len;
}
static int gigaset_write_room(struct cardstate *cs)
--
1.6.5.3.298.g39add
^ permalink raw reply related
* [PATCH 6/7] isdn/gigaset: ignore irrelevant device responses
From: Tilman Schmidt @ 2010-05-23 0:27 UTC (permalink / raw)
To: Karsten Keil, David Miller
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Karsten Keil, Hansjoerg Lipp,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
i4ldeveloper-JX7+OpRa80SjiSfgN6Y1Ib39b6g2fGNp
In-Reply-To: <20100522-patch-gigaset-00.tilman-ZTO5kqT2PaM@public.gmane.org>
Downgrade the Gigaset driver's reaction to unknown AT responses from
the device from warning to debug level, and remove the handling of
some device responses which aren't relevant for the driver's
operation.
Signed-off-by: Tilman Schmidt <tilman-ZTO5kqT2PaM@public.gmane.org>
---
drivers/isdn/gigaset/ev-layer.c | 67 ++++++++------------------------------
drivers/isdn/gigaset/gigaset.h | 5 +--
2 files changed, 16 insertions(+), 56 deletions(-)
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c
index 84a8901..78c7844 100644
--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -35,53 +35,40 @@
#define RT_RING 2
#define RT_NUMBER 3
#define RT_STRING 4
-#define RT_HEX 5
#define RT_ZCAU 6
/* Possible ASCII responses */
#define RSP_OK 0
-#define RSP_BUSY 1
-#define RSP_CONNECT 2
+#define RSP_ERROR 1
#define RSP_ZGCI 3
#define RSP_RING 4
-#define RSP_ZAOC 5
-#define RSP_ZCSTR 6
-#define RSP_ZCFGT 7
-#define RSP_ZCFG 8
-#define RSP_ZCCR 9
-#define RSP_EMPTY 10
-#define RSP_ZLOG 11
-#define RSP_ZCAU 12
-#define RSP_ZMWI 13
-#define RSP_ZABINFO 14
-#define RSP_ZSMLSTCHG 15
+#define RSP_ZVLS 5
+#define RSP_ZCAU 6
+
+/* responses with values to store in at_state */
+/* - numeric */
#define RSP_VAR 100
#define RSP_ZSAU (RSP_VAR + VAR_ZSAU)
#define RSP_ZDLE (RSP_VAR + VAR_ZDLE)
-#define RSP_ZVLS (RSP_VAR + VAR_ZVLS)
#define RSP_ZCTP (RSP_VAR + VAR_ZCTP)
+/* - string */
#define RSP_STR (RSP_VAR + VAR_NUM)
#define RSP_NMBR (RSP_STR + STR_NMBR)
#define RSP_ZCPN (RSP_STR + STR_ZCPN)
#define RSP_ZCON (RSP_STR + STR_ZCON)
#define RSP_ZBC (RSP_STR + STR_ZBC)
#define RSP_ZHLC (RSP_STR + STR_ZHLC)
-#define RSP_ERROR -1 /* ERROR */
+
#define RSP_WRONG_CID -2 /* unknown cid in cmd */
-#define RSP_UNKNOWN -4 /* unknown response */
-#define RSP_FAIL -5 /* internal error */
#define RSP_INVAL -6 /* invalid response */
+#define RSP_NODEV -9 /* device not connected */
#define RSP_NONE -19
#define RSP_STRING -20
#define RSP_NULL -21
-#define RSP_RETRYFAIL -22
-#define RSP_RETRY -23
-#define RSP_SKIP -24
#define RSP_INIT -27
#define RSP_ANY -26
#define RSP_LAST -28
-#define RSP_NODEV -9
/* actions for process_response */
#define ACT_NOTHING 0
@@ -259,13 +246,6 @@ struct reply_t gigaset_tab_nocid[] =
/* misc. */
{RSP_ERROR, -1, -1, -1, -1, -1, {ACT_ERROR} },
-{RSP_ZCFGT, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZCFG, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZLOG, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZMWI, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZABINFO, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZSMLSTCHG, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-
{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
@@ -363,10 +343,6 @@ struct reply_t gigaset_tab_cid[] =
/* misc. */
{RSP_ZCON, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZCCR, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZAOC, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-{RSP_ZCSTR, -1, -1, -1, -1, -1, {ACT_DEBUG} },
-
{RSP_ZCAU, -1, -1, -1, -1, -1, {ACT_ZCAU} },
{RSP_NONE, -1, -1, -1, -1, -1, {ACT_DEBUG} },
{RSP_ANY, -1, -1, -1, -1, -1, {ACT_WARN} },
@@ -389,20 +365,11 @@ static const struct resp_type_t {
{"ZVLS", RSP_ZVLS, RT_NUMBER},
{"ZCTP", RSP_ZCTP, RT_NUMBER},
{"ZDLE", RSP_ZDLE, RT_NUMBER},
- {"ZCFGT", RSP_ZCFGT, RT_NUMBER},
- {"ZCCR", RSP_ZCCR, RT_NUMBER},
- {"ZMWI", RSP_ZMWI, RT_NUMBER},
{"ZHLC", RSP_ZHLC, RT_STRING},
{"ZBC", RSP_ZBC, RT_STRING},
{"NMBR", RSP_NMBR, RT_STRING},
{"ZCPN", RSP_ZCPN, RT_STRING},
{"ZCON", RSP_ZCON, RT_STRING},
- {"ZAOC", RSP_ZAOC, RT_STRING},
- {"ZCSTR", RSP_ZCSTR, RT_STRING},
- {"ZCFG", RSP_ZCFG, RT_HEX},
- {"ZLOG", RSP_ZLOG, RT_NOTHING},
- {"ZABINFO", RSP_ZABINFO, RT_NOTHING},
- {"ZSMLSTCHG", RSP_ZSMLSTCHG, RT_NOTHING},
{NULL, 0, 0}
};
@@ -590,10 +557,10 @@ void gigaset_handle_modem_response(struct cardstate *cs)
break;
if (!rt->response) {
- event->type = RSP_UNKNOWN;
- dev_warn(cs->dev,
- "unknown modem response: %s\n",
- argv[curarg]);
+ event->type = RSP_NONE;
+ gig_dbg(DEBUG_EVENT,
+ "unknown modem response: '%s'\n",
+ argv[curarg]);
break;
}
@@ -657,14 +624,8 @@ void gigaset_handle_modem_response(struct cardstate *cs)
curarg = params - 1;
break;
case RT_NUMBER:
- case RT_HEX:
if (curarg < params) {
- if (param_type == RT_HEX)
- event->parameter =
- isdn_gethex(argv[curarg]);
- else
- event->parameter =
- isdn_getnum(argv[curarg]);
+ event->parameter = isdn_getnum(argv[curarg]);
++curarg;
} else
event->parameter = -1;
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 6afc300..3347470 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -198,9 +198,8 @@ void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
/* variables in struct at_state_t */
#define VAR_ZSAU 0
#define VAR_ZDLE 1
-#define VAR_ZVLS 2
-#define VAR_ZCTP 3
-#define VAR_NUM 4
+#define VAR_ZCTP 2
+#define VAR_NUM 3
#define STR_NMBR 0
#define STR_ZCPN 1
--
1.6.5.3.298.g39add
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox