* [PATCH 16/16] wl1251: Add sysfs file address for setting permanent mac address
From: Pali Rohár @ 2013-10-26 20:34 UTC (permalink / raw)
To: Luciano Coelho, John W. Linville, Johannes Berg, David S. Miller
Cc: linux-wireless, netdev, linux-kernel, freemangordon,
aaro.koskinen, pavel, sre, joni.lapilainen, pali.rohar
In-Reply-To: <1382819655-30430-1-git-send-email-pali.rohar@gmail.com>
Driver wl1251 generating mac address randomly at startup and there is no way to
set permanent mac address via SET_IEEE80211_PERM_ADDR. This patch export sysfs
file which can set permanent mac address by userspace helper program. Patch is
needed for devices which do not store mac address in internal wl1251 eeprom.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/net/wireless/ti/wl1251/main.c | 52 +++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index 29625c2..91a009c 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1375,6 +1375,46 @@ static const struct ieee80211_ops wl1251_ops = {
.get_survey = wl1251_op_get_survey,
};
+static ssize_t wl1251_sysfs_show_address(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct wl1251 *wl = dev_get_drvdata(dev);
+ ssize_t len;
+
+ /* FIXME: what's the maximum length of buf? page size?*/
+ len = 500;
+
+ len = snprintf(buf, len, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+ wl->mac_addr[0], wl->mac_addr[1], wl->mac_addr[2],
+ wl->mac_addr[3], wl->mac_addr[4], wl->mac_addr[5]);
+
+ return len;
+}
+
+static ssize_t wl1251_sysfs_store_address(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct wl1251 *wl = dev_get_drvdata(dev);
+ unsigned int addr[6];
+ int ret, i;
+
+ ret = sscanf(buf, "%2x:%2x:%2x:%2x:%2x:%2x\n",
+ &addr[0], &addr[1], &addr[2],
+ &addr[3], &addr[4], &addr[5]);
+
+ if (ret != 6)
+ return -EINVAL;
+
+ for (i = 0; i < 6; i++)
+ wl->mac_addr[i] = addr[i] & 0xff;
+
+ SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr);
+
+ return count;
+}
+
static ssize_t wl1251_sysfs_show_tx_mgmt_frm_rate(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -1584,6 +1624,10 @@ out:
return count;
}
+static DEVICE_ATTR(address, S_IRUGO | S_IWUSR,
+ wl1251_sysfs_show_address,
+ wl1251_sysfs_store_address);
+
static DEVICE_ATTR(tx_mgmt_frm_rate, S_IRUGO | S_IWUSR,
wl1251_sysfs_show_tx_mgmt_frm_rate,
wl1251_sysfs_store_tx_mgmt_frm_rate);
@@ -1728,6 +1772,14 @@ int wl1251_init_ieee80211(struct wl1251 *wl)
}
dev_set_drvdata(&wl1251_device.dev, wl);
+ /* Create sysfs file address */
+ ret = device_create_file(&wl1251_device.dev,
+ &dev_attr_address);
+ if (ret < 0) {
+ wl1251_error("failed to create sysfs file address");
+ goto out;
+ }
+
/* Create sysfs file tx_mgmt_frm_rate */
ret = device_create_file(&wl1251_device.dev,
&dev_attr_tx_mgmt_frm_rate);
--
1.7.10.4
^ permalink raw reply related
* Re: [gpio:for-next 67/67] pch_gbe_main.c:undefined reference to `devm_gpio_request_one'
From: Darren Hart @ 2013-10-26 21:15 UTC (permalink / raw)
To: David Cohen
Cc: Linus Walleij, David S. Miller, netdev@vger.kernel.org,
Fengguang Wu, Alexandre Courbot, linux-gpio@vger.kernel.org
In-Reply-To: <1382819615.23829.16.camel@dvhart-mobl4.amr.corp.intel.com>
On Sat, 2013-10-26 at 21:33 +0100, Darren Hart wrote:
> On Fri, 2013-10-25 at 14:25 -0700, David Cohen wrote:
> > On 10/25/2013 02:21 PM, David Cohen wrote:
> > > Hi Linus,
> > >
> > > On 10/25/2013 03:49 AM, Linus Walleij wrote:
> > >> On Fri, Oct 25, 2013 at 12:41 PM, Linus Walleij
> > >> <linus.walleij@linaro.org> wrote:
> > >>
> > >>>> I wouldn't object to adding a dependency to GPIO_PCH and GPIOLIB
> > >>>> unconditionally for PCH_GBE as GPIO_PCH is the same chip... but I don't
> > >>>> know if David Miller would be amenable to that.
> > >>>
> > >>> Well we should probably just stick a dependency to GPIOLIB in there.
> > >>>
> > >>> - It #includes <linux/gpio.h>
> > >>> - It uses gpiolib functions to do something vital
> > >>>
> > >>> It was just happy that dummy versions were slotted in until now.
> > >>
> > >> ...or maybe I'm just confused now?
> > >>
> > >> Should we just add a static inline stub of devm_gpio_request_one()?
> > >
> > > I am not familiar with the HW. But checking the code, platform
> > > initialization should fail with a dummy devm_gpio_request_one()
> > > implementation. IMO it makes more sense to depend on GPIOLIB.
> >
> > Actually, forget about it. Despite driver_data->platform_init() may
> > return error, probe() never checks for it. I think the driver must be
> > fixed, but in meanwhile a static inline stub seems reasonable.
> >
>
> Ah, that's a problem, and one I created :/ I'm traveling a bit through
> Europe atm for the conferences. I will try and have a look on the planes
> and add a check.
Ah, now I remember. The situation is this. If there is a cable plugged
into the jack, the PHY will not go to sleep. If there isn't, there is a
good chance it will go to sleep before the driver initializes. If it is
asleep, the scan for the PHY will fail. If it isn't, the scan will work
correctly and the device will be properly setup. The code currently
displays a dev error:
ret = devm_gpio_request_one(&pdev->dev, gpio, flags,
"minnow_phy_reset");
if (ret) {
dev_err(&pdev->dev,
"ERR: Can't request PHY reset GPIO line '%d'\n", gpio);
But deliberately does not about the probe because there is a chance
things will work just fine. If they do not, the PHY detection code will
print display errors about a failure to communicate over RGMII, and the
device probe will fail from there.
This still seems like the correct approach to me. Does anyone disagree?
(we still need to sort out the GPIOLIB and GPIO_SCH dependency though of
course)
Thanks,
--
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
^ permalink raw reply
* Re: [PATCH net-next 3/5] 6lowpan: use netdev_alloc_skb instead dev_alloc_skb
From: David Miller @ 2013-10-26 21:32 UTC (permalink / raw)
To: joe-6d6DIl74uiNBDgjK7y7TUQ
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <1382767304.5595.1.camel@joe-AO722>
From: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Date: Fri, 25 Oct 2013 23:01:44 -0700
> On Sat, 2013-10-26 at 01:42 -0400, David Miller wrote:
>> From: Alexander Aring <alex.aring-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> Date: Thu, 24 Oct 2013 22:51:42 +0200
>>
>> > @@ -1127,12 +1127,12 @@ lowpan_fragment_xmit(struct sk_buff *skb, u8 *head,
>> >
>> > lowpan_raw_dump_inline(__func__, "6lowpan fragment header", head, hlen);
>> >
>> > - frag = dev_alloc_skb(hlen + mlen + plen + IEEE802154_MFR_SIZE);
>> > + frag = netdev_alloc_skb(skb->dev, hlen + mlen +
>> > + plen + IEEE802154_MFR_SIZE);
>>
>> Please indent this properly.
>>
>> It should be something like:
>>
>> frag = netdev_alloc_skb(skb->dev, hlen + mlen +
>> plen + IEEE802154_MFR_SIZE);
>
> Maybe better as:
>
> frag = netdev_alloc_skb(skb->dev,
> hlen + mlen + plen + IEEE802154_MFR_SIZE);
Either is fine with me.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
^ permalink raw reply
* Re: [PATCH 1/3] vxlan: silence one build warning
From: Zhi Yong Wu @ 2013-10-27 2:30 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, linux-kernel mlist, Zhi Yong Wu
In-Reply-To: <20131026074819.6a5f4e24@samsung-9>
HI, Stephen
I saw it on Fedora 17 without latest kernel. Then what do you think
that it is appropriate to solve this problem? discard this patch? If
yes, i can also agree.
On Sat, Oct 26, 2013 at 10:48 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Sat, 26 Oct 2013 15:06:04 +0800
> Zhi Yong Wu <zwu.kernel@gmail.com> wrote:
>
>> On Fri, Oct 25, 2013 at 11:41 PM, Stephen Hemminger
>> <stephen@networkplumber.org> wrote:
>> > On Fri, 25 Oct 2013 15:49:18 +0800
>> > Zhi Yong Wu <zwu.kernel@gmail.com> wrote:
>> >
>> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >>
>> >> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
>> >> drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>> >> drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
>> >> LD drivers/net/built-in.o
>> >>
>> >> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >> ---
>> >> drivers/net/vxlan.c | 2 +-
>> >> 1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
>> >> index 2ef5b62..e15f1af 100644
>> >> --- a/drivers/net/vxlan.c
>> >> +++ b/drivers/net/vxlan.c
>> >> @@ -2272,7 +2272,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
>> >> {
>> >> struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>> >> struct vxlan_sock *vs;
>> >> - struct socket *sock;
>> >> + struct socket *sock = NULL;
>> >> struct sock *sk;
>> >> int rc = 0;
>> >> unsigned int h;
>> >
>> > This only happens with certain versions of Gcc which have buggy dependency
>> > analysis. It doesn't happen with Gcc 4.7, think it only shows up in 4.4.
>> > I would rather not fix the warning this way since it risks masking later bugs if this code ever changes.
>> Gcc version is 4.7.2 on my box, this warning took palce.
>> # gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> ...
>> gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
>>
>>
>
> I dont see it on Debian 7.
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/gcc-4.7.real
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.7.2 (Debian 4.7.2-5)
--
Regards,
Zhi Yong Wu
^ permalink raw reply
* Netem Delay Normal Distribution
From: anirup dutta @ 2013-10-27 2:31 UTC (permalink / raw)
To: netdev
Hello,
I try this on my device
sudo tc qdisc del dev eth0 root netem delay 100ms 20ms distribution normal
I use iperf for transmitting UDP packets and I modified its code to
get per packet delay. When I plot the distribution of delays and
analyze the delays they pass the normality tests.
The only problem that I am not able to understand is that the mean of
those delays shift to 125ms. Its not only me. There was another study
and it observed the same thing.
http://www.researchgate.net/publication/224256550_An_Empirical_Study_of_NetEm_Network_Emulation_Functionalities/file/d912f5058c9b1e409b.pdf
Figure 7
I found out that this command is valid
sudo tc qdisc del dev eth0 root netem delay 1ms 20ms distribution normal
So I have a feeling that mean gets shifted from the base delay to
avoid negative delay values.
It would be great if someone can confirm how it is implemented?
Regards,
Anirup
^ permalink raw reply
* Re: 16% regression on 10G caused by TCP small queues
From: Dave Taht @ 2013-10-27 4:33 UTC (permalink / raw)
To: David Miller; +Cc: stephen, ncardwell, eric.dumazet, netdev
In-Reply-To: <20131024.030121.477884925478012615.davem@davemloft.net>
On Thu, Oct 24, 2013 at 03:01:21AM -0400, David Miller wrote:
> From: Stephen Hemminger <stephen@networkplumber.org>
> Date: Wed, 23 Oct 2013 21:45:57 -0700
>
> > Sorry, thought sk_pacing_rate depended on FQ qdisc but it is other way around.
> > In which case doing merge of these two was sufficient to fix the problem.
> > With a minor manual fix up to tcp.h.
>
> I know, I already have a half-built tree of -stable submissions
> that does exactlty this.
I know that the "fq" qdisc is not exactly a -stable thing, but if it's simpler
to include it rather than sort through the patch sets, I'm all for it.
^ permalink raw reply
* Re: 16% regression on 10G caused by TCP small queues
From: David Miller @ 2013-10-27 5:07 UTC (permalink / raw)
To: dave.taht; +Cc: stephen, ncardwell, eric.dumazet, netdev
In-Reply-To: <20131027043351.GA27876@lists.bufferbloat.net>
From: Dave Taht <dave.taht@bufferbloat.net>
Date: Sat, 26 Oct 2013 21:33:52 -0700
> On Thu, Oct 24, 2013 at 03:01:21AM -0400, David Miller wrote:
>> From: Stephen Hemminger <stephen@networkplumber.org>
>> Date: Wed, 23 Oct 2013 21:45:57 -0700
>>
>> > Sorry, thought sk_pacing_rate depended on FQ qdisc but it is other way around.
>> > In which case doing merge of these two was sufficient to fix the problem.
>> > With a minor manual fix up to tcp.h.
>>
>> I know, I already have a half-built tree of -stable submissions
>> that does exactlty this.
>
> I know that the "fq" qdisc is not exactly a -stable thing, but if it's simpler
> to include it rather than sort through the patch sets, I'm all for it.
I'm not including 'fq' and it's absolutely not necessary to fix this
bug.
'fq' is only incidentary to this bug fix because it just so happens to
make use of sk->sk_pacing_rate. There is no other connection between
these two things.
^ permalink raw reply
* Re: [gpio:for-next 67/67] pch_gbe_main.c:undefined reference to `devm_gpio_request_one'
From: David Cohen @ 2013-10-27 5:31 UTC (permalink / raw)
To: Darren Hart
Cc: Linus Walleij, David S. Miller, netdev@vger.kernel.org,
Fengguang Wu, Alexandre Courbot, linux-gpio@vger.kernel.org
In-Reply-To: <1382822142.23829.46.camel@dvhart-mobl4.amr.corp.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2853 bytes --]
On 10/26/2013 02:15 PM, Darren Hart wrote:
> On Sat, 2013-10-26 at 21:33 +0100, Darren Hart wrote:
>> On Fri, 2013-10-25 at 14:25 -0700, David Cohen wrote:
>>> On 10/25/2013 02:21 PM, David Cohen wrote:
>>>> Hi Linus,
>>>>
>>>> On 10/25/2013 03:49 AM, Linus Walleij wrote:
>>>>> On Fri, Oct 25, 2013 at 12:41 PM, Linus Walleij
>>>>> <linus.walleij@linaro.org> wrote:
>>>>>
>>>>>>> I wouldn't object to adding a dependency to GPIO_PCH and GPIOLIB
>>>>>>> unconditionally for PCH_GBE as GPIO_PCH is the same chip... but I don't
>>>>>>> know if David Miller would be amenable to that.
>>>>>>
>>>>>> Well we should probably just stick a dependency to GPIOLIB in there.
>>>>>>
>>>>>> - It #includes <linux/gpio.h>
>>>>>> - It uses gpiolib functions to do something vital
>>>>>>
>>>>>> It was just happy that dummy versions were slotted in until now.
>>>>>
>>>>> ...or maybe I'm just confused now?
>>>>>
>>>>> Should we just add a static inline stub of devm_gpio_request_one()?
>>>>
>>>> I am not familiar with the HW. But checking the code, platform
>>>> initialization should fail with a dummy devm_gpio_request_one()
>>>> implementation. IMO it makes more sense to depend on GPIOLIB.
>>>
>>> Actually, forget about it. Despite driver_data->platform_init() may
>>> return error, probe() never checks for it. I think the driver must be
>>> fixed, but in meanwhile a static inline stub seems reasonable.
>>>
>>
>> Ah, that's a problem, and one I created :/ I'm traveling a bit through
>> Europe atm for the conferences. I will try and have a look on the planes
>> and add a check.
>
> Ah, now I remember. The situation is this. If there is a cable plugged
> into the jack, the PHY will not go to sleep. If there isn't, there is a
> good chance it will go to sleep before the driver initializes. If it is
> asleep, the scan for the PHY will fail. If it isn't, the scan will work
> correctly and the device will be properly setup. The code currently
> displays a dev error:
>
> ret = devm_gpio_request_one(&pdev->dev, gpio, flags,
> "minnow_phy_reset");
> if (ret) {
> dev_err(&pdev->dev,
> "ERR: Can't request PHY reset GPIO line '%d'\n", gpio);
>
> But deliberately does not about the probe because there is a chance
> things will work just fine. If they do not, the PHY detection code will
> print display errors about a failure to communicate over RGMII, and the
> device probe will fail from there.
>
> This still seems like the correct approach to me. Does anyone disagree?
Considering this scenario it seems to be correct. But if
devm_gpio_request_one() may fail for "unfriendly" reasons too, then
it's incomplete.
>
> (we still need to sort out the GPIOLIB and GPIO_SCH dependency though of
> course)
Maybe if GPIOLIB has the static inline stubs returning -ENODEV we could
use a patch similar to the one attached here.
Br, David
[-- Attachment #2: pch_gbe_main.patch --]
[-- Type: text/x-patch, Size: 1276 bytes --]
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
index 5a0f04c..4702876 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
@@ -2637,8 +2637,11 @@ static int pch_gbe_probe(struct pci_dev *pdev,
adapter->hw.back = adapter;
adapter->hw.reg = pcim_iomap_table(pdev)[PCH_GBE_PCI_BAR];
adapter->pdata = (struct pch_gbe_privdata *)pci_id->driver_data;
- if (adapter->pdata && adapter->pdata->platform_init)
- adapter->pdata->platform_init(pdev);
+ if (adapter->pdata && adapter->pdata->platform_init) {
+ ret = adapter->pdata->platform_init(pdev);
+ if (ret)
+ goto err_free_netdev;
+ }
adapter->ptp_pdev = pci_get_bus_and_slot(adapter->pdev->bus->number,
PCI_DEVFN(12, 4));
@@ -2740,9 +2743,9 @@ static int pch_gbe_minnow_platform_init(struct pci_dev *pdev)
ret = devm_gpio_request_one(&pdev->dev, gpio, flags,
"minnow_phy_reset");
if (ret) {
- dev_err(&pdev->dev,
- "ERR: Can't request PHY reset GPIO line '%d'\n", gpio);
- return ret;
+ dev_warn(&pdev->dev,
+ "ERR: Can't request PHY reset GPIO line '%d'\n", gpio);
+ return ret == -ENODEV ? ret : 0;
}
gpio_set_value(gpio, 0);
^ permalink raw reply related
* deadlock when unplugging rtl8192cu controller
From: Ilia Mirkin @ 2013-10-27 7:08 UTC (permalink / raw)
To: netdev
Hello,
I pulled the network controller out, after trying to down the
controller (which failed at the script level, I didn't investigate the
details). Here is the output from echo w > /proc/sysrq-trigger. It
seems like khubd is stuck in schedule while holding rtnl_lock, which
in turn hangs everything else. Apologies for the linewrapping below.
Any other information I should collect should this happen again?
Anything I can do short of rebooting to get things going again?
Bus 002 Device 005: ID 0bda:8176 Realtek Semiconductor Corp.
RTL8188CUS 802.11n WLAN Adapter
[103822.129461] usb 2-2: USB disconnect, device number 5
[103895.563068] SysRq : Show Blocked State
[103895.563072] task PC stack pid father
[103895.563082] khubd D ffff8801c8bf4138 3648 550 2 0x00000000
[103895.563086] ffff8801c818faf8 0000000000000046 ffff8801c818fa98
ffff8801c8925490
[103895.563089] ffff8801c818fb18 ffff8801c8bf3d80 ffff8801c818ffd8
ffff8801c818ffd8
[103895.563091] 0000000000013000 ffff8801c8bf3d80 ffff8801c8bf3d80
ffffffff81c872a0
[103895.563094] Call Trace:
[103895.563100] [<ffffffff816d1599>] schedule+0x64/0x66
[103895.563103] [<ffffffff816d1752>] schedule_preempt_disabled+0xe/0x10
[103895.563106] [<ffffffff816d0688>] __mutex_lock_slowpath+0x13d/0x193
[103895.563110] [<ffffffff81080303>] ? call_usermodehelper_setup+0x59/0x9c
[103895.563116] [<ffffffff816cfbc4>] mutex_lock+0x23/0x37
[103895.563120] [<ffffffff8153df7f>] rtnl_lock+0x15/0x17
[103895.563123] [<ffffffff81689c32>] ieee80211_unregister_hw+0x55/0x10a
[103895.563128] [<ffffffffa03c0b39>] rtl_usb_disconnect+0x47/0xcb [rtl_usb]
[103895.563132] [<ffffffff81418677>] usb_unbind_interface+0x69/0x144
[103895.563135] [<ffffffff813a2fa5>] __device_release_driver+0x89/0xdf
[103895.563137] [<ffffffff813a301e>] device_release_driver+0x23/0x30
[103895.563140] [<ffffffff813a2b2c>] bus_remove_device+0xe9/0xfe
[103895.563142] [<ffffffff813a03a1>] device_del+0x130/0x18a
[103895.563145] [<ffffffff81416817>] usb_disable_device+0x77/0x197
[103895.563149] [<ffffffff8140f93f>] usb_disconnect+0x91/0x15e
[103895.563151] [<ffffffff814110de>] hub_thread+0x652/0xf15
[103895.563154] [<ffffffff8108928f>] ? add_wait_queue+0x49/0x49
[103895.563156] [<ffffffff81410a8c>] ? hub_port_debounce+0xbf/0xbf
[103895.563159] [<ffffffff81410a8c>] ? hub_port_debounce+0xbf/0xbf
[103895.563162] [<ffffffff810889df>] kthread+0x8d/0x95
[103895.563164] [<ffffffff81088952>] ? kthread_freezable_should_stop+0x43/0x43
[103895.563168] [<ffffffff816d901c>] ret_from_fork+0x7c/0xb0
[103895.563170] [<ffffffff81088952>] ? kthread_freezable_should_stop+0x43/0x43
[103895.563194] ntpd D ffff8801c82c5ff8 4864 3211 1 0x00000004
[103895.563197] ffff8801b8d8fcb8 0000000000000082 ffff8801b8d8fc78
ffff8801c8924ce0
[103895.563200] 000000000000d0a0 ffff8801c82c5c40 ffff8801b8d8ffd8
ffff8801b8d8ffd8
[103895.563202] 0000000000013000 ffff8801c82c5c40 ffff8801c085f400
ffffffff81c872a0
[103895.563205] Call Trace:
[103895.563207] [<ffffffff816d1599>] schedule+0x64/0x66
[103895.563210] [<ffffffff816d1752>] schedule_preempt_disabled+0xe/0x10
[103895.563212] [<ffffffff816d0688>] __mutex_lock_slowpath+0x13d/0x193
[103895.563214] [<ffffffff816cfbc4>] mutex_lock+0x23/0x37
[103895.563217] [<ffffffff81079e06>] ? dequeue_signal+0x113/0x122
[103895.563219] [<ffffffff8153df7f>] rtnl_lock+0x15/0x17
[103895.563222] [<ffffffff81541960>] dev_ioctl+0x30/0x620
[103895.563225] [<ffffffff8108fb4a>] ? should_resched+0x9/0x28
[103895.563227] [<ffffffff816d12dc>] ? _cond_resched+0xe/0x22
[103895.563230] [<ffffffff8113a275>] ? kmem_cache_alloc+0x31/0xfe
[103895.563234] [<ffffffff8151dda4>] sock_do_ioctl+0x3b/0x46
[103895.563236] [<ffffffff8151e1f2>] sock_ioctl+0x201/0x20e
[103895.563240] [<ffffffff8114fc1f>] do_vfs_ioctl+0x407/0x448
[103895.563243] [<ffffffff8114339f>] ? alloc_file+0x1e/0xc4
[103895.563245] [<ffffffff816d2193>] ? _raw_spin_lock+0xe/0x10
[103895.563248] [<ffffffff8114fcac>] SyS_ioctl+0x4c/0x70
[103895.563250] [<ffffffff816d90c6>] system_call_fastpath+0x1a/0x1f
[103895.563275] ip D ffff880070d8e7a8 5968 14224 14183 0x00000004
[103895.563278] ffff880077ad9b28 0000000000000086 0000000000000000
ffff8801c826eba0
[103895.563280] 0000000000000000 ffff880070d8e3f0 ffff880077ad9fd8
ffff880077ad9fd8
[103895.563283] 0000000000013000 ffff880070d8e3f0 ffffffff8108ac3a
ffffffff81c872a0
[103895.563285] Call Trace:
[103895.563288] [<ffffffff8108ac3a>] ? need_resched+0x11/0x1d
[103895.563291] [<ffffffff816d1599>] schedule+0x64/0x66
[103895.563293] [<ffffffff816d1752>] schedule_preempt_disabled+0xe/0x10
[103895.563295] [<ffffffff816d0688>] __mutex_lock_slowpath+0x13d/0x193
[103895.563298] [<ffffffff816cfbc4>] mutex_lock+0x23/0x37
[103895.563301] [<ffffffff81527679>] ? __kmalloc_reserve.isra.47+0x2d/0x6d
[103895.563303] [<ffffffff8153df7f>] rtnl_lock+0x15/0x17
[103895.563306] [<ffffffff8153df97>] rtnetlink_rcv+0x16/0x2d
[103895.563309] [<ffffffff8156d56c>] netlink_unicast+0xeb/0x16d
[103895.563312] [<ffffffff8156d8c7>] netlink_sendmsg+0x2d9/0x31a
[103895.563314] [<ffffffff8151fc08>] sock_sendmsg+0x69/0x8a
[103895.563318] [<ffffffff81157665>] ? fget_light+0x38/0x88
[103895.563320] [<ffffffff8152032b>] SYSC_sendto+0xeb/0x110
[103895.563323] [<ffffffff8151f227>] ? move_addr_to_user+0x73/0x96
[103895.563325] [<ffffffff8151f560>] ? SYSC_getsockname+0x74/0x86
[103895.563328] [<ffffffff81520780>] SyS_sendto+0xe/0x10
[103895.563330] [<ffffffff816d90c6>] system_call_fastpath+0x1a/0x1f
[103895.563332] ifconfig D ffff8801b60d5848 5968 14237 3184 0x00000004
[103895.563335] ffff88007b5d1cb8 0000000000000086 0000000000000202
ffff8801bec307b0
[103895.563338] 0000000000000010 ffff8801b60d5490 ffff88007b5d1fd8
ffff88007b5d1fd8
[103895.563340] 0000000000013000 ffff8801b60d5490 ffffffff81c872a0
ffffffff81c872a0
[103895.563342] Call Trace:
[103895.563345] [<ffffffff816d1599>] schedule+0x64/0x66
[103895.563347] [<ffffffff816d1752>] schedule_preempt_disabled+0xe/0x10
[103895.563349] [<ffffffff816d0688>] __mutex_lock_slowpath+0x13d/0x193
[103895.563352] [<ffffffff816cfbc4>] mutex_lock+0x23/0x37
[103895.563354] [<ffffffff8153df7f>] rtnl_lock+0x15/0x17
[103895.563356] [<ffffffff81541960>] dev_ioctl+0x30/0x620
[103895.563360] [<ffffffff811232cf>] ? handle_mm_fault+0x1bd/0x1d7
[103895.563362] [<ffffffff8151dda4>] sock_do_ioctl+0x3b/0x46
[103895.563364] [<ffffffff8151e1f2>] sock_ioctl+0x201/0x20e
[103895.563367] [<ffffffff8114fc1f>] do_vfs_ioctl+0x407/0x448
[103895.563369] [<ffffffff8114fcac>] SyS_ioctl+0x4c/0x70
[103895.563372] [<ffffffff816d90c6>] system_call_fastpath+0x1a/0x1f
^ permalink raw reply
* [PATCH net 0/2] bnx2x: Bug fixes patch series
From: Yuval Mintz @ 2013-10-27 11:06 UTC (permalink / raw)
To: davem, netdev; +Cc: dmitry, ariele, eilong
Hi Dave,
This series contains 2 unrelated fixes:
1. FW asserts during unload might be encountered if specific memory
allocations fail during load.
2. SR-IOV related, fixes a crash that will occour if the driver were to
be rmmoded and then re-probed while there are both assigned and unassigned
VFs originating from the same PF.
Please consider applying these patches to `net'.
Thanks,
Yuval Mintz
^ permalink raw reply
* [PATCH net 1/2] bnx2x: prevent FW assert on low mem during unload
From: Yuval Mintz @ 2013-10-27 11:07 UTC (permalink / raw)
To: davem, netdev; +Cc: dmitry, ariele, eilong, Yuval Mintz
In-Reply-To: <1382872021-1116-1-git-send-email-yuvalmin@broadcom.com>
From: Dmitry Kravkov <dmitry@broadcom.com>
Buffers for FW statistics were allocated at an inappropriate time; In a machine
where the driver encounters problems allocating all of its queues, the driver
would still create FW requests for the statistics of the non-existing queues.
The wrong order of memory allocation could lead to zeroed statistics messages
being sent, leading to fw assert in case function 0 was down.
This changes the order of allocations, guaranteeing that statistic requests will
only be generated for actual queues.
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 4ab4c89..74d6486 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2545,10 +2545,6 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
}
}
- /* Allocated memory for FW statistics */
- if (bnx2x_alloc_fw_stats_mem(bp))
- LOAD_ERROR_EXIT(bp, load_error0);
-
/* need to be done after alloc mem, since it's self adjusting to amount
* of memory available for RSS queues
*/
@@ -2558,6 +2554,10 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
LOAD_ERROR_EXIT(bp, load_error0);
}
+ /* Allocated memory for FW statistics */
+ if (bnx2x_alloc_fw_stats_mem(bp))
+ LOAD_ERROR_EXIT(bp, load_error0);
+
/* request pf to initialize status blocks */
if (IS_VF(bp)) {
rc = bnx2x_vfpf_init(bp);
@@ -2812,8 +2812,8 @@ load_error1:
if (IS_PF(bp))
bnx2x_clear_pf_load(bp);
load_error0:
- bnx2x_free_fp_mem(bp);
bnx2x_free_fw_stats_mem(bp);
+ bnx2x_free_fp_mem(bp);
bnx2x_free_mem(bp);
return rc;
--
1.8.1.227.g44fe835
^ permalink raw reply related
* [PATCH net 0/2] bnx2x: Bug fixes patch series
From: Yuval Mintz @ 2013-10-27 11:06 UTC (permalink / raw)
To: davem, netdev; +Cc: dmitry, ariele, eilong
Hi Dave,
This series contains 2 unrelated fixes:
1. FW asserts during unload might be encountered if specific memory
allocations fail during load.
2. SR-IOV related, fixes a crash that will occour if the driver were to
be rmmoded and then re-probed while there are both assigned and unassigned
VFs originating from the same PF.
Please consider applying these patches to `net'.
Thanks,
Yuval Mintz
^ permalink raw reply
* [PATCH net 2/2] bnx2x: Disable VF access on PF removal
From: Yuval Mintz @ 2013-10-27 11:07 UTC (permalink / raw)
To: davem, netdev; +Cc: dmitry, ariele, eilong, Yuval Mintz
In-Reply-To: <1382872021-1116-1-git-send-email-yuvalmin@broadcom.com>
From: Ariel Elior <ariele@broadcom.com>
When the bnx2x driver is rmmoded, if VFs of a given PF will be assigned
to a VM then that PF will be unable to call `pci_disable_sriov()'.
If for that same PF there would also exist unassigned VFs in the hypervisor,
the result will be that after the removal there will still be virtual PCI
functions on the hypervisor.
If the bnx2x module were to be re-inserted, the result will be that the VFs
on the hypervisor will be re-probed directly following the PF's probe, even
though that in regular loading flow sriov is only enabled once PF is loaded.
The probed VF will then try to access its bar, causing a PCI error as the HW
is not in a state enabling such a request.
This patch adds a missing disablement procedure to the PF's removal, one that
sets registers viewable to the VF to indicate that the VFs have no permission
to access the bar, thus resulting in probe errors instead of PCI errors.
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index bf08ad6..5e07efb 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -2018,6 +2018,8 @@ failed:
void bnx2x_iov_remove_one(struct bnx2x *bp)
{
+ int vf_idx;
+
/* if SRIOV is not enabled there's nothing to do */
if (!IS_SRIOV(bp))
return;
@@ -2026,6 +2028,18 @@ void bnx2x_iov_remove_one(struct bnx2x *bp)
pci_disable_sriov(bp->pdev);
DP(BNX2X_MSG_IOV, "sriov disabled\n");
+ /* disable access to all VFs */
+ for (vf_idx = 0; vf_idx < bp->vfdb->sriov.total; vf_idx++) {
+ bnx2x_pretend_func(bp,
+ HW_VF_HANDLE(bp,
+ bp->vfdb->sriov.first_vf_in_pf +
+ vf_idx));
+ DP(BNX2X_MSG_IOV, "disabling internal access for vf %d\n",
+ bp->vfdb->sriov.first_vf_in_pf + vf_idx);
+ bnx2x_vf_enable_internal(bp, 0);
+ bnx2x_pretend_func(bp, BP_ABS_FUNC(bp));
+ }
+
/* free vf database */
__bnx2x_iov_free_vfdb(bp);
}
@@ -3197,7 +3211,7 @@ int bnx2x_enable_sriov(struct bnx2x *bp)
* the "acquire" messages to appear on the VF PF channel.
*/
DP(BNX2X_MSG_IOV, "about to call enable sriov\n");
- pci_disable_sriov(bp->pdev);
+ bnx2x_disable_sriov(bp);
rc = pci_enable_sriov(bp->pdev, req_vfs);
if (rc) {
BNX2X_ERR("pci_enable_sriov failed with %d\n", rc);
--
1.8.1.227.g44fe835
^ permalink raw reply related
* [PATCH net] xen-netback: use jiffies_64 value to calculate credit timeout
From: Wei Liu @ 2013-10-27 11:11 UTC (permalink / raw)
To: xen-devel, netdev
Cc: david.vrabel, jbeulich, annie.li, Wei Liu, Ian Campbell,
Jason Luan
time_after_eq() only works if the delta is < MAX_ULONG/2.
For a 32bit Dom0, if netfront sends packets at a very low rate, the time
between subsequent calls to tx_credit_exceeded() may exceed MAX_ULONG/2
and the test for timer_after_eq() will be incorrect. Credit will not be
replenished and the guest may become unable to send packets (e.g., if
prior to the long gap, all credit was exhausted).
Use jiffies_64 variant to mitigate this problem for 32bit Dom0.
Suggested-by: Jan Beulich <jbeulich@suse.com>
Suggested-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jason Luan <jianhai.luan@oracle.com>
---
drivers/net/xen-netback/common.h | 1 +
drivers/net/xen-netback/interface.c | 4 ++--
drivers/net/xen-netback/netback.c | 13 ++++++-------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 5715318..400fea1 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -163,6 +163,7 @@ struct xenvif {
unsigned long credit_usec;
unsigned long remaining_credit;
struct timer_list credit_timeout;
+ u64 credit_window_start;
/* Statistics */
unsigned long rx_gso_checksum_fixup;
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index 01bb854..8c45b63 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -312,8 +312,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
vif->credit_bytes = vif->remaining_credit = ~0UL;
vif->credit_usec = 0UL;
init_timer(&vif->credit_timeout);
- /* Initialize 'expires' now: it's used to track the credit window. */
- vif->credit_timeout.expires = jiffies;
+ /* credit window is tracked in credit_window_start */
+ vif->credit_window_start = get_jiffies_64();
dev->netdev_ops = &xenvif_netdev_ops;
dev->hw_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index f3e591c..1bc0688 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1185,18 +1185,17 @@ out:
static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
{
- unsigned long now = jiffies;
- unsigned long next_credit =
- vif->credit_timeout.expires +
- msecs_to_jiffies(vif->credit_usec / 1000);
+ u64 now = get_jiffies_64();
+ u64 next_credit = vif->credit_window_start +
+ (u64)msecs_to_jiffies(vif->credit_usec / 1000);
/* Timer could already be pending in rare cases. */
if (timer_pending(&vif->credit_timeout))
return true;
/* Passed the point where we can replenish credit? */
- if (time_after_eq(now, next_credit)) {
- vif->credit_timeout.expires = now;
+ if (time_after_eq64(now, next_credit)) {
+ vif->credit_timeout.expires = (unsigned long)now;
tx_add_credit(vif);
}
@@ -1207,7 +1206,7 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
vif->credit_timeout.function =
tx_credit_callback;
mod_timer(&vif->credit_timeout,
- next_credit);
+ (unsigned long)next_credit);
return true;
}
--
1.7.10.4
^ permalink raw reply related
* Re: [patch net-next] ipv6: allow userspace to create address with IFLA_F_TEMPORARY flag
From: Jiri Pirko @ 2013-10-27 13:29 UTC (permalink / raw)
To: Vladislav Yasevich
Cc: netdev@vger.kernel.org, David Miller, kuznet, jmorris, yoshfuji,
kaber, thaller, Stephen Hemminger
In-Reply-To: <CAGCdqXHUW=RJf67qPXVRhPY__GAs02+G9mJV7agN5pDdfELXXA@mail.gmail.com>
Sat, Oct 26, 2013 at 01:05:34AM CEST, vyasevich@gmail.com wrote:
>On Thu, Oct 24, 2013 at 9:45 AM, Jiri Pirko <jiri@resnulli.us> wrote:
>> This is needed in order to implement userspace address configuration,
>> namely ip6-privacy (rfc4941) in NetworkManager.
>>
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>> ---
>> net/ipv6/addrconf.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
>> index cd3fb30..962c7c9 100644
>> --- a/net/ipv6/addrconf.c
>> +++ b/net/ipv6/addrconf.c
>> @@ -3715,7 +3715,8 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
>> return -ENODEV;
>>
>> /* We ignore other flags so far. */
>> - ifa_flags = ifm->ifa_flags & (IFA_F_NODAD | IFA_F_HOMEADDRESS);
>> + ifa_flags = ifm->ifa_flags & (IFA_F_NODAD | IFA_F_HOMEADDRESS |
>> + IFA_F_TEMPORARY);
>>
>> ifa = ipv6_get_ifaddr(net, pfx, dev, 1);
>> if (ifa == NULL) {
>> --
>> 1.8.3.1
>>
>
>Jiri
>
>So, is the idea behind this is that all of temp address management
>would be done in user space? If so, then you
>may have to verify that no-one sets the lifetime values on the prefix
>in your other patch. I am still trying to figure out
>why this would be needed.
The idea is to provide possibility to do address configuration not in
kernel but rather in userspace (as it is done for example in NetworkManager)
Maybe I'm missing something, but why is it problem to have the
possibility to set lifetime even for temporary prefix?
>
>Thanks
>-vlad
^ permalink raw reply
* [PATCH 0/2] net_sched: Remove broken tc actions
From: Eric W. Biederman @ 2013-10-27 13:40 UTC (permalink / raw)
To: David Miller; +Cc: netdev, alexander.h.duyck, jhs
While auditing the code to make certain it would be safe to enable the
user namespace root to use tc actions I stumbled on the strange fact
that two of the tc modules in the kernel have been broken for more
years than I care to think about.
In particular neither of these two modules implements the tc_action_ops
lookup method. Which means that in practice neither RTM_GETACTION nor
RTM_DELACTION work. And with RTM_DELACTION broken that looks like a
permanent leak of kernel memory to me.
A leak I am not happy at root having and certainly not something I want
to allow unprivileged users access to.
On the premise that 5+ years is too long to wait for someone to notice,
complain and get this code fixed let's just remove these broken tc
modules.
Eric W. Biederman (2):
net_sched: Remove broken act_skbedit
net_sched: Remove broken act_simple
include/net/tc_act/tc_defact.h | 14 --
include/net/tc_act/tc_skbedit.h | 36 -----
include/uapi/linux/tc_act/Kbuild | 2 -
include/uapi/linux/tc_act/tc_defact.h | 19 ---
include/uapi/linux/tc_act/tc_skbedit.h | 46 -------
net/sched/Kconfig | 25 ----
net/sched/Makefile | 2 -
net/sched/act_simple.c | 225 --------------------------------
net/sched/act_skbedit.c | 224 -------------------------------
9 files changed, 0 insertions(+), 593 deletions(-)
^ permalink raw reply
* [PATCH 1/2] net_sched: Remove broken act_skbedit
From: Eric W. Biederman @ 2013-10-27 13:42 UTC (permalink / raw)
To: David Miller; +Cc: netdev, alexander.h.duyck, jhs
In-Reply-To: <87fvrmu909.fsf@xmission.com>
While reading through the code I noticed that act_skbedit does not
implement a .lookup function in act_skbedit_ops.
In practice this means that RTM_GETACTION and RTM_DELACTION will
always fail for skbedit actions. This has been the case since at
least 2.6.12-rc1 well before this code was added. Which means in
practice this code does not work and has never worked.
Since the code has been in the tree and broken for 5 years and no
one has noticed it seems reasonable to delete the code.
Cc: alexander.h.duyck@intel.com
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
include/net/tc_act/tc_skbedit.h | 36 -----
include/uapi/linux/tc_act/Kbuild | 1 -
include/uapi/linux/tc_act/tc_skbedit.h | 46 -------
net/sched/Kconfig | 11 --
net/sched/Makefile | 1 -
net/sched/act_skbedit.c | 224 --------------------------------
6 files changed, 0 insertions(+), 319 deletions(-)
delete mode 100644 include/net/tc_act/tc_skbedit.h
delete mode 100644 include/uapi/linux/tc_act/tc_skbedit.h
delete mode 100644 net/sched/act_skbedit.c
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
deleted file mode 100644
index e103fe02f375..000000000000
--- a/include/net/tc_act/tc_skbedit.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2008, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Author: Alexander Duyck <alexander.h.duyck@intel.com>
- */
-
-#ifndef __NET_TC_SKBEDIT_H
-#define __NET_TC_SKBEDIT_H
-
-#include <net/act_api.h>
-
-struct tcf_skbedit {
- struct tcf_common common;
- u32 flags;
- u32 priority;
- u32 mark;
- u16 queue_mapping;
- /* XXX: 16-bit pad here? */
-};
-#define to_skbedit(pc) \
- container_of(pc, struct tcf_skbedit, common)
-
-#endif /* __NET_TC_SKBEDIT_H */
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index 56f121605c99..713b331d9df3 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -6,4 +6,3 @@ header-y += tc_ipt.h
header-y += tc_mirred.h
header-y += tc_nat.h
header-y += tc_pedit.h
-header-y += tc_skbedit.h
diff --git a/include/uapi/linux/tc_act/tc_skbedit.h b/include/uapi/linux/tc_act/tc_skbedit.h
deleted file mode 100644
index 7a2e910a5f08..000000000000
--- a/include/uapi/linux/tc_act/tc_skbedit.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2008, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Author: Alexander Duyck <alexander.h.duyck@intel.com>
- */
-
-#ifndef __LINUX_TC_SKBEDIT_H
-#define __LINUX_TC_SKBEDIT_H
-
-#include <linux/pkt_cls.h>
-
-#define TCA_ACT_SKBEDIT 11
-
-#define SKBEDIT_F_PRIORITY 0x1
-#define SKBEDIT_F_QUEUE_MAPPING 0x2
-#define SKBEDIT_F_MARK 0x4
-
-struct tc_skbedit {
- tc_gen;
-};
-
-enum {
- TCA_SKBEDIT_UNSPEC,
- TCA_SKBEDIT_TM,
- TCA_SKBEDIT_PARMS,
- TCA_SKBEDIT_PRIORITY,
- TCA_SKBEDIT_QUEUE_MAPPING,
- TCA_SKBEDIT_MARK,
- __TCA_SKBEDIT_MAX
-};
-#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
-
-#endif
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index c03a32a0418e..37af03bba732 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -632,17 +632,6 @@ config NET_ACT_SIMP
To compile this code as a module, choose M here: the
module will be called act_simple.
-config NET_ACT_SKBEDIT
- tristate "SKB Editing"
- depends on NET_CLS_ACT
- ---help---
- Say Y here to change skb priority or queue_mapping settings.
-
- If unsure, say N.
-
- To compile this code as a module, choose M here: the
- module will be called act_skbedit.
-
config NET_ACT_CSUM
tristate "Checksum Updating"
depends on NET_CLS_ACT && INET
diff --git a/net/sched/Makefile b/net/sched/Makefile
index e5f9abe9a5db..91e2acf15832 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -14,7 +14,6 @@ obj-$(CONFIG_NET_ACT_IPT) += act_ipt.o
obj-$(CONFIG_NET_ACT_NAT) += act_nat.o
obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit.o
obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o
-obj-$(CONFIG_NET_ACT_SKBEDIT) += act_skbedit.o
obj-$(CONFIG_NET_ACT_CSUM) += act_csum.o
obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o
obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
deleted file mode 100644
index cb4221171f93..000000000000
--- a/net/sched/act_skbedit.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (c) 2008, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
- * Author: Alexander Duyck <alexander.h.duyck@intel.com>
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
-#include <net/netlink.h>
-#include <net/pkt_sched.h>
-
-#include <linux/tc_act/tc_skbedit.h>
-#include <net/tc_act/tc_skbedit.h>
-
-#define SKBEDIT_TAB_MASK 15
-static struct tcf_common *tcf_skbedit_ht[SKBEDIT_TAB_MASK + 1];
-static u32 skbedit_idx_gen;
-static DEFINE_RWLOCK(skbedit_lock);
-
-static struct tcf_hashinfo skbedit_hash_info = {
- .htab = tcf_skbedit_ht,
- .hmask = SKBEDIT_TAB_MASK,
- .lock = &skbedit_lock,
-};
-
-static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
- struct tcf_result *res)
-{
- struct tcf_skbedit *d = a->priv;
-
- spin_lock(&d->tcf_lock);
- d->tcf_tm.lastuse = jiffies;
- bstats_update(&d->tcf_bstats, skb);
-
- if (d->flags & SKBEDIT_F_PRIORITY)
- skb->priority = d->priority;
- if (d->flags & SKBEDIT_F_QUEUE_MAPPING &&
- skb->dev->real_num_tx_queues > d->queue_mapping)
- skb_set_queue_mapping(skb, d->queue_mapping);
- if (d->flags & SKBEDIT_F_MARK)
- skb->mark = d->mark;
-
- spin_unlock(&d->tcf_lock);
- return d->tcf_action;
-}
-
-static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
- [TCA_SKBEDIT_PARMS] = { .len = sizeof(struct tc_skbedit) },
- [TCA_SKBEDIT_PRIORITY] = { .len = sizeof(u32) },
- [TCA_SKBEDIT_QUEUE_MAPPING] = { .len = sizeof(u16) },
- [TCA_SKBEDIT_MARK] = { .len = sizeof(u32) },
-};
-
-static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
- struct nlattr *est, struct tc_action *a,
- int ovr, int bind)
-{
- struct nlattr *tb[TCA_SKBEDIT_MAX + 1];
- struct tc_skbedit *parm;
- struct tcf_skbedit *d;
- struct tcf_common *pc;
- u32 flags = 0, *priority = NULL, *mark = NULL;
- u16 *queue_mapping = NULL;
- int ret = 0, err;
-
- if (nla == NULL)
- return -EINVAL;
-
- err = nla_parse_nested(tb, TCA_SKBEDIT_MAX, nla, skbedit_policy);
- if (err < 0)
- return err;
-
- if (tb[TCA_SKBEDIT_PARMS] == NULL)
- return -EINVAL;
-
- if (tb[TCA_SKBEDIT_PRIORITY] != NULL) {
- flags |= SKBEDIT_F_PRIORITY;
- priority = nla_data(tb[TCA_SKBEDIT_PRIORITY]);
- }
-
- if (tb[TCA_SKBEDIT_QUEUE_MAPPING] != NULL) {
- flags |= SKBEDIT_F_QUEUE_MAPPING;
- queue_mapping = nla_data(tb[TCA_SKBEDIT_QUEUE_MAPPING]);
- }
-
- if (tb[TCA_SKBEDIT_MARK] != NULL) {
- flags |= SKBEDIT_F_MARK;
- mark = nla_data(tb[TCA_SKBEDIT_MARK]);
- }
-
- if (!flags)
- return -EINVAL;
-
- parm = nla_data(tb[TCA_SKBEDIT_PARMS]);
-
- pc = tcf_hash_check(parm->index, a, bind, &skbedit_hash_info);
- if (!pc) {
- pc = tcf_hash_create(parm->index, est, a, sizeof(*d), bind,
- &skbedit_idx_gen, &skbedit_hash_info);
- if (IS_ERR(pc))
- return PTR_ERR(pc);
-
- d = to_skbedit(pc);
- ret = ACT_P_CREATED;
- } else {
- d = to_skbedit(pc);
- if (!ovr) {
- tcf_hash_release(pc, bind, &skbedit_hash_info);
- return -EEXIST;
- }
- }
-
- spin_lock_bh(&d->tcf_lock);
-
- d->flags = flags;
- if (flags & SKBEDIT_F_PRIORITY)
- d->priority = *priority;
- if (flags & SKBEDIT_F_QUEUE_MAPPING)
- d->queue_mapping = *queue_mapping;
- if (flags & SKBEDIT_F_MARK)
- d->mark = *mark;
-
- d->tcf_action = parm->action;
-
- spin_unlock_bh(&d->tcf_lock);
-
- if (ret == ACT_P_CREATED)
- tcf_hash_insert(pc, &skbedit_hash_info);
- return ret;
-}
-
-static int tcf_skbedit_cleanup(struct tc_action *a, int bind)
-{
- struct tcf_skbedit *d = a->priv;
-
- if (d)
- return tcf_hash_release(&d->common, bind, &skbedit_hash_info);
- return 0;
-}
-
-static int tcf_skbedit_dump(struct sk_buff *skb, struct tc_action *a,
- int bind, int ref)
-{
- unsigned char *b = skb_tail_pointer(skb);
- struct tcf_skbedit *d = a->priv;
- struct tc_skbedit opt = {
- .index = d->tcf_index,
- .refcnt = d->tcf_refcnt - ref,
- .bindcnt = d->tcf_bindcnt - bind,
- .action = d->tcf_action,
- };
- struct tcf_t t;
-
- if (nla_put(skb, TCA_SKBEDIT_PARMS, sizeof(opt), &opt))
- goto nla_put_failure;
- if ((d->flags & SKBEDIT_F_PRIORITY) &&
- nla_put(skb, TCA_SKBEDIT_PRIORITY, sizeof(d->priority),
- &d->priority))
- goto nla_put_failure;
- if ((d->flags & SKBEDIT_F_QUEUE_MAPPING) &&
- nla_put(skb, TCA_SKBEDIT_QUEUE_MAPPING,
- sizeof(d->queue_mapping), &d->queue_mapping))
- goto nla_put_failure;
- if ((d->flags & SKBEDIT_F_MARK) &&
- nla_put(skb, TCA_SKBEDIT_MARK, sizeof(d->mark),
- &d->mark))
- goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
- t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
- if (nla_put(skb, TCA_SKBEDIT_TM, sizeof(t), &t))
- goto nla_put_failure;
- return skb->len;
-
-nla_put_failure:
- nlmsg_trim(skb, b);
- return -1;
-}
-
-static struct tc_action_ops act_skbedit_ops = {
- .kind = "skbedit",
- .hinfo = &skbedit_hash_info,
- .type = TCA_ACT_SKBEDIT,
- .capab = TCA_CAP_NONE,
- .owner = THIS_MODULE,
- .act = tcf_skbedit,
- .dump = tcf_skbedit_dump,
- .cleanup = tcf_skbedit_cleanup,
- .init = tcf_skbedit_init,
- .walk = tcf_generic_walker,
-};
-
-MODULE_AUTHOR("Alexander Duyck, <alexander.h.duyck@intel.com>");
-MODULE_DESCRIPTION("SKB Editing");
-MODULE_LICENSE("GPL");
-
-static int __init skbedit_init_module(void)
-{
- return tcf_register_action(&act_skbedit_ops);
-}
-
-static void __exit skbedit_cleanup_module(void)
-{
- tcf_unregister_action(&act_skbedit_ops);
-}
-
-module_init(skbedit_init_module);
-module_exit(skbedit_cleanup_module);
--
1.7.5.4
^ permalink raw reply related
* [PATCH 2/2] net_sched: Remove broken act_simple
From: Eric W. Biederman @ 2013-10-27 13:43 UTC (permalink / raw)
To: David Miller; +Cc: netdev, alexander.h.duyck, jhs
In-Reply-To: <87fvrmu909.fsf@xmission.com>
While reading through the code I noticed that act_simple does not
implement a .lookup function in act_simp_ops.
In practice this means that RTM_GETACTION and RTM_DELACTION will
always fail for "simple" actions. This has been the case since at
least 2.6.12-rc1. Which means this code has been broken for more
years than I care to think about.
On the principle that a broken example is worse than no example delete
this code.
Cc: jhs@mojatatu.com
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
include/net/tc_act/tc_defact.h | 14 --
include/uapi/linux/tc_act/Kbuild | 1 -
include/uapi/linux/tc_act/tc_defact.h | 19 ---
net/sched/Kconfig | 14 --
net/sched/Makefile | 1 -
net/sched/act_simple.c | 225 ---------------------------------
6 files changed, 0 insertions(+), 274 deletions(-)
delete mode 100644 include/net/tc_act/tc_defact.h
delete mode 100644 include/uapi/linux/tc_act/tc_defact.h
delete mode 100644 net/sched/act_simple.c
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h
deleted file mode 100644
index 65f024b80958..000000000000
--- a/include/net/tc_act/tc_defact.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __NET_TC_DEF_H
-#define __NET_TC_DEF_H
-
-#include <net/act_api.h>
-
-struct tcf_defact {
- struct tcf_common common;
- u32 tcfd_datalen;
- void *tcfd_defdata;
-};
-#define to_defact(pc) \
- container_of(pc, struct tcf_defact, common)
-
-#endif /* __NET_TC_DEF_H */
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index 713b331d9df3..5e4ef55bb43e 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -1,6 +1,5 @@
# UAPI Header export list
header-y += tc_csum.h
-header-y += tc_defact.h
header-y += tc_gact.h
header-y += tc_ipt.h
header-y += tc_mirred.h
diff --git a/include/uapi/linux/tc_act/tc_defact.h b/include/uapi/linux/tc_act/tc_defact.h
deleted file mode 100644
index 17dddb40f740..000000000000
--- a/include/uapi/linux/tc_act/tc_defact.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __LINUX_TC_DEF_H
-#define __LINUX_TC_DEF_H
-
-#include <linux/pkt_cls.h>
-
-struct tc_defact {
- tc_gen;
-};
-
-enum {
- TCA_DEF_UNSPEC,
- TCA_DEF_TM,
- TCA_DEF_PARMS,
- TCA_DEF_DATA,
- __TCA_DEF_MAX
-};
-#define TCA_DEF_MAX (__TCA_DEF_MAX - 1)
-
-#endif
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 37af03bba732..05c7dba68af7 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -618,20 +618,6 @@ config NET_ACT_PEDIT
To compile this code as a module, choose M here: the
module will be called act_pedit.
-config NET_ACT_SIMP
- tristate "Simple Example (Debug)"
- depends on NET_CLS_ACT
- ---help---
- Say Y here to add a simple action for demonstration purposes.
- It is meant as an example and for debugging purposes. It will
- print a configured policy string followed by the packet count
- to the console for every packet that passes by.
-
- If unsure, say N.
-
- To compile this code as a module, choose M here: the
- module will be called act_simple.
-
config NET_ACT_CSUM
tristate "Checksum Updating"
depends on NET_CLS_ACT && INET
diff --git a/net/sched/Makefile b/net/sched/Makefile
index 91e2acf15832..7c31261f32e9 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -13,7 +13,6 @@ obj-$(CONFIG_NET_ACT_MIRRED) += act_mirred.o
obj-$(CONFIG_NET_ACT_IPT) += act_ipt.o
obj-$(CONFIG_NET_ACT_NAT) += act_nat.o
obj-$(CONFIG_NET_ACT_PEDIT) += act_pedit.o
-obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o
obj-$(CONFIG_NET_ACT_CSUM) += act_csum.o
obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o
obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
deleted file mode 100644
index 7725eb4ab756..000000000000
--- a/net/sched/act_simple.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * net/sched/simp.c Simple example of an action
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- * Authors: Jamal Hadi Salim (2005-8)
- *
- */
-
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-#include <linux/rtnetlink.h>
-#include <net/netlink.h>
-#include <net/pkt_sched.h>
-
-#define TCA_ACT_SIMP 22
-
-#include <linux/tc_act/tc_defact.h>
-#include <net/tc_act/tc_defact.h>
-
-#define SIMP_TAB_MASK 7
-static struct tcf_common *tcf_simp_ht[SIMP_TAB_MASK + 1];
-static u32 simp_idx_gen;
-static DEFINE_RWLOCK(simp_lock);
-
-static struct tcf_hashinfo simp_hash_info = {
- .htab = tcf_simp_ht,
- .hmask = SIMP_TAB_MASK,
- .lock = &simp_lock,
-};
-
-#define SIMP_MAX_DATA 32
-static int tcf_simp(struct sk_buff *skb, const struct tc_action *a,
- struct tcf_result *res)
-{
- struct tcf_defact *d = a->priv;
-
- spin_lock(&d->tcf_lock);
- d->tcf_tm.lastuse = jiffies;
- bstats_update(&d->tcf_bstats, skb);
-
- /* print policy string followed by _ then packet count
- * Example if this was the 3rd packet and the string was "hello"
- * then it would look like "hello_3" (without quotes)
- */
- pr_info("simple: %s_%d\n",
- (char *)d->tcfd_defdata, d->tcf_bstats.packets);
- spin_unlock(&d->tcf_lock);
- return d->tcf_action;
-}
-
-static int tcf_simp_release(struct tcf_defact *d, int bind)
-{
- int ret = 0;
- if (d) {
- if (bind)
- d->tcf_bindcnt--;
- d->tcf_refcnt--;
- if (d->tcf_bindcnt <= 0 && d->tcf_refcnt <= 0) {
- kfree(d->tcfd_defdata);
- tcf_hash_destroy(&d->common, &simp_hash_info);
- ret = 1;
- }
- }
- return ret;
-}
-
-static int alloc_defdata(struct tcf_defact *d, char *defdata)
-{
- d->tcfd_defdata = kzalloc(SIMP_MAX_DATA, GFP_KERNEL);
- if (unlikely(!d->tcfd_defdata))
- return -ENOMEM;
- strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
- return 0;
-}
-
-static void reset_policy(struct tcf_defact *d, char *defdata,
- struct tc_defact *p)
-{
- spin_lock_bh(&d->tcf_lock);
- d->tcf_action = p->action;
- memset(d->tcfd_defdata, 0, SIMP_MAX_DATA);
- strlcpy(d->tcfd_defdata, defdata, SIMP_MAX_DATA);
- spin_unlock_bh(&d->tcf_lock);
-}
-
-static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = {
- [TCA_DEF_PARMS] = { .len = sizeof(struct tc_defact) },
- [TCA_DEF_DATA] = { .type = NLA_STRING, .len = SIMP_MAX_DATA },
-};
-
-static int tcf_simp_init(struct net *net, struct nlattr *nla,
- struct nlattr *est, struct tc_action *a,
- int ovr, int bind)
-{
- struct nlattr *tb[TCA_DEF_MAX + 1];
- struct tc_defact *parm;
- struct tcf_defact *d;
- struct tcf_common *pc;
- char *defdata;
- int ret = 0, err;
-
- if (nla == NULL)
- return -EINVAL;
-
- err = nla_parse_nested(tb, TCA_DEF_MAX, nla, simple_policy);
- if (err < 0)
- return err;
-
- if (tb[TCA_DEF_PARMS] == NULL)
- return -EINVAL;
-
- if (tb[TCA_DEF_DATA] == NULL)
- return -EINVAL;
-
- parm = nla_data(tb[TCA_DEF_PARMS]);
- defdata = nla_data(tb[TCA_DEF_DATA]);
-
- pc = tcf_hash_check(parm->index, a, bind, &simp_hash_info);
- if (!pc) {
- pc = tcf_hash_create(parm->index, est, a, sizeof(*d), bind,
- &simp_idx_gen, &simp_hash_info);
- if (IS_ERR(pc))
- return PTR_ERR(pc);
-
- d = to_defact(pc);
- ret = alloc_defdata(d, defdata);
- if (ret < 0) {
- if (est)
- gen_kill_estimator(&pc->tcfc_bstats,
- &pc->tcfc_rate_est);
- kfree_rcu(pc, tcfc_rcu);
- return ret;
- }
- d->tcf_action = parm->action;
- ret = ACT_P_CREATED;
- } else {
- d = to_defact(pc);
- if (!ovr) {
- tcf_simp_release(d, bind);
- return -EEXIST;
- }
- reset_policy(d, defdata, parm);
- }
-
- if (ret == ACT_P_CREATED)
- tcf_hash_insert(pc, &simp_hash_info);
- return ret;
-}
-
-static int tcf_simp_cleanup(struct tc_action *a, int bind)
-{
- struct tcf_defact *d = a->priv;
-
- if (d)
- return tcf_simp_release(d, bind);
- return 0;
-}
-
-static int tcf_simp_dump(struct sk_buff *skb, struct tc_action *a,
- int bind, int ref)
-{
- unsigned char *b = skb_tail_pointer(skb);
- struct tcf_defact *d = a->priv;
- struct tc_defact opt = {
- .index = d->tcf_index,
- .refcnt = d->tcf_refcnt - ref,
- .bindcnt = d->tcf_bindcnt - bind,
- .action = d->tcf_action,
- };
- struct tcf_t t;
-
- if (nla_put(skb, TCA_DEF_PARMS, sizeof(opt), &opt) ||
- nla_put_string(skb, TCA_DEF_DATA, d->tcfd_defdata))
- goto nla_put_failure;
- t.install = jiffies_to_clock_t(jiffies - d->tcf_tm.install);
- t.lastuse = jiffies_to_clock_t(jiffies - d->tcf_tm.lastuse);
- t.expires = jiffies_to_clock_t(d->tcf_tm.expires);
- if (nla_put(skb, TCA_DEF_TM, sizeof(t), &t))
- goto nla_put_failure;
- return skb->len;
-
-nla_put_failure:
- nlmsg_trim(skb, b);
- return -1;
-}
-
-static struct tc_action_ops act_simp_ops = {
- .kind = "simple",
- .hinfo = &simp_hash_info,
- .type = TCA_ACT_SIMP,
- .capab = TCA_CAP_NONE,
- .owner = THIS_MODULE,
- .act = tcf_simp,
- .dump = tcf_simp_dump,
- .cleanup = tcf_simp_cleanup,
- .init = tcf_simp_init,
- .walk = tcf_generic_walker,
-};
-
-MODULE_AUTHOR("Jamal Hadi Salim(2005)");
-MODULE_DESCRIPTION("Simple example action");
-MODULE_LICENSE("GPL");
-
-static int __init simp_init_module(void)
-{
- int ret = tcf_register_action(&act_simp_ops);
- if (!ret)
- pr_info("Simple TC action Loaded\n");
- return ret;
-}
-
-static void __exit simp_cleanup_module(void)
-{
- tcf_unregister_action(&act_simp_ops);
-}
-
-module_init(simp_init_module);
-module_exit(simp_cleanup_module);
--
1.7.5.4
^ permalink raw reply related
* RE: [PATCH 1/2] net/benet: Identify interface type in advance
From: Sathya Perla @ 2013-10-27 14:22 UTC (permalink / raw)
To: Gavin Shan, netdev@vger.kernel.org
In-Reply-To: <1382688165-20957-1-git-send-email-shangw@linux.vnet.ibm.com>
> -----Original Message-----
> From: Gavin Shan [mailto:shangw@linux.vnet.ibm.com]
>
> Function be_map_pci_bars() is being called in be_ctrl_init(). Since
> be_ctrl_init() has fetched the value of PCI config register 0x58,
> we needn't access the same register in be_map_pci_bars() again to
> incur unnecessary PCI config access.
>
> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
> ---
> drivers/net/ethernet/emulex/benet/be_main.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c
> b/drivers/net/ethernet/emulex/benet/be_main.c
> index 2c38cc4..1a799d2 100644
> --- a/drivers/net/ethernet/emulex/benet/be_main.c
> +++ b/drivers/net/ethernet/emulex/benet/be_main.c
> @@ -3960,11 +3960,6 @@ static int be_roce_map_pci_bars(struct be_adapter *adapter)
> static int be_map_pci_bars(struct be_adapter *adapter)
> {
> u8 __iomem *addr;
> - u32 sli_intf;
> -
> - pci_read_config_dword(adapter->pdev, SLI_INTF_REG_OFFSET, &sli_intf);
> - adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
> - SLI_INTF_IF_TYPE_SHIFT;
>
> if (BEx_chip(adapter) && be_physfn(adapter)) {
> adapter->csr = pci_iomap(adapter->pdev, 2, 0);
> @@ -4011,7 +4006,9 @@ static int be_ctrl_init(struct be_adapter *adapter)
>
> pci_read_config_dword(adapter->pdev, SLI_INTF_REG_OFFSET, &sli_intf);
> adapter->sli_family = (sli_intf & SLI_INTF_FAMILY_MASK) >>
> - SLI_INTF_FAMILY_SHIFT;
> + SLI_INTF_FAMILY_SHIFT;
> + adapter->if_type = (sli_intf & SLI_INTF_IF_TYPE_MASK) >>
> + SLI_INTF_IF_TYPE_SHIFT;
Gavin, adapter->if_type is not being used anywhere in the driver.
We could just get rid of it.
> adapter->virtfn = (sli_intf & SLI_INTF_FT_MASK) ? 1 : 0;
>
> status = be_map_pci_bars(adapter);
> --
> 1.7.9.5
^ permalink raw reply
* Re: [PATCH net-next] ipv4: fix DO and PROBE pmtu mode regarding local fragmentation with UFO/CORK
From: Hannes Frederic Sowa @ 2013-10-27 14:37 UTC (permalink / raw)
To: netdev
In-Reply-To: <20131025194003.GG15744@order.stressinduktion.org>
On Fri, Oct 25, 2013 at 09:40:03PM +0200, Hannes Frederic Sowa wrote:
> fragheaderlen = sizeof(struct iphdr) + (opt ? opt->optlen : 0);
> maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen;
> + maxmsgsize = (inet->pmtudisc >= IP_PMTUDISC_DO) ?
> + maxfraglen : 0xFFFF;
Oops, sorry. I just realized that the check is too strict. The 64
bit boundary restricton is solely used if we are actually generating
fragments. So I should have used mtu directly instead of maxfraglen.
This should only matter in case of some unusual MTUs but I will send a
corrected patch as soon as I am at home.
Greetings,
Hannes
^ permalink raw reply
* extending ndo_add_rx_vxlan_port
From: Or Gerlitz @ 2013-10-27 15:21 UTC (permalink / raw)
To: Joseph Gasparakis, John Fastabend; +Cc: Yan Burman, netdev, Stephen Hemminger
Hi,
So with commit 53cf527513eed6e7170e9dceacd198f9267171b0 "vxlan: Notify
drivers for listening UDP port changes" drivers that have HW offloads
for vxlan can be notified on which UDP port to listen. Taking this
further, some HW may need to know the multicast address and/or the VNID
used by the vxlan instance/s set above them. In that respect, do we
prefer to extend ndo_add_rx_vxlan_port() or introduce new ndo?
Or.
^ permalink raw reply
* [PATCH 0/4] wl1251 device tree support
From: Sebastian Reichel @ 2013-10-27 16:14 UTC (permalink / raw)
To: Sebastian Reichel, Luciano Coelho
Cc: Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Greg Kroah-Hartman, Stephen Warren, linux-doc,
John W. Linville, Rob Herring, linux-kernel, Sachin Kamat,
Bill Pemberton, Sebastian Reichel, Felipe Balbi, Rob Landley,
netdev, linux-wireless, linux-omap, linux-arm-kernel
Hi,
The following patchset adds device tree support to
the spi variant of the wl1251 driver.
Some notes:
The first patch is from Luciano's wilink DT support
patchset [0].
The third patch (vio regulator support) is optional. N900's
wifi also worked without this patch, but its probably cleaner
to have it.
The patchset has been tested using DT boot with the Nokia N900
and connecting to my wlan access point.
[0] https://lkml.org/lkml/2013/7/3/333
-- Sebastian
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structure
Sebastian Reichel (3):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
.../devicetree/bindings/net/wireless/ti,wl1251.txt | 36 +++++++++++
arch/arm/mach-omap2/board-omap3pandora.c | 6 +-
arch/arm/mach-omap2/board-rx51-peripherals.c | 15 ++---
drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++--
drivers/net/wireless/ti/wl1251/sdio.c | 31 +++++++---
drivers/net/wireless/ti/wl1251/spi.c | 71 ++++++++++++++++------
drivers/net/wireless/ti/wl1251/wl1251.h | 4 +-
include/linux/wl12xx.h | 24 +++++++-
8 files changed, 175 insertions(+), 49 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
--
1.8.4.rc3
^ permalink raw reply
* [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
From: Sebastian Reichel @ 2013-10-27 16:14 UTC (permalink / raw)
To: Sebastian Reichel, Luciano Coelho
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Tony Lindgren, Russell King,
John W. Linville, Felipe Balbi, Sachin Kamat, Greg Kroah-Hartman,
Bill Pemberton, devicetree, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, linux-wireless, netdev, Luciano Coelho
In-Reply-To: <1382890469-25286-1-git-send-email-sre@debian.org>
From: Luciano Coelho <coelho@ti.com>
Move the wl1251 part of the wl12xx platform data structure into a new
structure specifically for wl1251. Change the platform data built-in
block and board files accordingly.
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
---
arch/arm/mach-omap2/board-omap3pandora.c | 4 +--
arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +-
drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++++++++++++++-----
drivers/net/wireless/ti/wl1251/sdio.c | 12 ++++-----
drivers/net/wireless/ti/wl1251/spi.c | 2 +-
include/linux/wl12xx.h | 22 ++++++++++++++-
6 files changed, 62 insertions(+), 17 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index de1bc6b..24f3c1b 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
static void __init pandora_wl1251_init(void)
{
- struct wl12xx_platform_data pandora_wl1251_pdata;
+ struct wl1251_platform_data pandora_wl1251_pdata;
int ret;
memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void)
goto fail_irq;
pandora_wl1251_pdata.use_eeprom = true;
- ret = wl12xx_set_platform_data(&pandora_wl1251_pdata);
+ ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
if (ret < 0)
goto fail_irq;
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 65e3627..0d8e7d2 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -82,7 +82,7 @@ enum {
RX51_SPI_MIPID, /* LCD panel */
};
-static struct wl12xx_platform_data wl1251_pdata;
+static struct wl1251_platform_data wl1251_pdata;
static struct tsc2005_platform_data tsc2005_pdata;
#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c
index 998e958..a92bd3e 100644
--- a/drivers/net/wireless/ti/wilink_platform_data.c
+++ b/drivers/net/wireless/ti/wilink_platform_data.c
@@ -23,17 +23,17 @@
#include <linux/err.h>
#include <linux/wl12xx.h>
-static struct wl12xx_platform_data *platform_data;
+static struct wl12xx_platform_data *wl12xx_platform_data;
int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
{
- if (platform_data)
+ if (wl12xx_platform_data)
return -EBUSY;
if (!data)
return -EINVAL;
- platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
- if (!platform_data)
+ wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+ if (!wl12xx_platform_data)
return -ENOMEM;
return 0;
@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
struct wl12xx_platform_data *wl12xx_get_platform_data(void)
{
- if (!platform_data)
+ if (!wl12xx_platform_data)
return ERR_PTR(-ENODEV);
- return platform_data;
+ return wl12xx_platform_data;
}
EXPORT_SYMBOL(wl12xx_get_platform_data);
+
+static struct wl1251_platform_data *wl1251_platform_data;
+
+int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
+{
+ if (wl1251_platform_data)
+ return -EBUSY;
+ if (!data)
+ return -EINVAL;
+
+ wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+ if (!wl1251_platform_data)
+ return -ENOMEM;
+
+ return 0;
+}
+
+struct wl1251_platform_data *wl1251_get_platform_data(void)
+{
+ if (!wl1251_platform_data)
+ return ERR_PTR(-ENODEV);
+
+ return wl1251_platform_data;
+}
+EXPORT_SYMBOL(wl1251_get_platform_data);
diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c
index e2b3d9c..b75a37a 100644
--- a/drivers/net/wireless/ti/wl1251/sdio.c
+++ b/drivers/net/wireless/ti/wl1251/sdio.c
@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
struct wl1251 *wl;
struct ieee80211_hw *hw;
struct wl1251_sdio *wl_sdio;
- const struct wl12xx_platform_data *wl12xx_board_data;
+ const struct wl1251_platform_data *wl1251_board_data;
hw = wl1251_alloc_hw();
if (IS_ERR(hw))
@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func,
wl->if_priv = wl_sdio;
wl->if_ops = &wl1251_sdio_ops;
- wl12xx_board_data = wl12xx_get_platform_data();
- if (!IS_ERR(wl12xx_board_data)) {
- wl->set_power = wl12xx_board_data->set_power;
- wl->irq = wl12xx_board_data->irq;
- wl->use_eeprom = wl12xx_board_data->use_eeprom;
+ wl1251_board_data = wl1251_get_platform_data();
+ if (!IS_ERR(wl1251_board_data)) {
+ wl->set_power = wl1251_board_data->set_power;
+ wl->irq = wl1251_board_data->irq;
+ wl->use_eeprom = wl1251_board_data->use_eeprom;
}
if (wl->irq) {
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index c7dc6fe..6bbbfe6 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = {
static int wl1251_spi_probe(struct spi_device *spi)
{
- struct wl12xx_platform_data *pdata;
+ struct wl1251_platform_data *pdata;
struct ieee80211_hw *hw;
struct wl1251 *wl;
int ret;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a54fe82..b516b4f 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -48,11 +48,15 @@ enum {
WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
};
-struct wl12xx_platform_data {
+struct wl1251_platform_data {
void (*set_power)(bool enable);
/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
int irq;
bool use_eeprom;
+};
+
+struct wl12xx_platform_data {
+ int irq;
int board_ref_clock;
int board_tcxo_clock;
unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
struct wl12xx_platform_data *wl12xx_get_platform_data(void);
+int wl1251_set_platform_data(const struct wl1251_platform_data *data);
+
+struct wl1251_platform_data *wl1251_get_platform_data(void);
+
#else
static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
return ERR_PTR(-ENODATA);
}
+static inline
+int wl1251_set_platform_data(const struct wl1251_platform_data *data)
+{
+ return -ENOSYS;
+}
+
+static inline
+struct wl1251_platform_data *wl1251_get_platform_data(void)
+{
+ return ERR_PTR(-ENODATA);
+}
+
#endif
#endif
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH 3/4] wl1251: spi: add vio regulator support
From: Sebastian Reichel @ 2013-10-27 16:14 UTC (permalink / raw)
To: Sebastian Reichel, Luciano Coelho
Cc: Mark Rutland, devicetree, Russell King, Pawel Moll, Ian Campbell,
Tony Lindgren, Greg Kroah-Hartman, Stephen Warren, linux-doc,
John W. Linville, Rob Herring, linux-kernel, Sachin Kamat,
Bill Pemberton, Sebastian Reichel, Felipe Balbi, Rob Landley,
netdev, linux-wireless, linux-omap, linux-arm-kernel
In-Reply-To: <1382890469-25286-1-git-send-email-sre@debian.org>
This patch adds support for requesting the regulator powering
the vio pin.
The patch also adds the regulator for the all boards using the
wl1251 in spi mode (only the Nokia N900).
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
arch/arm/mach-omap2/board-rx51-peripherals.c | 2 ++
drivers/net/wireless/ti/wl1251/spi.c | 19 +++++++++++++++++--
drivers/net/wireless/ti/wl1251/wl1251.h | 2 ++
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index b9d95dd..a791fef 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -552,6 +552,8 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = {
REGULATOR_SUPPLY("vio", "2-0063"),
/* lis3lv02d */
REGULATOR_SUPPLY("Vdd_IO", "3-001d"),
+ /* wl1251 */
+ REGULATOR_SUPPLY("vio", "spi4.0"),
};
static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index 9a2df9d..efea57a 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -27,6 +27,7 @@
#include <linux/spi/spi.h>
#include <linux/wl12xx.h>
#include <linux/gpio.h>
+#include <linux/regulator/consumer.h>
#include "wl1251.h"
#include "reg.h"
@@ -306,13 +307,26 @@ static int wl1251_spi_probe(struct spi_device *spi)
irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
- ret = wl1251_init_ieee80211(wl);
+ wl->vio = devm_regulator_get(&spi->dev, "vio");
+ if (IS_ERR(wl->vio)) {
+ ret = PTR_ERR(wl->vio);
+ wl1251_error("vio regulator missing: %d", ret);
+ goto out_free;
+ }
+
+ ret = regulator_enable(wl->vio);
if (ret)
goto out_free;
+ ret = wl1251_init_ieee80211(wl);
+ if (ret)
+ goto disable_regulator;
+
return 0;
- out_free:
+disable_regulator:
+ regulator_disable(wl->vio);
+out_free:
ieee80211_free_hw(hw);
return ret;
@@ -324,6 +338,7 @@ static int wl1251_spi_remove(struct spi_device *spi)
free_irq(wl->irq, wl);
wl1251_free_hw(wl);
+ regulator_disable(wl->vio);
return 0;
}
diff --git a/drivers/net/wireless/ti/wl1251/wl1251.h b/drivers/net/wireless/ti/wl1251/wl1251.h
index 5e9808c..010718b 100644
--- a/drivers/net/wireless/ti/wl1251/wl1251.h
+++ b/drivers/net/wireless/ti/wl1251/wl1251.h
@@ -279,6 +279,8 @@ struct wl1251 {
int irq;
bool use_eeprom;
+ struct regulator *vio;
+
spinlock_t wl_lock;
enum wl1251_state state;
--
1.8.4.rc3
^ permalink raw reply related
* [PATCH 4/4] wl1251: spi: add device tree support
From: Sebastian Reichel @ 2013-10-27 16:14 UTC (permalink / raw)
To: Sebastian Reichel, Luciano Coelho
Cc: Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Rob Landley, Tony Lindgren, Russell King,
John W. Linville, Felipe Balbi, Sachin Kamat, Greg Kroah-Hartman,
Bill Pemberton, devicetree, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, linux-wireless, netdev, Sebastian Reichel
In-Reply-To: <1382890469-25286-1-git-send-email-sre@debian.org>
Add device tree support for the spi variant of wl1251
and document the binding.
Signed-off-by: Sebastian Reichel <sre@debian.org>
---
.../devicetree/bindings/net/wireless/ti,wl1251.txt | 36 ++++++++++++++++++++++
drivers/net/wireless/ti/wl1251/spi.c | 23 ++++++++++----
2 files changed, 53 insertions(+), 6 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt b/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
new file mode 100644
index 0000000..5f8a154
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
@@ -0,0 +1,36 @@
+* Texas Instruments wl1251 controller
+
+The wl1251 chip can be connected via SPI or via SDIO. The linux
+kernel currently only supports device tree for the SPI variant.
+
+Required properties:
+- compatible : Should be "ti,wl1251"
+- interrupts : Should contain interrupt line
+- interrupt-parent : Should be the phandle for the interrupt
+ controller that services interrupts for this device
+- vio-supply : phandle to regulator providing VIO
+- power-gpio : GPIO connected to chip's PMEN pin
+- For additional required properties on SPI, please consult
+ Documentation/devicetree/bindings/spi/spi-bus.txt
+
+Optional properties:
+- ti,use-eeprom : If found, configuration will be loaded from eeprom.
+
+Examples:
+
+&spi1 {
+ wl1251_spi@0 {
+ compatible = "ti,wl1251";
+
+ reg = <0>;
+ spi-max-frequency = <48000000>;
+ spi-cpol;
+ spi-cpha;
+
+ interrupt-parent = <&gpio2>;
+ interrupts = <10 IRQ_TYPE_NONE>; /* gpio line 42 */
+
+ vio-supply = <&vio>;
+ power-gpio = <&gpio3 23 GPIO_ACTIVE_HIGH>; /* 87 */
+ };
+};
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index efea57a..ee6ce4c 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -27,6 +27,8 @@
#include <linux/spi/spi.h>
#include <linux/wl12xx.h>
#include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <linux/regulator/consumer.h>
#include "wl1251.h"
@@ -240,13 +242,13 @@ static const struct wl1251_if_operations wl1251_spi_ops = {
static int wl1251_spi_probe(struct spi_device *spi)
{
- struct wl1251_platform_data *pdata;
+ struct wl1251_platform_data *pdata = spi->dev.platform_data;
+ struct device_node *np = spi->dev.of_node;
struct ieee80211_hw *hw;
struct wl1251 *wl;
int ret;
- pdata = spi->dev.platform_data;
- if (!pdata) {
+ if (!np && !pdata) {
wl1251_error("no platform data");
return -ENODEV;
}
@@ -273,7 +275,18 @@ static int wl1251_spi_probe(struct spi_device *spi)
goto out_free;
}
- wl->power_gpio = pdata->power_gpio;
+ if (np) {
+ wl->use_eeprom = of_property_read_bool(np, "ti,use-eeprom");
+ wl->power_gpio = of_get_named_gpio(np, "power-gpio", 0);
+ } else if (pdata) {
+ wl->power_gpio = pdata->power_gpio;
+ wl->use_eeprom = pdata->use_eeprom;
+ }
+
+ if (wl->power_gpio == -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+ goto out_free;
+ }
if (gpio_is_valid(wl->power_gpio)) {
ret = devm_gpio_request_one(&spi->dev, wl->power_gpio,
@@ -295,8 +308,6 @@ static int wl1251_spi_probe(struct spi_device *spi)
goto out_free;
}
- wl->use_eeprom = pdata->use_eeprom;
-
irq_set_status_flags(wl->irq, IRQ_NOAUTOEN);
ret = devm_request_irq(&spi->dev, wl->irq, wl1251_irq, 0,
DRIVER_NAME, wl);
--
1.8.4.rc3
^ 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