Netdev List
 help / color / mirror / Atom feed
* [PATCH v5 8/9] usb/atm/speedtch.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Propagate signal changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/usb/atm/speedtch.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 1335456..80f9617 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -525,7 +525,7 @@ static void speedtch_check_status(struct work_struct *work)
 
 		switch (status) {
 		case 0:
-			atm_dev->signal = ATM_PHY_SIG_LOST;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 			if (instance->last_status)
 				atm_info(usbatm, "ADSL line is down\n");
 			/* It may never resync again unless we ask it to... */
@@ -533,12 +533,12 @@ static void speedtch_check_status(struct work_struct *work)
 			break;
 
 		case 0x08:
-			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN);
 			atm_info(usbatm, "ADSL line is blocked?\n");
 			break;
 
 		case 0x10:
-			atm_dev->signal = ATM_PHY_SIG_LOST;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_LOST);
 			atm_info(usbatm, "ADSL line is synchronising\n");
 			break;
 
@@ -554,7 +554,7 @@ static void speedtch_check_status(struct work_struct *work)
 			}
 
 			atm_dev->link_rate = down_speed * 1000 / 424;
-			atm_dev->signal = ATM_PHY_SIG_FOUND;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_FOUND);
 
 			atm_info(usbatm,
 				 "ADSL line is up (%d kb/s down | %d kb/s up)\n",
@@ -562,7 +562,7 @@ static void speedtch_check_status(struct work_struct *work)
 			break;
 
 		default:
-			atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+			atm_dev_signal_change(atm_dev, ATM_PHY_SIG_UNKNOWN);
 			atm_info(usbatm, "unknown line state %02x\n", status);
 			break;
 		}
-- 
1.7.1


^ permalink raw reply related

* [PATCH v5 9/9] usb/atm/ueagle-atm.c: call atm_dev_signal_change() when signal changes.
From: Karl Hiramoto @ 2010-07-09  6:55 UTC (permalink / raw)
  To: linux-atm-general, netdev, chas, davem; +Cc: Karl Hiramoto
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

Propagate signal changes to upper atm layer.

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 drivers/usb/atm/ueagle-atm.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index e213d3f..ebae944 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -575,6 +575,13 @@ MODULE_PARM_DESC(annex,
 			sc->usbatm->atm_dev->type = val; \
 	} while (0)
 
+#define UPDATE_ATM_SIGNAL(val) \
+	do { \
+		if (sc->usbatm->atm_dev) \
+			atm_dev_signal_change(sc->usbatm->atm_dev, val); \
+	} while (0)
+
+
 /* Firmware loading */
 #define LOAD_INTERNAL     0xA0
 #define F8051_USBCS       0x7f92
@@ -1359,7 +1366,7 @@ static int uea_stat_e1(struct uea_softc *sc)
 	/* always update it as atm layer could not be init when we switch to
 	 * operational state
 	 */
-	UPDATE_ATM_STAT(signal, ATM_PHY_SIG_FOUND);
+	UPDATE_ATM_SIGNAL(ATM_PHY_SIG_FOUND);
 
 	/* wake up processes waiting for synchronization */
 	wake_up(&sc->sync_q);
@@ -1498,7 +1505,7 @@ static int uea_stat_e4(struct uea_softc *sc)
 	/* always update it as atm layer could not be init when we switch to
 	 * operational state
 	 */
-	UPDATE_ATM_STAT(signal, ATM_PHY_SIG_FOUND);
+	UPDATE_ATM_SIGNAL(ATM_PHY_SIG_FOUND);
 
 	/* wake up processes waiting for synchronization */
 	wake_up(&sc->sync_q);
@@ -1825,7 +1832,7 @@ static int uea_start_reset(struct uea_softc *sc)
 	 * So we will failed to wait Ready CMV.
 	 */
 	sc->cmv_ack = 0;
-	UPDATE_ATM_STAT(signal, ATM_PHY_SIG_LOST);
+	UPDATE_ATM_SIGNAL(ATM_PHY_SIG_LOST);
 
 	/* reset statistics */
 	memset(&sc->stats, 0, sizeof(struct uea_stats));
-- 
1.7.1


^ permalink raw reply related

* Re: [PATCH v4 1/9] atm: propagate signal changes via notifier
From: Simon Horman @ 2010-07-09  7:04 UTC (permalink / raw)
  To: David Miller; +Cc: karl, linux-atm-general, netdev, chas
In-Reply-To: <20100708.235314.241453003.davem@davemloft.net>

On Thu, Jul 08, 2010 at 11:53:14PM -0700, David Miller wrote:
> From: Simon Horman <horms@verge.net.au>
> Date: Fri, 9 Jul 2010 15:50:13 +0900
> 
> > On Thu, Jul 08, 2010 at 11:38:01PM -0700, David Miller wrote:
> >> From: Karl Hiramoto <karl@hiramoto.org>
> >> Date: Fri, 09 Jul 2010 08:36:03 +0200
> >> 
> >> > Ok, fixing it,  but there are 100's of occurences in net/ like i had it. :-)
> >> 
> >> I would be happy to see a patch which fixes them up :-)
> > 
> > Really? By my calculations it would be an awful lot of churn.
> > 
> > $ find net/ -type f -name "*.[chS]" | xargs grep "\/\* *$" | wc -l
> > 6833
> > $ find net/ -type f -name "*.[chS]" | xargs grep -l "\/\* *$" | wc -l
> > 929
> 
> I didn't mean "one patch" which fixes them up :)
> 
> Done graudually in chunks over a period of time, it's not likely
> to be so much churn.
> 
> This is how every other coding style malfeasance gets handled.

Understood

^ permalink raw reply

* Re: [PATCH v5 0/9] atm: propagate atm_dev signal carrier to LOWER_UP of netdevice
From: David Miller @ 2010-07-09  7:10 UTC (permalink / raw)
  To: karl; +Cc: linux-atm-general, netdev, chas
In-Reply-To: <1278658538-6769-1-git-send-email-karl@hiramoto.org>

From: Karl Hiramoto <karl@hiramoto.org>
Date: Fri,  9 Jul 2010 08:55:29 +0200

> Use atm_dev notifier chain  instead of callback function pointer in struct vcc.
> In drivers/usb/atm call atm_dev_signal_change().
> 
> In userspace it's helpful to know if a network device has a carrier signal.
> Often it is monitored via netlink.  This patchset allows a way for the
> struct atm_dev drivers to pass carrier on/off to the netdevice.
> 
> For DSL, carrier is on when the line has reached showtime state.
> 
> Currently this patchset only propagates the changes to br2684 vccs,
> as this is the only type of hardware I have to test.
> 
> If you prefer git you can pull from:
> git://github.com/karlhiramoto/linux-2.6.git atm-v5

All applied, thanks Karl.

^ permalink raw reply

* Re: 2.6.35-rc4-git3: Reported regressions from 2.6.34
From: Ingo Molnar @ 2010-07-09  7:11 UTC (permalink / raw)
  To: Linus Torvalds, Paul E. McKenney, Peter Zijlstra, Thomas Gleixner
  Cc: Rafael J. Wysocki, Linux Kernel Mailing List, Maciej Rutecki,
	Andrew Morton, Kernel Testers List, Network Development,
	Linux ACPI, Linux PM List, Linux SCSI List, Linux Wireless List,
	DRI, Frederic Weisbecker, Al Viro, Shawn Starr, Jesse Barnes,
	Dave Airlie, David S. Miller, Patrick McHardy, Jens Axboe
In-Reply-To: <AANLkTiknnzWyVpqnPCpyiEVHLgkewd0zaGzLInABRe2G-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


* Linus Torvalds <torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> wrote:

> > Bug-Entry ? ? ? : http://bugzilla.kernel.org/show_bug.cgi?id=16346
> > Subject ? ? ? ? : 2.6.35-rc3-git8 - include/linux/fdtable.h:88 invoked rcu_dereference_check() without protection!
> > Submitter ? ? ? : Miles Lane <miles.lane-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > Date ? ? ? ? ? ?: 2010-07-04 22:04 (5 days old)
> > Message-ID ? ? ?: <AANLkTinof0k28rk4rMr66aubxcRL2rFa5ZEArj1lqD3o-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
> > References ? ? ?: http://marc.info/?l=linux-kernel&m=127828107815930&w=2
> 
> I'm not entirely sure if these RCU proving things should count as 
> regressions.

Generally not - and we've delayed at least one more complex (cgroups) fix to 
v2.6.36 because the patch itself was riskier than the warning.

Still most of the warning fixes turned out to be simple, so we merged the 
very-low-risk ones and right now we seem to be on top of them.

But in general the default rule is that we delay these fixes to v2.6.36.

> Sure, the option to enable RCU proving is new, but the things it reports 
> about generally are not new - and they are usually not even bugs in the 
> sense that they necessarily cause any real problems.
> 
> That particular one is in the single-thread optimizated case for fget_light, ie
> 
>         if (likely((atomic_read(&files->count) == 1))) {
>                 file = fcheck_files(files, fd);
> 
> where I think it should be entirely safe in all ways without any locking. So 
> I think it's a false positive too.

Yeah, it's a bit like with lockdep (and it's a bit like with compiler warning 
fixes): we had to punch through a large stack of false positives that 
accumulated in the past 10 years.

( Because real bugs eventually get fixed, while false positives always just
  accumulate. So almost by definition we always start with a very assymetric
  collection of warnings and a large stack of false positives. )

Having said that, it appears we got most of the false positives and are 
beginning to be in a more representative equilibrium now. If v2.6.35 isnt 
going to be warning-free then v2.6.36 certainly will be and new warnings will 
have a much higher likelyhood of being real (and new) bugs (not just 
accumulated false-positives).

	Ingo

^ permalink raw reply

* Re: [PATCH] netfilter: add CHECKSUM target
From: Herbert Xu @ 2010-07-09  7:18 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Patrick McHardy, David S. Miller, Alexey Kuznetsov,
	Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
	linux-kernel, netfilter-devel, netfilter, coreteam, netdev, kvm
In-Reply-To: <20100708222913.GA4475@redhat.com>

On Fri, Jul 09, 2010 at 01:29:13AM +0300, Michael S. Tsirkin wrote:
> This adds a `CHECKSUM' target, which can be used in the iptables mangle
> table.
> 
> You can use this target to compute and fill in the checksum in
> an IP packet that lacks a checksum.  This is particularly useful,
> if you need to work around old applications such as dhcp clients,
> that do not work well with checksum offloads, but don't want to
> disable checksum offload in your device.
> 
> The problem happens in the field with virtualized applications.
> For reference, see Red Hat bz 605555, as well as
> http://www.spinics.net/lists/kvm/msg37660.html
> 
> Typical expected use (helps old dhclient binary running in a VM):
> iptables -A POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM
> --checksum-fill
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

I'd think that this target would be protocol-agnostic, no?

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [PATCH]: rfs: record flow in TCP receiving and sending pathes
From: Changli Gao @ 2010-07-09  7:28 UTC (permalink / raw)
  To: David S. Miller; +Cc: Tom Herbert, netdev, Changli Gao

rfs: record flow in TCP receiving and sending pathes

call sock_rps_record_flow() in function tcp_splice_read(), tcp_sendpage() and
tcp_sendmsg().

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
 net/ipv4/tcp.c |    3 +++
 1 file changed, 3 insertions(+)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4e6ddfb..47537d8 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -608,6 +608,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
 	ssize_t spliced;
 	int ret;
 
+	sock_rps_record_flow(sk);
 	/*
 	 * We can't seek on a socket input
 	 */
@@ -862,6 +863,7 @@ ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset,
 	ssize_t res;
 	struct sock *sk = sock->sk;
 
+	sock_rps_record_flow(sk);
 	if (!(sk->sk_route_caps & NETIF_F_SG) ||
 	    !(sk->sk_route_caps & NETIF_F_ALL_CSUM))
 		return sock_no_sendpage(sock, page, offset, size, flags);
@@ -909,6 +911,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
 	int sg, err, copied;
 	long timeo;
 
+	sock_rps_record_flow(sk);
 	lock_sock(sk);
 	TCP_CHECK_TIMER(sk);
 

^ permalink raw reply related

* Re: [PATCH 1/1] Bluetooth: hidp: Add support for hidraw HIDIOCGFEATURE  and HIDIOCSFEATURE
From: Marcel Holtmann @ 2010-07-09  8:01 UTC (permalink / raw)
  To: Alan Ott
  Cc: David S Miller, Jiri Kosina, Michael Poole, Bastien Nocera,
	Eric Dumazet, linux-bluetooth, linux-kernel, netdev
In-Reply-To: <4C369CDC.9080104@signal11.us>

Hi Alan,

> > I looked at this and I am bit worried that this should not be done in
> > this detail in the HIDP driver. Essentially HIDP is a pure transport
> > driver. It should not handle all these details. Can we make this a bit
> > easier for the transport drivers to support such features?
> 
> I put these changes (most notably the addition of hidp_get_raw_report()) 
> in hidp because that's where the parallel function 
> hidp_output_raw_report() was already located. I figured the input should 
> go with the output. That said, if there's a better place for both of 
> them (input and output) to go, let me know where you think it should be, 
> and I'll get them moved into the proper spot.
> 
> I'm not sure what you mean about HIDP being a pure transport driver.

what is usb-hid.ko doing here? I would expect a bunch of code
duplication with minor difference between USB and Bluetooth.

Regards

Marcel

^ permalink raw reply

* Re: [PATCH] igbvf: avoid name clash between PF and VF
From: Stefan Assmann @ 2010-07-09  9:31 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: e1000-devel, netdev, gregory.v.rose, jeffrey.t.kirsher,
	Andy Gospodarek
In-Reply-To: <201007081541.57685.arnd@arndb.de>

On 08.07.2010 15:41, Arnd Bergmann wrote:
> On Wednesday 30 June 2010, Stefan Assmann wrote:
>> diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
>> index 5e2b2a8..2fb665b 100644
>> --- a/drivers/net/igbvf/netdev.c
>> +++ b/drivers/net/igbvf/netdev.c
>> @@ -2787,7 +2787,7 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
>>         netif_carrier_off(netdev);
>>         netif_stop_queue(netdev);
>>
>> -       strcpy(netdev->name, "eth%d");
>> +       strcpy(netdev->name, "veth%d");
>>         err = register_netdev(netdev);
>>         if (err)
>>                 goto err_hw_init;
> 
> Note that 'veth' is the name used for a virtual ethernet pair by
> drivers/net/veth.c. If a variant of your patch gets applied, it would
> probably be useful to use a different naming scheme to avoid confusion
> with the veth driver.

Good point!
Greg suggested vfeth, that should be more descriptive and unique.

  Stefan
---
diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
index 5e2b2a8..4d02af8 100644
--- a/drivers/net/igbvf/netdev.c
+++ b/drivers/net/igbvf/netdev.c
@@ -2787,7 +2787,7 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
 	netif_carrier_off(netdev);
 	netif_stop_queue(netdev);

-	strcpy(netdev->name, "eth%d");
+	strcpy(netdev->name, "vfeth%d");
 	err = register_netdev(netdev);
 	if (err)
 		goto err_hw_init;

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

^ permalink raw reply related

* Re: [PATCH] netfilter: add CHECKSUM target
From: Jan Engelhardt @ 2010-07-09  9:56 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Patrick McHardy, David S. Miller, Alexey Kuznetsov,
	Pekka Savola (ipv6), James Morris, Hideaki YOSHIFUJI,
	linux-kernel, netfilter-devel, netfilter, coreteam, netdev,
	herbert.xu, kvm
In-Reply-To: <20100708222913.GA4475@redhat.com>


On Friday 2010-07-09 00:29, Michael S. Tsirkin wrote:
>
> include/linux/netfilter_ipv4/ipt_CHECKSUM.h |   18 +++++++
> net/ipv4/netfilter/Kconfig                  |   16 ++++++
> net/ipv4/netfilter/Makefile                 |    1 +
> net/ipv4/netfilter/ipt_CHECKSUM.c           |   72 +++++++++++++++++++++++++++

New modules should use xt.

>+static unsigned int
>+checksum_tg(struct sk_buff *skb, const struct xt_action_param *par)
>+{
>+	if (skb->ip_summed == CHECKSUM_PARTIAL) {
>+		skb_checksum_help(skb);
>+	}

- {}

^ permalink raw reply

* Re: linux-next: manual merge of the wireless tree with the net tree
From: Luciano Coelho @ 2010-07-09  9:59 UTC (permalink / raw)
  To: ext Stephen Rothwell
  Cc: John W. Linville, linux-next@vger.kernel.org,
	linux-kernel@vger.kernel.org, Eric Dumazet, David Miller,
	netdev@vger.kernel.org
In-Reply-To: <20100709115119.6c88f8d2.sfr@canb.auug.org.au>

Hi Stephen,

On Fri, 2010-07-09 at 03:51 +0200, ext Stephen Rothwell wrote:
> Hi John,
> 
> Today's linux-next merge of the wireless tree got a conflict in
> drivers/net/wireless/wl12xx/wl1271_cmd.h between commit
> ba2d3587912f82d1ab4367975b1df460db60fb1e ("drivers/net: use __packed
> annotation") from the net tree and commit
> 34dd2aaac4a4b908c093980a9894fd878aeb6deb ("wl1271: moved scan operations
> to a separate file") from the wireless tree.
> 
> I didn't bother changing __attribute((packed)) to __packed where this
> code has been moved to.  Maybe someone could write a patch to do that ...

I'll submit a patch to change all the instances of __attribute((packed))
to __packed in the wl1271 driver.


-- 
Cheers,
Luca.

^ permalink raw reply

* Re: Bug handling devices with weird names
From: Martín Ferrari @ 2010-07-09 10:04 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Mathieu Lacage
In-Reply-To: <20100708102747.66d0ad78@s6510>

On Thu, Jul 8, 2010 at 19:27, Stephen Hemminger <shemminger@vyatta.com> wrote:
> Colons are used for the old IP aliasing. IP aliasing was an older way of handling
> multiple addresses per interface, and is not necessary anymore. The syntax is
> retained for legacy compatibility.

I know, but there is some code that is not accepting any valid name.
So i am able to create the device but then I cannot do some stuff. So
that's why I think this is a bug.


-- 
Martín Ferrari

^ permalink raw reply

* Re: Bug handling devices with weird names
From: Eric Dumazet @ 2010-07-09 10:19 UTC (permalink / raw)
  To: Martín Ferrari; +Cc: Stephen Hemminger, netdev, Mathieu Lacage
In-Reply-To: <AANLkTim3IpnHn8ZedpYAphlA1ZdhzizuJo-azmPtd-kd@mail.gmail.com>

Le vendredi 09 juillet 2010 à 12:04 +0200, Martín Ferrari a écrit :
> On Thu, Jul 8, 2010 at 19:27, Stephen Hemminger <shemminger@vyatta.com> wrote:
> > Colons are used for the old IP aliasing. IP aliasing was an older way of handling
> > multiple addresses per interface, and is not necessary anymore. The syntax is
> > retained for legacy compatibility.
> 
> I know, but there is some code that is not accepting any valid name.
> So i am able to create the device but then I cannot do some stuff. So
> that's why I think this is a bug.
> 
> 

Update user land tools ?

No problem here :

# ip link add name foo: type dummy
# ip link list foo:
14: foo:: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN 
    link/ether e6:48:a9:57:d4:1f brd ff:ff:ff:ff:ff:ff
# ip link del foo:
# ip -V
ip utility, iproute2-ss100519



^ permalink raw reply

* [PATCH -next] wl1271: use __packed annotation
From: Luciano Coelho @ 2010-07-09 11:10 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next, linux-kernel, Eric Dumazet, David Miller, netdev,
	John W. Linville, Stephen Rothwell

This patch changes __attribute__ ((packed)) annotations to __packed in wl1271
code that was introduced in a recent patch in wireless-testing.

Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1271_acx.h  |    2 +-
 drivers/net/wireless/wl12xx/wl1271_scan.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_acx.h b/drivers/net/wireless/wl12xx/wl1271_acx.h
index 8323360..4235bc5 100644
--- a/drivers/net/wireless/wl12xx/wl1271_acx.h
+++ b/drivers/net/wireless/wl12xx/wl1271_acx.h
@@ -1002,7 +1002,7 @@ struct wl1271_acx_fw_tsf_information {
 	__le32 last_tbtt_low;
 	u8 last_dtim_count;
 	u8 padding[3];
-} __attribute__ ((packed));
+} __packed;
 
 enum {
 	ACX_WAKE_UP_CONDITIONS      = 0x0002,
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.h b/drivers/net/wireless/wl12xx/wl1271_scan.h
index b0e36e3..f181570 100644
--- a/drivers/net/wireless/wl12xx/wl1271_scan.h
+++ b/drivers/net/wireless/wl12xx/wl1271_scan.h
@@ -76,7 +76,7 @@ struct basic_scan_params {
 	u8 use_ssid_list;
 	u8 scan_tag;
 	u8 padding2;
-} __attribute__ ((packed));
+} __packed;
 
 struct basic_scan_channel_params {
 	/* Duration in TU to wait for frames on a channel for active scan */
@@ -91,19 +91,19 @@ struct basic_scan_channel_params {
 	u8 dfs_candidate;
 	u8 activity_detected;
 	u8 pad;
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_cmd_scan {
 	struct wl1271_cmd_header header;
 
 	struct basic_scan_params params;
 	struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
-} __attribute__ ((packed));
+} __packed;
 
 struct wl1271_cmd_trigger_scan_to {
 	struct wl1271_cmd_header header;
 
 	__le32 timeout;
-} __attribute__ ((packed));
+} __packed;
 
 #endif /* __WL1271_SCAN_H__ */
-- 
1.6.3.3

^ permalink raw reply related

* Re: [PATCH v4 1/9] atm: propagate signal changes via notifier
From: chas williams - CONTRACTOR @ 2010-07-09 11:16 UTC (permalink / raw)
  To: David Miller; +Cc: karl, linux-atm-general, netdev
In-Reply-To: <20100708.214745.48520104.davem@davemloft.net>

On Thu, 08 Jul 2010 21:47:45 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Karl Hiramoto <karl@hiramoto.org>
> Date: Thu,  8 Jul 2010 10:34:47 +0200
> 
> /* Like
>  * this.
>  */
> 
> not:
> 
> /*
>  * Like
>  * this.
>  */
> 
> Honestly, I don't know how I can be more clear about this :-)

this is somewhat contrary to the suggested multi-line format given in
Documentation/CodingStyle:


The preferred style for long (multi-line) comments is:

        /*
         * This is the preferred style for multi-line
         * comments in the Linux kernel source code.
         * Please use it consistently.
         *
         * Description:  A column of asterisks on the left side,
         * with beginning and ending almost-blank lines.
         */

^ permalink raw reply

* [PATCH net-next-2.6] be2net: Patch to determine if function is VF while running in guest OS.
From: Sarveshwar Bandi @ 2010-07-09 11:43 UTC (permalink / raw)
  To: davem; +Cc: netdev

When driver is loaded in guest OS, the pci variables is_virtfn and is_physfn are
both set to 0. This change uses registers in controller to determine the same.

Signed-off-by: Sarveshwar Bandi <sarveshwarb@serverengines.com>
---
 drivers/net/benet/be.h      |   12 +++++++++++-
 drivers/net/benet/be_main.c |    1 +
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index 1a0d2d0..f17428c 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -291,9 +291,10 @@ struct be_adapter {
 	u32 vf_if_handle[BE_MAX_VF];
 	u32 vf_pmac_id[BE_MAX_VF];
 	u8 base_eq_id;
+	u8 is_virtfn;
 };
 
-#define be_physfn(adapter) (!adapter->pdev->is_virtfn)
+#define be_physfn(adapter) (!adapter->is_virtfn)
 
 /* BladeEngine Generation numbers */
 #define BE_GEN2 2
@@ -393,6 +394,15 @@ static inline u8 is_udp_pkt(struct sk_bu
 	return val;
 }
 
+static inline void be_check_sriov_fn_type(struct be_adapter *adapter)
+{
+	u8 data;
+
+	pci_write_config_byte(adapter->pdev, 0xFE, 0xAA);
+	pci_read_config_byte(adapter->pdev, 0xFE, &data);
+	adapter->is_virtfn = (data != 0xAA);
+}
+
 extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
 		u16 num_popped);
 extern void be_link_status_update(struct be_adapter *adapter, bool link_up);
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index b636879..e6ca923 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1631,6 +1631,7 @@ static void be_sriov_enable(struct be_ad
 {
 #ifdef CONFIG_PCI_IOV
 	int status;
+	be_check_sriov_fn_type(adapter);
 	if (be_physfn(adapter) && num_vfs) {
 		status = pci_enable_sriov(adapter->pdev, num_vfs);
 		adapter->sriov_enabled = status ? false : true;
-- 
1.4.0


^ permalink raw reply related

* Re: [PATCH v2 -net-2.6] ll_temac: fix DMA resources leak
From: Kulikov Vasiliy @ 2010-07-09 11:43 UTC (permalink / raw)
  To: Denis Kirjanov; +Cc: davem, john.linn, brian.hill, grant.likely, jpirko, netdev
In-Reply-To: <20100708202451.GA4062@hera.kernel.org>

On Thu, Jul 08, 2010 at 20:24 +0000, Denis Kirjanov wrote:
> V2: Check pointers before releasing resources.
> 
> Fix DMA resources leak.
> Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
>  1 files changed, 32 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
> index fa303c8..b57d0ff 100644
> --- a/drivers/net/ll_temac_main.c
> +++ b/drivers/net/ll_temac_main.c
> @@ -193,6 +193,35 @@ static int temac_dcr_setup(struct temac_local *lp, struct of_device *op,
>  #endif
>  
>  /**
> + *  * temac_dma_bd_release - Release buffer descriptor rings
> + */
> +static void temac_dma_bd_release(struct net_device *ndev)
> +{
> +	struct temac_local *lp = netdev_priv(ndev);
> +	int i;
> +
> +	for (i = 0; i < RX_BD_NUM; i++) {
> +		if (!lp->rx_skb[i])
> +			break;
> +		else {
> +			dma_unmap_single(ndev->dev.parent, lp->rx_bd_v[i].phys,
> +					XTE_MAX_JUMBO_FRAME_SIZE, DMA_FROM_DEVICE);
> +			dev_kfree_skb(lp->rx_skb[i]);
> +		}
> +	}
This cycle is needed only if (lp->rx_skb != NULL).

> +	if (lp->rx_bd_v)
> +		dma_free_coherent(ndev->dev.parent,
> +				sizeof(*lp->rx_bd_v) * RX_BD_NUM,
> +				lp->rx_bd_v, lp->rx_bd_p);
> +	if (lp->tx_bd_v)
> +		dma_free_coherent(ndev->dev.parent,
> +				sizeof(*lp->tx_bd_v) * TX_BD_NUM,
> +				lp->tx_bd_v, lp->tx_bd_p);
After temac_dma_bd_release() lp->rx_bd_v and lp->rx_bd_p are freed but
are nonzero. If lp->rx_skb allocation fails second time then these DMA's
would be freed second time.
lp->tx_bd_v = lp->rx_bd_v = NULL here fixes this.

> +	if (lp->rx_skb)
> +		kfree(lp->rx_skb);
> +}
> +
> +/**
>   * temac_dma_bd_init - Setup buffer descriptor rings
>   */
>  static int temac_dma_bd_init(struct net_device *ndev)
> @@ -275,6 +304,7 @@ static int temac_dma_bd_init(struct net_device *ndev)
>  	return 0;
>  
>  out:
> +	temac_dma_bd_release(ndev);
>  	return -ENOMEM;
>  }
>  
> @@ -858,6 +888,8 @@ static int temac_stop(struct net_device *ndev)
>  		phy_disconnect(lp->phy_dev);
>  	lp->phy_dev = NULL;
>  
> +	temac_dma_bd_release(ndev);
> +
>  	return 0;
>  }
>  

^ permalink raw reply

* Re: [PATCH v4 1/9] atm: propagate signal changes via notifier
From: Simon Horman @ 2010-07-09 12:22 UTC (permalink / raw)
  To: chas williams - CONTRACTOR; +Cc: David Miller, karl, linux-atm-general, netdev
In-Reply-To: <20100709071610.42473d6c@thirdoffive.cmf.nrl.navy.mil>

On Fri, Jul 09, 2010 at 07:16:10AM -0400, chas williams - CONTRACTOR wrote:
> On Thu, 08 Jul 2010 21:47:45 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
> > From: Karl Hiramoto <karl@hiramoto.org>
> > Date: Thu,  8 Jul 2010 10:34:47 +0200
> > 
> > /* Like
> >  * this.
> >  */
> > 
> > not:
> > 
> > /*
> >  * Like
> >  * this.
> >  */
> > 
> > Honestly, I don't know how I can be more clear about this :-)
> 
> this is somewhat contrary to the suggested multi-line format given in
> Documentation/CodingStyle:
> 
> 
> The preferred style for long (multi-line) comments is:
> 
>         /*
>          * This is the preferred style for multi-line
>          * comments in the Linux kernel source code.
>          * Please use it consistently.
>          *
>          * Description:  A column of asterisks on the left side,
>          * with beginning and ending almost-blank lines.
>          */

This is a topic that seems to come up every now and again.
I think that the reality of the situation is that there
are several acceptable styles and some maintainers prefer
one over the other, some more strongly than others.

So I think that documentation is slightly misleading
though it is certainly true for many maintainers.


^ permalink raw reply

* [PATCH 1/2] 82596: do not panic on out of memory
From: Kulikov Vasiliy @ 2010-07-09 12:25 UTC (permalink / raw)
  To: kernel-janitors
  Cc: David S. Miller, Jiri Pirko, Stephen Hemminger, Eric Dumazet,
	André Goddard Rosa, netdev

If dev_alloc_skb() failed then free already allocated skbs.
remove_rx_bufs() can be called multiple times, so set rbd->skb to NULL
to avoid double free. remove_rx_bufs() was moved upwards to be seen by
init_rx_bufs().

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/net/82596.c |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index dd8dc15..73073d0 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -525,7 +525,21 @@ static irqreturn_t i596_error(int irq, void *dev_id)
 }
 #endif
 
-static inline void init_rx_bufs(struct net_device *dev)
+static inline void remove_rx_bufs(struct net_device *dev)
+{
+	struct i596_private *lp = dev->ml_priv;
+	struct i596_rbd *rbd;
+	int i;
+
+	for (i = 0, rbd = lp->rbds; i < rx_ring_size; i++, rbd++) {
+		if (rbd->skb == NULL)
+			break;
+		dev_kfree_skb(rbd->skb);
+		rbd->skb = NULL;
+	}
+}
+
+static inline int init_rx_bufs(struct net_device *dev)
 {
 	struct i596_private *lp = dev->ml_priv;
 	int i;
@@ -537,8 +551,11 @@ static inline void init_rx_bufs(struct net_device *dev)
 	for (i = 0, rbd = lp->rbds; i < rx_ring_size; i++, rbd++) {
 		struct sk_buff *skb = dev_alloc_skb(PKT_BUF_SZ);
 
-		if (skb == NULL)
-			panic("82596: alloc_skb() failed");
+		if (skb == NULL) {
+			remove_rx_bufs(dev);
+			return -ENOMEM;
+		}
+
 		skb->dev = dev;
 		rbd->v_next = rbd+1;
 		rbd->b_next = WSWAPrbd(virt_to_bus(rbd+1));
@@ -574,19 +591,8 @@ static inline void init_rx_bufs(struct net_device *dev)
 	rfd->v_next = lp->rfds;
 	rfd->b_next = WSWAPrfd(virt_to_bus(lp->rfds));
 	rfd->cmd = CMD_EOL|CMD_FLEX;
-}
-
-static inline void remove_rx_bufs(struct net_device *dev)
-{
-	struct i596_private *lp = dev->ml_priv;
-	struct i596_rbd *rbd;
-	int i;
 
-	for (i = 0, rbd = lp->rbds; i < rx_ring_size; i++, rbd++) {
-		if (rbd->skb == NULL)
-			break;
-		dev_kfree_skb(rbd->skb);
-	}
+	return 0;
 }
 
 
@@ -1013,7 +1019,11 @@ static int i596_open(struct net_device *dev)
 			return -EAGAIN;
 	}
 #endif
-	init_rx_bufs(dev);
+	res = init_rx_bufs(dev);
+	if (res) {
+		free_irq(dev->irq, dev);
+		return res;
+	}
 
 	netif_start_queue(dev);
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 2/2] 82596: free resources on error
From: Kulikov Vasiliy @ 2010-07-09 12:25 UTC (permalink / raw)
  To: kernel-janitors
  Cc: David S. Miller, Jiri Pirko, Stephen Hemminger, Eric Dumazet,
	André Goddard Rosa, netdev

IRQ 56 was not freed anywhere (neither in i596_open() on error nor in
i596_close()), rx_bufs were not freed if init_i596_mem() fails,
netif_stop_queue() was not called.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/net/82596.c |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index 73073d0..89e43d7 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1015,24 +1015,35 @@ static int i596_open(struct net_device *dev)
 	}
 #ifdef ENABLE_MVME16x_NET
 	if (MACH_IS_MVME16x) {
-		if (request_irq(0x56, i596_error, 0, "i82596_error", dev))
-			return -EAGAIN;
+		if (request_irq(0x56, i596_error, 0, "i82596_error", dev)) {
+			res = -EAGAIN;
+			goto err_irq_dev;
+		}
 	}
 #endif
 	res = init_rx_bufs(dev);
-	if (res) {
-		free_irq(dev->irq, dev);
-		return res;
-	}
+	if (res)
+		goto err_irq_56;
 
 	netif_start_queue(dev);
 
-	/* Initialize the 82596 memory */
 	if (init_i596_mem(dev)) {
 		res = -EAGAIN;
-		free_irq(dev->irq, dev);
+		goto err_queue;
 	}
 
+	return 0;
+
+err_queue:
+	netif_stop_queue(dev);
+	remove_rx_bufs(dev);
+err_irq_56:
+#ifdef ENABLE_MVME16x_NET
+	free_irq(0x56, dev);
+#endif
+err_irq_dev:
+	free_irq(dev->irq, dev);
+
 	return res;
 }
 
@@ -1498,6 +1509,9 @@ static int i596_close(struct net_device *dev)
 	}
 #endif
 
+#ifdef ENABLE_MVME16x_NET
+	free_irq(0x56, dev);
+#endif
 	free_irq(dev->irq, dev);
 	remove_rx_bufs(dev);
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH] ac3200: fix error path
From: Kulikov Vasiliy @ 2010-07-09 12:28 UTC (permalink / raw)
  To: kernel-janitors; +Cc: David S. Miller, Joe Perches, netdev

Do not call free_irq() if request_irq() failed.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/net/ac3200.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ac3200.c b/drivers/net/ac3200.c
index b9115a7..5181e93 100644
--- a/drivers/net/ac3200.c
+++ b/drivers/net/ac3200.c
@@ -211,7 +211,7 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
 	retval = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev);
 	if (retval) {
 		printk (" nothing! Unable to get IRQ %d.\n", dev->irq);
-		goto out1;
+		goto out;
 	}
 
 	printk(" IRQ %d, %s port\n", dev->irq, port_name[dev->if_port]);
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH] at1700: fix double free_irq
From: Kulikov Vasiliy @ 2010-07-09 12:31 UTC (permalink / raw)
  To: kernel-janitors
  Cc: David S. Miller, Jiri Pirko, Joe Perches, Stephen Hemminger,
	Eric Dumazet, netdev

free_irq() is called both in net_close() and cleanup_card().  Since it
is requested in at1700_probe1(), leave free_irq() only in cleanup_card()
for balance.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/net/at1700.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/net/at1700.c b/drivers/net/at1700.c
index 93185f5..8987689 100644
--- a/drivers/net/at1700.c
+++ b/drivers/net/at1700.c
@@ -811,10 +811,8 @@ static int net_close(struct net_device *dev)
 	/* No statistic counters on the chip to update. */
 
 	/* Disable the IRQ on boards of fmv18x where it is feasible. */
-	if (lp->jumpered) {
+	if (lp->jumpered)
 		outb(0x00, ioaddr + IOCONFIG1);
-		free_irq(dev->irq, dev);
-	}
 
 	/* Power-down the chip.  Green, green, green! */
 	outb(0x00, ioaddr + CONFIG_1);
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH] depca: fix leaks
From: Kulikov Vasiliy @ 2010-07-09 12:36 UTC (permalink / raw)
  To: kernel-janitors
  Cc: David S. Miller, Jiri Pirko, Joe Perches, Stephen Hemminger,
	Eric Dumazet, netdev

Since some of xxx_register_driver() can return error we must continue
with already registered drivers. If any of xxx_register_driver()
succeeded or depca_platform_probe() found any device then
depca_module_init() returns ok. In depca_module_exit() we must
unregister only registered drivers.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 drivers/net/depca.c |   93 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 70 insertions(+), 23 deletions(-)

diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index bf66e9b..4f43e12 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -551,6 +551,15 @@ static int io;
 static char *adapter_name;
 static int mem;			/* For loadable module assignment
 				   use insmod mem=0x????? .... */
+
+#ifdef CONFIG_MCA
+static int is_mca_registered;
+#endif
+#ifdef CONFIG_EISA
+static int is_eisa_registered;
+#endif
+static int is_platform_registered;
+
 module_param (irq, int, 0);
 module_param (io, int, 0);
 module_param (adapter_name, charp, 0);
@@ -1457,9 +1466,9 @@ static int __init depca_mca_probe(struct device *device)
 ** ISA bus I/O device probe
 */
 
-static void __init depca_platform_probe (void)
+static int __init depca_platform_probe(void)
 {
-	int i;
+	int i, n = 0;
 	struct platform_device *pldev;
 
 	for (i = 0; depca_io_ports[i].iobase; i++) {
@@ -1493,8 +1502,10 @@ static void __init depca_platform_probe (void)
 			depca_io_ports[i].device = NULL;
 			pldev->dev.platform_data = NULL;
 			platform_device_unregister (pldev);
-		}
+		} else
+			n++;
 	}
+	return n;
 }
 
 static enum depca_type __init depca_shmem_probe (ulong *mem_start)
@@ -2059,32 +2070,19 @@ static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return status;
 }
 
-static int __init depca_module_init (void)
-{
-        int err = 0;
-
-#ifdef CONFIG_MCA
-        err = mca_register_driver (&depca_mca_driver);
-#endif
-#ifdef CONFIG_EISA
-        err |= eisa_driver_register (&depca_eisa_driver);
-#endif
-	err |= platform_driver_register (&depca_isa_driver);
-	depca_platform_probe ();
-
-        return err;
-}
-
-static void __exit depca_module_exit (void)
+static void depca_unregister(void)
 {
 	int i;
 #ifdef CONFIG_MCA
-        mca_unregister_driver (&depca_mca_driver);
+	if (is_mca_registered)
+		mca_unregister_driver(&depca_mca_driver);
 #endif
 #ifdef CONFIG_EISA
-        eisa_driver_unregister (&depca_eisa_driver);
+	if (is_eisa_registered)
+		eisa_driver_unregister(&depca_eisa_driver);
 #endif
-	platform_driver_unregister (&depca_isa_driver);
+	if (is_platform_registered)
+		platform_driver_unregister(&depca_isa_driver);
 
 	for (i = 0; depca_io_ports[i].iobase; i++) {
 		if (depca_io_ports[i].device) {
@@ -2095,5 +2093,54 @@ static void __exit depca_module_exit (void)
 	}
 }
 
+static int __init depca_module_init(void)
+{
+	int any = 0;
+	int platform_err = 0, err = 0;
+
+#ifdef CONFIG_MCA
+	{
+		int mca_err = 0;
+		mca_err = mca_register_driver(&depca_mca_driver);
+		if (!mca_err) {
+			any = 1;
+			is_mca_registered = 1;
+		} else
+			err = mca_err;
+	}
+#endif
+#ifdef CONFIG_EISA
+	{
+		int eisa_err = 0;
+		eisa_err = eisa_driver_register(&depca_eisa_driver);
+		if (!eisa_err) {
+			any = 1;
+			is_eisa_registered = 1;
+		} else
+			err = eisa_err;
+	}
+#endif
+	platform_err = platform_driver_register(&depca_isa_driver);
+	if (!platform_err) {
+		any = 1;
+		is_platform_registered = 1;
+	} else
+		err = platform_err;
+
+	if (depca_platform_probe())
+		any = 1;
+
+	if (any)
+		err = 0;
+	else if (err)
+		depca_unregister();
+	return err;
+}
+
+static void __exit depca_module_exit(void)
+{
+	depca_unregister();
+}
+
 module_init (depca_module_init);
 module_exit (depca_module_exit);
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH 1/1] Bluetooth: hidp: Add support for hidraw   HIDIOCGFEATURE   and HIDIOCSFEATURE
From: Alan Ott @ 2010-07-09 13:02 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: David S Miller, Jiri Kosina, Michael Poole, Bastien Nocera,
	Eric Dumazet, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1278662497.10421.94.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

On 07/09/2010 04:01 AM, Marcel Holtmann wrote:
> Hi Alan,
>
>    
>>> I looked at this and I am bit worried that this should not be done in
>>> this detail in the HIDP driver. Essentially HIDP is a pure transport
>>> driver. It should not handle all these details. Can we make this a bit
>>> easier for the transport drivers to support such features?
>>>        
>> I put these changes (most notably the addition of hidp_get_raw_report())
>> in hidp because that's where the parallel function
>> hidp_output_raw_report() was already located. I figured the input should
>> go with the output. That said, if there's a better place for both of
>> them (input and output) to go, let me know where you think it should be,
>> and I'll get them moved into the proper spot.
>>
>> I'm not sure what you mean about HIDP being a pure transport driver.
>>      
> what is usb-hid.ko doing here? I would expect a bunch of code
> duplication with minor difference between USB and Bluetooth.
>
> Regards
>
> Marcel
>    

Hi Marcel,

usbhid doesn't have a lot of code for hidraw. Two functions are involved:
     usbhid_output_raw_report()
         - calls usb_control_msg() with Get_Report
     usbhid_get_raw_report()
         - calls usb_control_msg() with Set_Report
             OR
         - calls usb_interrupt_msg() on the Ouput pipe.

This is of course easier than bluetooth because usb_control_msg() is 
synchronous, even when requesting reports, mostly because of the nature 
of USB, where the request and response are part of the same transfer.

For Bluetooth, it's a bit more complicated since the kernel treats it 
more like a networking interface (and indeed it is). My understanding is 
that to make a synchronous transfer in bluetooth, one must:
     - send the request packet
     - block (wait_event_*())
     - when the response is received in the input handler, wake_up_*().

There's not really any code duplication, mostly because initiating 
synchronous USB transfers (input and output) is easy (because of the 
usb_*_msg() functions), while making synchronous Bluetooth transfers 
must be done manually. If there's a nice, convenient, synchronous 
function in Bluetooth similar to usb_control_msg() that I've missed, 
then let me know, as it would simplify this whole thing.

See the Set/Get Feature patch, including USB support, here:
     http://lkml.org/lkml/2010/6/9/222

Alan.

^ permalink raw reply

* Re: [PATCH 1/1] Bluetooth: hidp: Add support for hidraw   HIDIOCGFEATURE   and HIDIOCSFEATURE
From: Marcel Holtmann @ 2010-07-09 13:06 UTC (permalink / raw)
  To: Alan Ott
  Cc: David S Miller, Jiri Kosina, Michael Poole, Bastien Nocera,
	Eric Dumazet, linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <4C371DE8.9020002-yzvJWuRpmD1zbRFIqnYvSA@public.gmane.org>

Hi Alan,

> >>> I looked at this and I am bit worried that this should not be done in
> >>> this detail in the HIDP driver. Essentially HIDP is a pure transport
> >>> driver. It should not handle all these details. Can we make this a bit
> >>> easier for the transport drivers to support such features?
> >>>        
> >> I put these changes (most notably the addition of hidp_get_raw_report())
> >> in hidp because that's where the parallel function
> >> hidp_output_raw_report() was already located. I figured the input should
> >> go with the output. That said, if there's a better place for both of
> >> them (input and output) to go, let me know where you think it should be,
> >> and I'll get them moved into the proper spot.
> >>
> >> I'm not sure what you mean about HIDP being a pure transport driver.
> >>      
> > what is usb-hid.ko doing here? I would expect a bunch of code
> > duplication with minor difference between USB and Bluetooth.
>
> usbhid doesn't have a lot of code for hidraw. Two functions are involved:
>      usbhid_output_raw_report()
>          - calls usb_control_msg() with Get_Report
>      usbhid_get_raw_report()
>          - calls usb_control_msg() with Set_Report
>              OR
>          - calls usb_interrupt_msg() on the Ouput pipe.
> 
> This is of course easier than bluetooth because usb_control_msg() is 
> synchronous, even when requesting reports, mostly because of the nature 
> of USB, where the request and response are part of the same transfer.
> 
> For Bluetooth, it's a bit more complicated since the kernel treats it 
> more like a networking interface (and indeed it is). My understanding is 
> that to make a synchronous transfer in bluetooth, one must:
>      - send the request packet
>      - block (wait_event_*())
>      - when the response is received in the input handler, wake_up_*().
> 
> There's not really any code duplication, mostly because initiating 
> synchronous USB transfers (input and output) is easy (because of the 
> usb_*_msg() functions), while making synchronous Bluetooth transfers 
> must be done manually. If there's a nice, convenient, synchronous 
> function in Bluetooth similar to usb_control_msg() that I've missed, 
> then let me know, as it would simplify this whole thing.

there is not and I don't think we ever get one. My question here was
more in the direction why HID core is doing these synchronously in the
first place. Especially since USB can do everything async as well.

Regards

Marcel

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox