* Re: [PATCH] drivers/net: use is_zero_ether_addr() instead of memcmp()
From: David Miller @ 2012-08-24 17:30 UTC (permalink / raw)
To: weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w
Cc: j, linville-2XuSBdqkA4R54TAoqtyWWQ,
yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CAPgLHd_L1=1zaq=NUAjr+3822WfR2gV-sMA2tzKowHEezPmvOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
From: Wei Yongjun <weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Thu, 23 Aug 2012 15:16:44 +0800
> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
>
> Using is_zero_ether_addr() instead of directly use
> memcmp() to determine if the ethernet address is all
> zeros.
>
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
>
> Signed-off-by: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
Since this is wireless, John will pick it up.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] wimax/i2400m: use is_zero_ether_addr() instead of memcmp()
From: David Miller @ 2012-08-24 17:30 UTC (permalink / raw)
To: weiyj.lk; +Cc: inaky.perez-gonzalez, yongjun_wei, linux-wimax, wimax, netdev
In-Reply-To: <CAPgLHd9_MkQcGbQEqf=6Kjm06juybu29qSBdd7T=_EenFDyuEQ@mail.gmail.com>
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Thu, 23 Aug 2012 14:49:33 +0800
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Using is_zero_ether_addr() instead of directly use
> memcmp() to determine if the ethernet address is all
> zeros.
>
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Applied.
^ permalink raw reply
* Re: [PATCH (net.git)] stmmac: add header inclusion protection
From: David Miller @ 2012-08-24 17:25 UTC (permalink / raw)
To: peppe.cavallaro; +Cc: netdev, rayagond
In-Reply-To: <1345706898-13007-1-git-send-email-peppe.cavallaro@st.com>
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Thu, 23 Aug 2012 09:28:18 +0200
> From: Rayagond Kokatanur <rayagond@vayavyalabs.com>
>
> This patch adds "#ifndef __<header>_H" for protecting header from double
> inclusion.
>
> Signed-off-by: Rayagond Kokatanur <rayagond@vayavyalabs.com>
> Hacked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH 0/8] csiostor: Chelsio FCoE offload driver submission
From: David Miller @ 2012-08-24 17:04 UTC (permalink / raw)
To: naresh; +Cc: JBottomley, linux-scsi, dm, netdev, chethan
In-Reply-To: <1345760873-12101-1-git-send-email-naresh@chelsio.com>
From: Naresh Kumar Inna <naresh@chelsio.com>
Date: Fri, 24 Aug 2012 03:57:45 +0530
> This is the initial submission of the Chelsio FCoE offload driver (csiostor)
> to the upstream kernel. This driver currently supports FCoE offload
> functionality over Chelsio T4-based 10Gb Converged Network Adapters.
>
> The following patches contain the driver sources for csiostor driver and
> updates to firmware/hardware header files shared between csiostor and
> cxgb4 (Chelsio T4-based NIC driver). The csiostor driver is dependent on these
> header updates. These patches have been generated against scsi 'misc' branch.
>
> csiostor is a low level SCSI driver that interfaces with PCI, SCSI midlayer and
> FC transport subsystems. This driver claims the FCoE PCIe function on the
> Chelsio Converged Network Adapter. It relies on firmware events for slow path
> operations like discovery, thereby offloading session management. The driver
> programs firmware via Work Request interfaces for fast path I/O offload
> features.
You are going to have to get rid of these module parameters.
That have to do with things that are in no way specific to your device,
and therefore should be configured using generic kernel facilities.
Using driver specific module parameters results in a poor user
experience, because in order to make a configuration change the user
has to know exactly what kind of device and driver is underneath,
and then learn what the unique method is to make that configuration
change.
If you use a generic facility, the user only needs to learn one way to
make a configuration change, regardless of device type and driver.
^ permalink raw reply
* Re: [PATCH net-next 0/15] qlcnic: patches for new adapter - Qlogic 83XX CNA
From: David Miller @ 2012-08-24 16:56 UTC (permalink / raw)
To: sony.chacko; +Cc: netdev, Dept_NX_Linux_NIC_Driver
In-Reply-To: <1345770439-30517-1-git-send-email-sony.chacko@qlogic.com>
From: Sony Chacko <sony.chacko@qlogic.com>
Date: Thu, 23 Aug 2012 21:07:04 -0400
> From: Sony Chacko <sony.chacko@qlogic.com>
>
> Patch series will restructure the existing 82XX adapter driver to create
> a common driver for Qlogic 82XX and 83XX adapters.
>
> Please apply it to net-next.
Sorry, this is terrible.
Firstly, I'm not going to let you create arbitrary new sysfs and
debugfs crap for facilities that are already supported by the kernel
via other interfaces.
For example, providing a facility to read and write the PCI BARs
is completely pointless. Use the PCI config space access APIs for
this if you want to do this from userspace.
The patches are also much more verbose than they need to be. When you
move an operation to the new hwops, keep the existing function name
but make it an inline function that invokes the hwop.
That way you won't need hundreds of lines in your patch that look
like this:
- qlcnic_clear_lb_mode(adapter);
+ ahw->hw_ops->clear_loopback(adapter, mode);
Instead you'd have:
static inline void qlcnic_clear_lb_mode(struct qlcnic_adapter *adapter, u8 mode)
{
struct qlcnic_hardware_context *ahw = &adapter->ahw;
ahw->hw_ops->clear_loopback(adapter, mode);
}
^ permalink raw reply
* Re: [PATCH net-next] net: Set device operstate at registration time
From: Ben Hutchings @ 2012-08-24 16:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev, shemminger, shchepetkov, bjorn, mike
In-Reply-To: <20120824.124815.1292475998883382478.davem@davemloft.net>
On Fri, 2012-08-24 at 12:48 -0400, David Miller wrote:
> From: Ben Hutchings <bhutchings@solarflare.com>
> Date: Mon, 20 Aug 2012 22:16:51 +0100
>
> > This initialises the operstate synchronously at registration time
> > only.
>
> Ok, this looks good to me, applied. Thanks Ben.
>
> > This seems to deal properly with the registration-time problem, but not
> > the case where a device is brought down and then up again. Many but not
> > all drivers that support carrier detection call netif_carrier_off() in
> > their ndo_stop method. Should the others be changed, or is there some
> > way we can make that automatic?
>
> There are several cases.
>
> For example, if the device does not power down the PHY over stop/start
> it should leave the carrier state alone. This is the case for every
> NIC that runs management firmware, which therefore needs the link to
> stay up even when the NIC is administratively brought down.
>
> If it does power down the PHY, that netif_carrier_off() call should
> already be contained in the PHY powerdown code.
Right, that makes sense to me.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [net-next 10/13] igb: Tidy up wrapping for CONFIG_IGB_PTP.
From: Ben Hutchings @ 2012-08-24 16:51 UTC (permalink / raw)
To: Richard Cochran
Cc: Vick, Matthew, Keller, Jacob E, Kirsher, Jeffrey T,
davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
sassmann@redhat.com
In-Reply-To: <20120824101053.GA6038@netboy.at.omicron.at>
On Fri, 2012-08-24 at 12:10 +0200, Richard Cochran wrote:
> On Thu, Aug 23, 2012 at 06:40:25PM +0000, Vick, Matthew wrote:
> >
> > I tend to agree with Jake here--I like having the information. I'm fine removing them, but I'd like to do it for all CONFIG_IGB_PTP wrapping if we're going to do it. What do you think, Richard?
>
> Come to think of it, I never liked the CONFIG_IGB_PTP very much in the
> first place. These were added after the fact by Jeff Kirsher. He had
> said off list that there was some issue with CONFIG_PTP_1588_CLOCK and
> igb as a module, or something like that. At that time I said, just go
> ahead and fix it up.
If there is some feature of a driver that depends on an optional
modularisable subsystem, and you want the driver to be built without
that feature when the subsystem is missing, then the feature has to be
disabled when the driver is built-in and the subsystem is a module. So
in general you need:
config DRIVER_FEATURE
bool "This is a really neat feature for the driver"
depends on DRIVER && SUBSYSTEM && !(DRIVER=y && SUBYSTEM=m)
> I think it would be better if the "time stamp all Rx packets" of the
> 82580 were always available, and that the PHC feature always be
> compiled when CONFIG_PTP_1588_CLOCK is selected.
>
> Maybe you could ask Jeff what the issue was, and then see if there is
> a way to remove CONFIG_IGB_PTP altogether.
Even if they are to be enabled automatically, CONFIG_IGB_PTP and similar
config symbols are important as shorthand. So I think what you want is:
config IGB_PTP
def_bool y
depends on IGB && PTP_1588_CLOCK && !(IGB=y && PTP_1588_CLOCK=m)
(But currently it's actually *selecting* PTP_1588_CLOCK. We should
probably have drivers consistently select or depend on it, not a
mixture.)
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH net-next] net: Set device operstate at registration time
From: David Miller @ 2012-08-24 16:48 UTC (permalink / raw)
To: bhutchings; +Cc: netdev, shemminger, shchepetkov, bjorn, mike
In-Reply-To: <1345497411.2659.28.camel@bwh-desktop.uk.solarflarecom.com>
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 20 Aug 2012 22:16:51 +0100
> This initialises the operstate synchronously at registration time
> only.
Ok, this looks good to me, applied. Thanks Ben.
> This seems to deal properly with the registration-time problem, but not
> the case where a device is brought down and then up again. Many but not
> all drivers that support carrier detection call netif_carrier_off() in
> their ndo_stop method. Should the others be changed, or is there some
> way we can make that automatic?
There are several cases.
For example, if the device does not power down the PHY over stop/start
it should leave the carrier state alone. This is the case for every
NIC that runs management firmware, which therefore needs the link to
stay up even when the NIC is administratively brought down.
If it does power down the PHY, that netif_carrier_off() call should
already be contained in the PHY powerdown code.
^ permalink raw reply
* Re: [PATCH] [v2] net/fsl: introduce Freescale 10G MDIO driver
From: David Miller @ 2012-08-24 16:42 UTC (permalink / raw)
To: timur; +Cc: netdev, afleming, romieu
In-Reply-To: <1345490799-22963-1-git-send-email-timur@freescale.com>
From: Timur Tabi <timur@freescale.com>
Date: Mon, 20 Aug 2012 14:26:39 -0500
> Similar to fsl_pq_mdio.c, this driver is for the 10G MDIO controller on
> Freescale Frame Manager Ethernet controllers.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
Applied to net-next, thanks.
^ permalink raw reply
* Re: [PATCH] cls_cgroup: Allow classifier cgroups to have their classid reset to 0
From: David Miller @ 2012-08-24 16:41 UTC (permalink / raw)
To: nhorman; +Cc: netdev
In-Reply-To: <1345485550-15556-1-git-send-email-nhorman@tuxdriver.com>
From: Neil Horman <nhorman@tuxdriver.com>
Date: Mon, 20 Aug 2012 13:59:10 -0400
> The network classifier cgroup initalizes each cgroups instance classid value to
> 0. However, the sock_update_classid function only updates classid's in sockets
> if the tasks cgroup classid is not zero, and if it differs from the current
> classid. The later check is to prevent cache line dirtying, but the former is
> detrimental, as it prevents resetting a classid for a cgroup to 0. While this
> is not a common action, it has administrative usefulness (if the admin wants to
> disable classification of a certain group temporarily for instance).
>
> Easy fix, just remove the zero check. Tested successfully by myself
>
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Applied to net-next, thanks Neil.
^ permalink raw reply
* Re: [PATCH] [v2] netdev/phy: add MDIO bus multiplexer driven by a memory-mapped device
From: Timur Tabi @ 2012-08-24 16:27 UTC (permalink / raw)
To: Stephen Warren
Cc: Fleming Andy-AFLEMING, David Miller, ddaney.cavm@gmail.com,
netdev@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
Scott Wood
In-Reply-To: <5036EB06.7060807@wwwdotorg.org>
Stephen Warren wrote:
>>> >> Then, that'd have to be <9 1>;
>> >
>> > Actually, I had #size-cells = <0>.
> I think that if you have #size-cells=<0>, then you'll see the following
> error message when attempting to translate the address into the parent's
> address space:
>
> prom_parse: Bad cell count for /board-control@3,0/mdio-mux-emi2
It doesn't appear to be working. Here's my tree:
/ {
model = "fsl,P5020DS";
compatible = "fsl,P5020DS";
#address-cells = <2>;
#size-cells = <2>;
interrupt-parent = <&mpic>;
lbc: localbus@ffe124000 {
reg = <0xf 0xfe124000 0 0x1000>;
ranges = <0 0 0xf 0xe8000000 0x08000000
2 0 0xf 0xffa00000 0x00040000
3 0 0xf 0xffdf0000 0x00008000>;
fpga: board-control@3,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,p5020ds-fpga", "fsl,fpga-ngpixis";
reg = <3 0 0x30>;
mdio-mux-emi1 {
compatible = "mdio-mux-mmioreg";
mdio-parent-bus = <&mdio0>;
#address-cells = <1>;
#size-cells = <0>;
reg = <9 1>; // BRDCFG1
mux-mask = <0x78>; // EMI1
That means that the physical address that I need is fffdf0009. However,
when I call of_address_to_resource(), the returned address I get is fe8000009.
So it's not picking up the "3" in the 'reg' property of the
board-control@3,0 node. What am I missing? Do I need a 'ranges' property
in the board-control@3,0 node?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Gianfar ethernet drop package
From: Aníbal Almeida Pinto @ 2012-08-24 16:14 UTC (permalink / raw)
To: netdev
Hi,
I have an board with a ppc with a 8379, kernel 3.0.39 and with a Gianfar
Ethernet Controller Version 1.2.
When connect the board to office network the number of dropped packets
reported by ifconfig continues to increase.
Following the test made at [1] I use tcpdump and when running it the
number of drop packages don't have increased.
When executing ethtool eth0 -S it return a rx-dropped-by-kernel != 0.
And the rest of drop packages
Is possible to get info why the packages are dropped?
What is the relation between ethtool rx-dropped-by-kernel and ifconfig
drop package ?
The output from ifconfig eth0 and ethtool -S eth0 executed one after other:
# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:1D:11:91:00:00
inet addr:172.18.208.187 Bcast:0.0.0.0 Mask:255.255.252.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:967819 errors:0 dropped:54676 overruns:0 frame:0
TX packets:467 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:110916831 (105.7 MiB) TX bytes:45317 (44.2 KiB)
Base address:0x8000
ethtool -S eth0
NIC statistics:
rx-dropped-by-kernel: 628278
rx-large-frame-errors: 0
rx-short-frame-errors: 0
rx-non-octet-errors: 0
rx-crc-errors: 0
rx-overrun-errors: 0
rx-busy-errors: 0
rx-babbling-errors: 0
rx-truncated-frames: 0
ethernet-bus-error: 0
tx-babbling-errors: 0
tx-underrun-errors: 0
rx-skb-missing-errors: 0
tx-timeout-errors: 0
tx-rx-64-frames: 227705
tx-rx-65-127-frames: 743446
tx-rx-128-255-frames: 117818
tx-rx-256-511-frames: 43480
tx-rx-512-1023-frames: 21406
tx-rx-1024-1518-frames: 81741
tx-rx-1519-1522-good-vlan: 0
rx-bytes: 239178758
rx-packets: 1235130
rx-fcs-errors: 2
receive-multicast-packet: 293898
receive-broadcast-packet: 936991
rx-control-frame-packets: 0
rx-pause-frame-packets: 0
rx-unknown-op-code: 0
rx-alignment-error: 0
rx-frame-length-error: 0
rx-code-error: 0
rx-carrier-sense-error: 1
rx-undersize-packets: 0
rx-oversize-packets: 0
rx-fragmented-frames: 0
rx-jabber-frames: 1
rx-dropped-frames: 0
tx-byte-counter: 51355
tx-packets: 467
tx-multicast-packets: 0
tx-broadcast-packets: 132
tx-pause-control-frames: 0
tx-deferral-packets: 0
tx-excessive-deferral-packets: 0
tx-single-collision-packets: 0
tx-multiple-collision-packets: 0
tx-late-collision-packets: 0
tx-excessive-collision-packets: 0
tx-total-collision: 0
reserved: 0
tx-dropped-frames: 0
tx-jabber-frames: 0
tx-fcs-errors: 0
tx-control-frames: 0
tx-oversize-frames: 0
tx-undersize-frames: 0
tx-fragmented-frames: 0
[1] - http://www.novell.com/support/kb/doc.php?id=7007165
Thanks.
Regards,
Aníbal
^ permalink raw reply
* pull request: wireless 2012-08-24
From: John W. Linville @ 2012-08-24 16:13 UTC (permalink / raw)
To: davem; +Cc: linux-wireless, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 10737 bytes --]
commit e72615f6abde92e961feee13e1078a1352cde4f7
Dave,
This batch of fixes is intended for 3.6...
Johannes Berg gives us a pair of iwlwifi fixes. One corrects some
improperly defined ifdefs that lead to crashes and BUG_ONs. The other
prevents attempts to read SRAM for devices that aren't actually started.
Julia Lawall provides an ipw2100 fix to properly set the return code
from a function call before testing it! :-)
Thomas Huehn corrects the improper use of a constant related to a power
setting in ath5k.
Thomas Pedersen offers a mac80211 fix to properly handle destination
addresses of unicast frames passing though a mesh gate.
Vladimir Zapolskiy provides a brcmsmac fix to properly mark the
interface state when the device goes down.
Please let me know if there are problems!
Thanks,
John
---
The following changes since commit a0dfb2634e5671770f598cda08002d8cda66ac77:
af_packet: match_fanout_group() can be static (2012-08-23 09:27:12 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git for-davem
for you to fetch changes up to e72615f6abde92e961feee13e1078a1352cde4f7:
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless into for-davem (2012-08-24 11:16:58 -0400)
----------------------------------------------------------------
Johannes Berg (2):
iwlwifi: fix flow handler debug code
iwlwifi: protect SRAM debugfs
John W. Linville (2):
Merge branch 'for-john' of git://git.kernel.org/.../jberg/mac80211
Merge branch 'master' of git://git.kernel.org/.../linville/wireless into for-davem
Julia Lawall (1):
drivers/net/wireless/ipw2x00/ipw2100.c: introduce missing initialization
Thomas Huehn (1):
ath5k: fix wrong max power per rate eeprom reads for 802.11a
Thomas Pedersen (1):
mac80211: fix DS to MBSS address translation
Vladimir Zapolskiy (1):
brcm80211: smac: set interface down on reset
drivers/net/wireless/ath/ath5k/eeprom.c | 2 +-
drivers/net/wireless/ath/ath5k/eeprom.h | 1 +
.../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 3 ++
drivers/net/wireless/ipw2x00/ipw2100.c | 3 +-
drivers/net/wireless/iwlwifi/dvm/debugfs.c | 3 ++
drivers/net/wireless/iwlwifi/pcie/internal.h | 2 +-
drivers/net/wireless/iwlwifi/pcie/rx.c | 2 +-
drivers/net/wireless/iwlwifi/pcie/trans.c | 30 +++++++++--------
net/mac80211/tx.c | 38 +++++++++-------------
9 files changed, 44 insertions(+), 40 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index 4026c90..b7e0258 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -1482,7 +1482,7 @@ ath5k_eeprom_read_target_rate_pwr_info(struct ath5k_hw *ah, unsigned int mode)
case AR5K_EEPROM_MODE_11A:
offset += AR5K_EEPROM_TARGET_PWR_OFF_11A(ee->ee_version);
rate_pcal_info = ee->ee_rate_tpwr_a;
- ee->ee_rate_target_pwr_num[mode] = AR5K_EEPROM_N_5GHZ_CHAN;
+ ee->ee_rate_target_pwr_num[mode] = AR5K_EEPROM_N_5GHZ_RATE_CHAN;
break;
case AR5K_EEPROM_MODE_11B:
offset += AR5K_EEPROM_TARGET_PWR_OFF_11B(ee->ee_version);
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h
index dc2bcfe..94a9bbe 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.h
+++ b/drivers/net/wireless/ath/ath5k/eeprom.h
@@ -182,6 +182,7 @@
#define AR5K_EEPROM_EEP_DELTA 10
#define AR5K_EEPROM_N_MODES 3
#define AR5K_EEPROM_N_5GHZ_CHAN 10
+#define AR5K_EEPROM_N_5GHZ_RATE_CHAN 8
#define AR5K_EEPROM_N_2GHZ_CHAN 3
#define AR5K_EEPROM_N_2GHZ_CHAN_2413 4
#define AR5K_EEPROM_N_2GHZ_CHAN_MAX 4
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 192ad5c..a5edebe 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -1233,6 +1233,9 @@ uint brcms_reset(struct brcms_info *wl)
/* dpc will not be rescheduled */
wl->resched = false;
+ /* inform publicly that interface is down */
+ wl->pub->up = false;
+
return 0;
}
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index 95aa8e1..83324b3 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -2042,7 +2042,8 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
return;
}
len = ETH_ALEN;
- ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, &bssid, &len);
+ ret = ipw2100_get_ordinal(priv, IPW_ORD_STAT_ASSN_AP_BSSID, bssid,
+ &len);
if (ret) {
IPW_DEBUG_INFO("failed querying ordinals at line %d\n",
__LINE__);
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
index 46782f1..a47b306 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
@@ -124,6 +124,9 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
const struct fw_img *img;
size_t bufsz;
+ if (!iwl_is_ready_rf(priv))
+ return -EAGAIN;
+
/* default is to dump the entire data segment */
if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) {
priv->dbgfs_sram_offset = 0x800000;
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h
index d9694c5..4ffc18d 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -350,7 +350,7 @@ int iwl_queue_space(const struct iwl_queue *q);
/*****************************************************
* Error handling
******************************************************/
-int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display);
+int iwl_dump_fh(struct iwl_trans *trans, char **buf);
void iwl_dump_csr(struct iwl_trans *trans);
/*****************************************************
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c
index 39a6ca1..d1a61ba 100644
--- a/drivers/net/wireless/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/rx.c
@@ -555,7 +555,7 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
}
iwl_dump_csr(trans);
- iwl_dump_fh(trans, NULL, false);
+ iwl_dump_fh(trans, NULL);
iwl_op_mode_nic_error(trans->op_mode);
}
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 939c2f7..1e86ea2 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1649,13 +1649,9 @@ static const char *get_fh_string(int cmd)
#undef IWL_CMD
}
-int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display)
+int iwl_dump_fh(struct iwl_trans *trans, char **buf)
{
int i;
-#ifdef CONFIG_IWLWIFI_DEBUG
- int pos = 0;
- size_t bufsz = 0;
-#endif
static const u32 fh_tbl[] = {
FH_RSCSR_CHNL0_STTS_WPTR_REG,
FH_RSCSR_CHNL0_RBDCB_BASE_REG,
@@ -1667,29 +1663,35 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf, bool display)
FH_TSSR_TX_STATUS_REG,
FH_TSSR_TX_ERROR_REG
};
-#ifdef CONFIG_IWLWIFI_DEBUG
- if (display) {
- bufsz = ARRAY_SIZE(fh_tbl) * 48 + 40;
+
+#ifdef CONFIG_IWLWIFI_DEBUGFS
+ if (buf) {
+ int pos = 0;
+ size_t bufsz = ARRAY_SIZE(fh_tbl) * 48 + 40;
+
*buf = kmalloc(bufsz, GFP_KERNEL);
if (!*buf)
return -ENOMEM;
+
pos += scnprintf(*buf + pos, bufsz - pos,
"FH register values:\n");
- for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
+
+ for (i = 0; i < ARRAY_SIZE(fh_tbl); i++)
pos += scnprintf(*buf + pos, bufsz - pos,
" %34s: 0X%08x\n",
get_fh_string(fh_tbl[i]),
iwl_read_direct32(trans, fh_tbl[i]));
- }
+
return pos;
}
#endif
+
IWL_ERR(trans, "FH register values:\n");
- for (i = 0; i < ARRAY_SIZE(fh_tbl); i++) {
+ for (i = 0; i < ARRAY_SIZE(fh_tbl); i++)
IWL_ERR(trans, " %34s: 0X%08x\n",
get_fh_string(fh_tbl[i]),
iwl_read_direct32(trans, fh_tbl[i]));
- }
+
return 0;
}
@@ -1982,11 +1984,11 @@ static ssize_t iwl_dbgfs_fh_reg_read(struct file *file,
size_t count, loff_t *ppos)
{
struct iwl_trans *trans = file->private_data;
- char *buf;
+ char *buf = NULL;
int pos = 0;
ssize_t ret = -EFAULT;
- ret = pos = iwl_dump_fh(trans, &buf, true);
+ ret = pos = iwl_dump_fh(trans, &buf);
if (buf) {
ret = simple_read_from_buffer(user_buf,
count, ppos, buf, pos);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index acf712f..c5e8c9c 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1811,37 +1811,31 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr,
sdata, NULL, NULL);
} else {
- int is_mesh_mcast = 1;
- const u8 *mesh_da;
+ /* DS -> MBSS (802.11-2012 13.11.3.3).
+ * For unicast with unknown forwarding information,
+ * destination might be in the MBSS or if that fails
+ * forwarded to another mesh gate. In either case
+ * resolution will be handled in ieee80211_xmit(), so
+ * leave the original DA. This also works for mcast */
+ const u8 *mesh_da = skb->data;
+
+ if (mppath)
+ mesh_da = mppath->mpp;
+ else if (mpath)
+ mesh_da = mpath->dst;
+ rcu_read_unlock();
- if (is_multicast_ether_addr(skb->data))
- /* DA TA mSA AE:SA */
- mesh_da = skb->data;
- else {
- static const u8 bcast[ETH_ALEN] =
- { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
- if (mppath) {
- /* RA TA mDA mSA AE:DA SA */
- mesh_da = mppath->mpp;
- is_mesh_mcast = 0;
- } else if (mpath) {
- mesh_da = mpath->dst;
- is_mesh_mcast = 0;
- } else {
- /* DA TA mSA AE:SA */
- mesh_da = bcast;
- }
- }
hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc,
mesh_da, sdata->vif.addr);
- rcu_read_unlock();
- if (is_mesh_mcast)
+ if (is_multicast_ether_addr(mesh_da))
+ /* DA TA mSA AE:SA */
meshhdrlen =
ieee80211_new_mesh_header(&mesh_hdr,
sdata,
skb->data + ETH_ALEN,
NULL);
else
+ /* RA TA mDA mSA AE:DA SA */
meshhdrlen =
ieee80211_new_mesh_header(&mesh_hdr,
sdata,
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply related
* RE: [net-next 11/13] igb: Update PTP function names/variables and locations.
From: Vick, Matthew @ 2012-08-24 15:52 UTC (permalink / raw)
To: Richard Cochran
Cc: Keller, Jacob E, Kirsher, Jeffrey T, davem@davemloft.net,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com
In-Reply-To: <20120824065554.GB3261@netboy.at.omicron.at>
> -----Original Message-----
> From: Richard Cochran [mailto:richardcochran@gmail.com]
> Sent: Thursday, August 23, 2012 11:56 PM
> To: Vick, Matthew
> Cc: Keller, Jacob E; Kirsher, Jeffrey T; davem@davemloft.net;
> netdev@vger.kernel.org; gospo@redhat.com; sassmann@redhat.com
> Subject: Re: [net-next 11/13] igb: Update PTP function names/variables
> and locations.
>
> On Thu, Aug 23, 2012 at 06:44:24PM +0000, Vick, Matthew wrote:
> >
> > Isn't this discussion creeping outside the scope of this patch?
>
> Yes, it is. I am suggesting that the driver could use improvement, but
> not by renaming functions to suit your or someone else's taste.
> Instead, you could work on the time stamping feature.
>
> (And if, along the way, you end up renaming the functions that you
> change, then I won't complain ;)
>
> Thanks,
> Richard
Looking over the discussions and by trying to reach consensus, I think what I will do is re-spin patch 3 that Jeff sent (Correct PTP support query from ethtool.) to V2 with your feedback and work with Jeff to send all of my patchset up together. This first group of patches is groundwork for the last two. How does this sound?
Cheers,
Matthew
^ permalink raw reply
* Re: pull request: batman-adv 2012-08-23
From: David Miller @ 2012-08-24 15:46 UTC (permalink / raw)
To: ordex; +Cc: netdev, b.a.t.m.a.n
In-Reply-To: <1345727427-20805-1-git-send-email-ordex@autistici.org>
From: Antonio Quartulli <ordex@autistici.org>
Date: Thu, 23 Aug 2012 15:10:09 +0200
> this is our set of changes intended for net-next/linux-3.7.
> It is mostly composed by style fixes and cleanups. Other than that you have a
> patch introducing a new table in debugfs (backbone gateways table for the Bridge
> Loop Avoidance) and a new mechanism for the TranslationTable component. The
> latter allows mesh nodes to immediately detect new clients joining the network,
> without waiting for any periodic advertisement.
Pulled, thanks Antonio.
^ permalink raw reply
* Re: [PATCH 2/2] ipv4: Properly purge netdev references on uncached routes.
From: David Miller @ 2012-08-24 15:45 UTC (permalink / raw)
To: eric.dumazet; +Cc: shemminger, netdev
In-Reply-To: <1345822847.19483.8.camel@edumazet-glaptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 24 Aug 2012 17:40:47 +0200
> We might have an SMP performance regression on multicast traffic,
> because DST_NOCACHE is set on such routes.
>
> What about the following ?
I'm fine with this and will apply it to 'net', thanks Eric!
^ permalink raw reply
* Re: [PATCH 2/2] ipv4: Properly purge netdev references on uncached routes.
From: Eric Dumazet @ 2012-08-24 15:40 UTC (permalink / raw)
To: David Miller; +Cc: shemminger, netdev
In-Reply-To: <20120731.160408.994710172149748635.davem@davemloft.net>
From: Eric Dumazet <edumazet@google.com>
On Tue, 2012-07-31 at 16:04 -0700, David Miller wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Tue, 31 Jul 2012 15:44:55 -0700
>
> > On Tue, 31 Jul 2012 15:20:33 -0700 (PDT)
> > David Miller <davem@davemloft.net> wrote:
> >
> >>
> >> When a device is unregistered, we have to purge all of the
> >> references to it that may exist in the entire system.
> >>
> >> If a route is uncached, we currently have no way of accomplishing
> >> this.
> >>
> >> So create a global list that is scanned when a network device goes
> >> down. This mirrors the logic in net/core/dst.c's dst_ifdown().
> >>
> >> Signed-off-by: David S. Miller <davem@davemloft.net>
> >
> > What about systems will full 1M route table?
> > I wonder if doing rbtree here would make the search faster?
>
> It only happens for routes like 255.255.255.255 and for those who
> use tclassid on input.
>
> Everything else is cached in the existing FIB trie entries.
We might have an SMP performance regression on multicast traffic,
because DST_NOCACHE is set on such routes.
What about the following ?
Thanks
[PATCH] ipv4: take rt_uncached_lock only if needed
Multicast traffic allocates dst with DST_NOCACHE, but dst is
not inserted into rt_uncached_list.
This slowdown multicast workloads on SMP because rt_uncached_lock is
contended.
Change the test before taking the lock to actually check the dst
was inserted into rt_uncached_list.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv4/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8c8c748..24fd4c5 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1263,7 +1263,7 @@ static void ipv4_dst_destroy(struct dst_entry *dst)
{
struct rtable *rt = (struct rtable *) dst;
- if (dst->flags & DST_NOCACHE) {
+ if (!list_empty(&rt->rt_uncached)) {
spin_lock_bh(&rt_uncached_lock);
list_del(&rt->rt_uncached);
spin_unlock_bh(&rt_uncached_lock);
^ permalink raw reply related
* Re: [net-next 11/13] igb: Update PTP function names/variables and locations.
From: David Miller @ 2012-08-24 15:12 UTC (permalink / raw)
To: joe
Cc: richardcochran, matthew.vick, jeffrey.t.kirsher, netdev, gospo,
sassmann
In-Reply-To: <1345800154.16471.20.camel@joe2Laptop>
From: Joe Perches <joe@perches.com>
Date: Fri, 24 Aug 2012 02:22:34 -0700
> On Fri, 2012-08-24 at 08:32 +0200, Richard Cochran wrote:
>> On Thu, Aug 23, 2012 at 08:02:25PM -0700, Joe Perches wrote:
>>
>> > Improving code clarity and consistency isn't churn.
>>
>> This patch series moves code around for no good reason. That is, by
>> definition, churn.
>
> For your definition of good.
I think the people doing all of the actual development and
maintainence of the code get to decide how to define good. And in
this case that's basically the Intel NIC development team, not you.
Moving functions around is a very valuable and useful cleanup quite
often.
So you can count me in on their definition of "good" as well.
^ permalink raw reply
* Re: [PATCH v2 00/10] cgroup: Assign subsystem IDs during compile time
From: Daniel Wagner @ 2012-08-24 15:01 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Daniel Wagner, David S. Miller, Andrew Morton, Eric Dumazet,
Gao feng, Glauber Costa, Jamal Hadi Salim, John Fastabend,
Kamezawa Hiroyuki, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345816904-21745-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
On 24.08.2012 16:01, Daniel Wagner wrote:
> CGROUP_BUILTIN_SUBSYS_COUNT is also gone in this version. This time I
> trade space for speed. Some extra cycles are spend to identify the
> modules in the for loops, e.g.
>
> for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
> struct cgroup_subsys_state *ss = cgrp->subsys[i];
>
> /* at bootup time, we don't worry about modular subsystems */
> if (!ss || (ss && ss->module))
> continue;
>
> [...]
> }
>
> CGROUP_SUBSYS_COUNT is currently 12 if all controllers are built. I
> haven't found any other way to get rid of CGROUP_BUILTIN_SUBSYS_COUNT
> without real dirty preprocessor tricks.
As usual, the good ideas come right after sending patches:
enum cgroup_subsys_id {
#define SUBSYS(_x) _x ## _subsys_id,
#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
#include <linux/cgroup_subsys.h>
#undef IS_SUBSYS_ENABLED
CGROUP_BUILTIN_SUBSYS_COUNT,
CGROUP_BUILTIN_SUBSYS_LAST = CGROUP_BUILTIN_SUBSYS_COUNT - 1,
#define IS_SUBSYS_ENABLED(option) IS_MODULE(option)
#include <linux/cgroup_subsys.h>
#undef IS_SUBSYS_ENABLED
#undef SUBSYS
CGROUP_SUBSYS_COUNT,
};
Would that be an acceptable solution?
cheers,
daniel
^ permalink raw reply
* [PATCH v2 08/10] cgroup: net_cls: Merge builtin and module version of task_cls_classid()
From: Daniel Wagner @ 2012-08-24 14:01 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Gao feng, Jamal Hadi Salim,
John Fastabend, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345816904-21745-1-git-send-email-wagi@monom.org>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/net/cls_cgroup.h | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 5906a25..d96dc59 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -29,26 +29,15 @@ extern void sock_update_classid(struct sock *sk);
#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
-static inline u32 task_cls_classid(struct task_struct *p)
-{
- int classid;
-
- if (in_interrupt())
- return 0;
-
- rcu_read_lock();
- classid = container_of(task_subsys_state(p, net_cls_subsys_id),
- struct cgroup_cls_state, css)->classid;
- rcu_read_unlock();
-
- return classid;
-}
+#define clscg_enabled 1
#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
extern struct static_key cgroup_cls_enabled;
#define clscg_enabled static_key_false(&cgroup_cls_enabled)
+#endif
+
static inline u32 task_cls_classid(struct task_struct *p)
{
u32 classid;
@@ -64,8 +53,6 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid;
}
-#endif
-
#else /* !CONFIG_NET_CLS_CGROUP */
static inline u32 task_cls_classid(struct task_struct *p)
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v2 05/10] cgroup: Remove CGROUP_BUILTIN_SUBSYS_COUNT
From: Daniel Wagner @ 2012-08-24 14:01 UTC (permalink / raw)
To: netdev, cgroups; +Cc: Daniel Wagner, Tejun Heo, Li Zefan, David S. Miller
In-Reply-To: <1345816904-21745-1-git-send-email-wagi@monom.org>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
CGROUP_BUILTIN_SUBSYS_COUNT is used as start or stop point
when looping over the subsys array. Since the subsys array is
64 entries long this is a good thing to do. Though we'd like
to reduce the array size considerable but we need to get rid
of CGROUP_BUILTIN_SUBSYS_COUNT to ease up the review process.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: Li Zefan <lizefan@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/linux/cgroup.h | 1 -
kernel/cgroup.c | 75 +++++++++++++++++++++++++++++++-------------------
2 files changed, 47 insertions(+), 29 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c90eaa8..3787872 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -47,7 +47,6 @@ extern const struct file_operations proc_cgroup_operations;
#define SUBSYS(_x) _x ## _subsys_id,
enum cgroup_subsys_id {
#include <linux/cgroup_subsys.h>
- CGROUP_BUILTIN_SUBSYS_COUNT
};
#undef SUBSYS
/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 7981850..f9433b4 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -88,7 +88,7 @@ static DEFINE_MUTEX(cgroup_root_mutex);
/*
* Generate an array of cgroup subsystem pointers. At boot time, this is
- * populated up to CGROUP_BUILTIN_SUBSYS_COUNT, and modular subsystems are
+ * populated with the built in subsystems, and modular subsystems are
* registered after that. The mutable section of this array is protected by
* cgroup_mutex.
*/
@@ -1291,11 +1291,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
* take duplicate reference counts on a subsystem that's already used,
* but rebind_subsystems handles this case.
*/
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
unsigned long bit = 1UL << i;
if (!(bit & opts->subsys_bits))
continue;
+ if (!subsys[i]->module)
+ continue;
if (!try_module_get(subsys[i]->module)) {
module_pin_failed = true;
break;
@@ -1307,12 +1309,14 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
* raced with a module_delete call, and to the user this is
* essentially a "subsystem doesn't exist" case.
*/
- for (i--; i >= CGROUP_BUILTIN_SUBSYS_COUNT; i--) {
+ for (i--; i > 1; i--) {
/* drop refcounts only on the ones we took */
unsigned long bit = 1UL << i;
if (!(bit & opts->subsys_bits))
continue;
+ if (!subsys[i]->module)
+ continue;
module_put(subsys[i]->module);
}
return -ENOENT;
@@ -1324,11 +1328,13 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
static void drop_parsed_module_refcounts(unsigned long subsys_bits)
{
int i;
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
unsigned long bit = 1UL << i;
if (!(bit & subsys_bits))
continue;
+ if (!subsys[i]->module)
+ continue;
module_put(subsys[i]->module);
}
}
@@ -1401,6 +1407,7 @@ static void init_cgroup_housekeeping(struct cgroup *cgrp)
mutex_init(&cgrp->pidlist_mutex);
INIT_LIST_HEAD(&cgrp->event_list);
spin_lock_init(&cgrp->event_list_lock);
+ memset(cgrp->subsys, 0, sizeof(cgrp->subsys));
}
static void init_cgroup_root(struct cgroupfs_root *root)
@@ -4321,8 +4328,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
* since cgroup_init_subsys will have already taken care of it.
*/
if (ss->module == NULL) {
- /* a few sanity checks */
- BUG_ON(ss->subsys_id >= CGROUP_BUILTIN_SUBSYS_COUNT);
+ /* a sanity check */
BUG_ON(subsys[ss->subsys_id] != ss);
return 0;
}
@@ -4336,7 +4342,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
*/
mutex_lock(&cgroup_mutex);
/* find the first empty slot in the array */
- for (i = CGROUP_BUILTIN_SUBSYS_COUNT; i < CGROUP_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
if (subsys[i] == NULL)
break;
}
@@ -4439,7 +4445,6 @@ void cgroup_unload_subsys(struct cgroup_subsys *ss)
mutex_lock(&cgroup_mutex);
/* deassign the subsys_id */
- BUG_ON(ss->subsys_id < CGROUP_BUILTIN_SUBSYS_COUNT);
subsys[ss->subsys_id] = NULL;
/* remove subsystem from rootnode's list of subsystems */
@@ -4502,10 +4507,13 @@ int __init cgroup_init_early(void)
for (i = 0; i < CSS_SET_TABLE_SIZE; i++)
INIT_HLIST_HEAD(&css_set_table[i]);
- /* at bootup time, we don't worry about modular subsystems */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+ /* at bootup time, we don't worry about modular subsystems */
+ if (!ss || (ss && ss->module))
+ continue;
+
BUG_ON(!ss->name);
BUG_ON(strlen(ss->name) > MAX_CGROUP_TYPE_NAMELEN);
BUG_ON(!ss->create);
@@ -4538,9 +4546,12 @@ int __init cgroup_init(void)
if (err)
return err;
- /* at bootup time, we don't worry about modular subsystems */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+
+ /* at bootup time, we don't worry about modular subsystems */
+ if (!ss || (ss && ss->module))
+ continue;
if (!ss->early_init)
cgroup_init_subsys(ss);
if (ss->use_id)
@@ -4735,13 +4746,16 @@ void cgroup_fork_callbacks(struct task_struct *child)
{
if (need_forkexit_callback) {
int i;
- /*
- * forkexit callbacks are only supported for builtin
- * subsystems, and the builtin section of the subsys array is
- * immutable, so we don't need to lock the subsys array here.
- */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+
+ /*
+ * forkexit callbacks are only supported for
+ * builtin subsystems.
+ */
+ if (!ss || (ss && ss->module))
+ continue;
+
if (ss->fork)
ss->fork(child);
}
@@ -4846,12 +4860,13 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
tsk->cgroups = &init_css_set;
if (run_callbacks && need_forkexit_callback) {
- /*
- * modular subsystems can't use callbacks, so no need to lock
- * the subsys array
- */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+
+ /* modular subsystems can't use callbacks */
+ if (!ss || (ss && ss->module))
+ continue;
+
if (ss->exit) {
struct cgroup *old_cgrp =
rcu_dereference_raw(cg->subsys[i])->cgroup;
@@ -5037,13 +5052,17 @@ static int __init cgroup_disable(char *str)
while ((token = strsep(&str, ",")) != NULL) {
if (!*token)
continue;
- /*
- * cgroup_disable, being at boot time, can't know about module
- * subsystems, so we don't worry about them.
- */
- for (i = 0; i < CGROUP_BUILTIN_SUBSYS_COUNT; i++) {
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
struct cgroup_subsys *ss = subsys[i];
+ /*
+ * cgroup_disable, being at boot time, can't
+ * know about module subsystems, so we don't
+ * worry about them.
+ */
+ if (!ss || (ss && ss->module))
+ continue;
+
if (!strcmp(token, ss->name)) {
ss->disabled = 1;
printk(KERN_INFO "Disabling %s control group"
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v2 06/10] cgroup: Assign subsystem IDs during compile time
From: Daniel Wagner @ 2012-08-24 14:01 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Andrew Morton, Eric Dumazet,
Gao feng, Glauber Costa, Jamal Hadi Salim, John Fastabend,
Kamezawa Hiroyuki, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345816904-21745-1-git-send-email-wagi@monom.org>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
We are able to safe some space when we assign the subsystem
IDs at compile time. Instead of allocating per cgroup
cgroup->subsys[CGROUP_SUBSYS_COUNT] where CGROUP_SUBSYS_COUNT is
always 64, we allocate at max 12 (at this point there are 12
subsystem).
task_cls_classid() and task_netprioidx() (when built as
module) are protected by a jump label and therefore we can
simply replace the subsystem index lookup with the enum.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/linux/cgroup.h | 29 ++++++++++++++++++++---------
include/linux/cgroup_subsys.h | 24 ++++++++++++------------
include/net/cls_cgroup.h | 12 +++---------
include/net/netprio_cgroup.h | 17 ++++-------------
kernel/cgroup.c | 25 ++++++-------------------
net/core/netprio_cgroup.c | 11 -----------
net/core/sock.c | 9 ---------
net/sched/cls_cgroup.c | 13 -------------
8 files changed, 45 insertions(+), 95 deletions(-)
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 3787872..ada517f 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -43,18 +43,27 @@ extern void cgroup_unload_subsys(struct cgroup_subsys *ss);
extern const struct file_operations proc_cgroup_operations;
-/* Define the enumeration of all builtin cgroup subsystems */
-#define SUBSYS(_x) _x ## _subsys_id,
+/*
+ * Define the enumeration of all builtin cgroup subsystems.
+ * For the builtin subsystems the subsys_id needs to be indentical
+ * with the index in css->subsys. Therefore, all the builtin
+ * subsys are listed first and then the modules ids.
+ */
enum cgroup_subsys_id {
+#define SUBSYS(_x) _x ## _subsys_id,
+
+#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
#include <linux/cgroup_subsys.h>
-};
+#undef IS_SUBSYS_ENABLED
+
+#define IS_SUBSYS_ENABLED(option) IS_MODULE(option)
+#include <linux/cgroup_subsys.h>
+#undef IS_SUBSYS_ENABLED
+
#undef SUBSYS
-/*
- * This define indicates the maximum number of subsystems that can be loaded
- * at once. We limit to this many since cgroupfs_root has subsys_bits to keep
- * track of all of them.
- */
-#define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long))
+
+ CGROUP_SUBSYS_COUNT,
+};
/* Per-subsystem/per-cgroup state maintained by the system. */
struct cgroup_subsys_state {
@@ -520,8 +529,10 @@ struct cgroup_subsys {
};
#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
+#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
#include <linux/cgroup_subsys.h>
#undef SUBSYS
+#undef IS_SUBSYS_ENABLED
static inline struct cgroup_subsys_state *cgroup_subsys_state(
struct cgroup *cgrp, int subsys_id)
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index dfae957..f204a7a 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -7,73 +7,73 @@
/* */
-#ifdef CONFIG_CPUSETS
+#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
SUBSYS(cpuset)
#endif
/* */
-#ifdef CONFIG_CGROUP_DEBUG
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
SUBSYS(debug)
#endif
/* */
-#ifdef CONFIG_CGROUP_SCHED
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
SUBSYS(cpu_cgroup)
#endif
/* */
-#ifdef CONFIG_CGROUP_CPUACCT
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
SUBSYS(cpuacct)
#endif
/* */
-#ifdef CONFIG_MEMCG
+#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
SUBSYS(mem_cgroup)
#endif
/* */
-#ifdef CONFIG_CGROUP_DEVICE
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
SUBSYS(devices)
#endif
/* */
-#ifdef CONFIG_CGROUP_FREEZER
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
SUBSYS(freezer)
#endif
/* */
-#ifdef CONFIG_NET_CLS_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
SUBSYS(net_cls)
#endif
/* */
-#ifdef CONFIG_BLK_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
SUBSYS(blkio)
#endif
/* */
-#ifdef CONFIG_CGROUP_PERF
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
SUBSYS(perf)
#endif
/* */
-#ifdef CONFIG_NETPRIO_CGROUP
+#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
SUBSYS(net_prio)
#endif
/* */
-#ifdef CONFIG_CGROUP_HUGETLB
+#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
SUBSYS(hugetlb)
#endif
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 24443d2..43fae13 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -49,22 +49,16 @@ static inline u32 task_cls_classid(struct task_struct *p)
extern struct static_key cgroup_cls_enabled;
#define clscg_enabled static_key_false(&cgroup_cls_enabled)
-extern int net_cls_subsys_id;
-
static inline u32 task_cls_classid(struct task_struct *p)
{
- int id;
- u32 classid = 0;
+ u32 classid;
if (!clscg_enabled || in_interrupt())
return 0;
rcu_read_lock();
- id = rcu_dereference_index_check(net_cls_subsys_id,
- rcu_read_lock_held());
- if (id >= 0)
- classid = container_of(task_subsys_state(p, id),
- struct cgroup_cls_state, css)->classid;
+ classid = container_of(task_subsys_state(p, net_cls_subsys_id),
+ struct cgroup_cls_state, css)->classid;
rcu_read_unlock();
return classid;
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 9ff58e4..66241c6 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -31,10 +31,6 @@ struct cgroup_netprio_state {
u32 prioidx;
};
-#ifndef CONFIG_NETPRIO_CGROUP
-extern int net_prio_subsys_id;
-#endif
-
extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
@@ -60,20 +56,15 @@ extern struct static_key cgroup_netprio_enabled;
static inline u32 task_netprioidx(struct task_struct *p)
{
struct cgroup_netprio_state *state;
- int subsys_id;
- u32 idx = 0;
+ u32 idx;
if (!netpriocg_enabled)
return 0;
rcu_read_lock();
- subsys_id = rcu_dereference_index_check(net_prio_subsys_id,
- rcu_read_lock_held());
- if (subsys_id >= 0) {
- state = container_of(task_subsys_state(p, subsys_id),
- struct cgroup_netprio_state, css);
- idx = state->prioidx;
- }
+ state = container_of(task_subsys_state(p, net_prio_subsys_id),
+ struct cgroup_netprio_state, css);
+ idx = state->prioidx;
rcu_read_unlock();
return idx;
}
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f9433b4..ee55f84 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -93,8 +93,11 @@ static DEFINE_MUTEX(cgroup_root_mutex);
* cgroup_mutex.
*/
#define SUBSYS(_x) &_x ## _subsys,
+#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
static struct cgroup_subsys *subsys[CGROUP_SUBSYS_COUNT] = {
#include <linux/cgroup_subsys.h>
+#undef IS_SUBSYS_ENABLED
+#undef SUBSYS
};
#define MAX_CGROUP_ROOT_NAMELEN 64
@@ -4336,24 +4339,8 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
/* init base cftset */
cgroup_init_cftsets(ss);
- /*
- * need to register a subsys id before anything else - for example,
- * init_cgroup_css needs it.
- */
mutex_lock(&cgroup_mutex);
- /* find the first empty slot in the array */
- for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
- if (subsys[i] == NULL)
- break;
- }
- if (i == CGROUP_SUBSYS_COUNT) {
- /* maximum number of subsystems already registered! */
- mutex_unlock(&cgroup_mutex);
- return -EBUSY;
- }
- /* assign ourselves the subsys_id */
- ss->subsys_id = i;
- subsys[i] = ss;
+ subsys[ss->subsys_id] = ss;
/*
* no ss->create seems to need anything important in the ss struct, so
@@ -4362,7 +4349,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
css = ss->create(dummytop);
if (IS_ERR(css)) {
/* failure case - need to deassign the subsys[] slot. */
- subsys[i] = NULL;
+ subsys[ss->subsys_id] = NULL;
mutex_unlock(&cgroup_mutex);
return PTR_ERR(css);
}
@@ -4378,7 +4365,7 @@ int __init_or_module cgroup_load_subsys(struct cgroup_subsys *ss)
if (ret) {
dummytop->subsys[ss->subsys_id] = NULL;
ss->destroy(dummytop);
- subsys[i] = NULL;
+ subsys[ss->subsys_id] = NULL;
mutex_unlock(&cgroup_mutex);
return ret;
}
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index 400ab94..a029ffe 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -326,9 +326,7 @@ struct cgroup_subsys net_prio_subsys = {
.create = cgrp_create,
.destroy = cgrp_destroy,
.attach = net_prio_attach,
-#ifdef CONFIG_NETPRIO_CGROUP
.subsys_id = net_prio_subsys_id,
-#endif
.base_cftypes = ss_files,
.module = THIS_MODULE
};
@@ -366,10 +364,6 @@ static int __init init_cgroup_netprio(void)
ret = cgroup_load_subsys(&net_prio_subsys);
if (ret)
goto out;
-#ifndef CONFIG_NETPRIO_CGROUP
- smp_wmb();
- net_prio_subsys_id = net_prio_subsys.subsys_id;
-#endif
#if IS_MODULE(CONFIG_NETPRIO_CGROUP)
static_key_slow_inc(&cgroup_netprio_enabled);
@@ -390,11 +384,6 @@ static void __exit exit_cgroup_netprio(void)
cgroup_unload_subsys(&net_prio_subsys);
-#ifndef CONFIG_NETPRIO_CGROUP
- net_prio_subsys_id = -1;
- synchronize_rcu();
-#endif
-
#if IS_MODULE(CONFIG_NETPRIO_CGROUP)
static_key_slow_dec(&cgroup_netprio_enabled);
rcu_barrier();
diff --git a/net/core/sock.c b/net/core/sock.c
index 1f119d2..aa762d9 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -335,15 +335,6 @@ EXPORT_SYMBOL_GPL(cgroup_cls_enabled);
struct static_key cgroup_netprio_enabled = STATIC_KEY_INIT_FALSE;
EXPORT_SYMBOL_GPL(cgroup_netprio_enabled);
#endif
-
-#if !defined(CONFIG_NET_CLS_CGROUP)
-int net_cls_subsys_id = -1;
-EXPORT_SYMBOL_GPL(net_cls_subsys_id);
-#endif
-#if !defined(CONFIG_NETPRIO_CGROUP)
-int net_prio_subsys_id = -1;
-EXPORT_SYMBOL_GPL(net_prio_subsys_id);
-#endif
#endif
static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 554dc5b..a196b77 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -77,9 +77,7 @@ struct cgroup_subsys net_cls_subsys = {
.name = "net_cls",
.create = cgrp_create,
.destroy = cgrp_destroy,
-#ifdef CONFIG_NET_CLS_CGROUP
.subsys_id = net_cls_subsys_id,
-#endif
.base_cftypes = ss_files,
.module = THIS_MODULE,
};
@@ -283,12 +281,6 @@ static int __init init_cgroup_cls(void)
if (ret)
goto out;
-#ifndef CONFIG_NET_CLS_CGROUP
- /* We can't use rcu_assign_pointer because this is an int. */
- smp_wmb();
- net_cls_subsys_id = net_cls_subsys.subsys_id;
-#endif
-
ret = register_tcf_proto_ops(&cls_cgroup_ops);
if (ret)
cgroup_unload_subsys(&net_cls_subsys);
@@ -307,11 +299,6 @@ static void __exit exit_cgroup_cls(void)
{
unregister_tcf_proto_ops(&cls_cgroup_ops);
-#ifndef CONFIG_NET_CLS_CGROUP
- net_cls_subsys_id = -1;
- synchronize_rcu();
-#endif
-
#if IS_MODULE(CONFIG_NET_CLS_CGROUP)
static_key_slow_dec(&cgroup_cls_enabled);
rcu_barrier();
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v2 03/10] cgroup: net_cls: Protect access to task_cls_classid() when built as module
From: Daniel Wagner @ 2012-08-24 14:01 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Gao feng, Jamal Hadi Salim,
John Fastabend, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345816904-21745-1-git-send-email-wagi@monom.org>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
The module version of task_cls_classid() checks if net_cls_sbusys_id
is valid to indentify when it is okay to access the controller.
Instead relying on the subusys_id to be set, make it explicit
with a jump label.
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/net/cls_cgroup.h | 6 +++++-
net/core/sock.c | 5 +++++
net/sched/cls_cgroup.c | 11 +++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 401672c..24443d2 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -16,6 +16,7 @@
#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>
+#include <linux/jump_label.h>
#ifdef CONFIG_CGROUPS
struct cgroup_cls_state
@@ -45,6 +46,9 @@ static inline u32 task_cls_classid(struct task_struct *p)
#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
+extern struct static_key cgroup_cls_enabled;
+#define clscg_enabled static_key_false(&cgroup_cls_enabled)
+
extern int net_cls_subsys_id;
static inline u32 task_cls_classid(struct task_struct *p)
@@ -52,7 +56,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
int id;
u32 classid = 0;
- if (in_interrupt())
+ if (!clscg_enabled || in_interrupt())
return 0;
rcu_read_lock();
diff --git a/net/core/sock.c b/net/core/sock.c
index 8f67ced..8106e77 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -327,6 +327,11 @@ int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
EXPORT_SYMBOL(__sk_backlog_rcv);
#if defined(CONFIG_CGROUPS)
+#if IS_MODULE(CONFIG_NET_CLS_CGROUP)
+struct static_key cgroup_cls_enabled = STATIC_KEY_INIT_FALSE;
+EXPORT_SYMBOL_GPL(cgroup_cls_enabled);
+#endif
+
#if !defined(CONFIG_NET_CLS_CGROUP)
int net_cls_subsys_id = -1;
EXPORT_SYMBOL_GPL(net_cls_subsys_id);
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 7743ea8..554dc5b 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -293,6 +293,12 @@ static int __init init_cgroup_cls(void)
if (ret)
cgroup_unload_subsys(&net_cls_subsys);
+#if IS_MODULE(CONFIG_NET_CLS_CGROUP)
+ if (ret)
+ goto out;
+ static_key_slow_inc(&cgroup_cls_enabled);
+#endif
+
out:
return ret;
}
@@ -306,6 +312,11 @@ static void __exit exit_cgroup_cls(void)
synchronize_rcu();
#endif
+#if IS_MODULE(CONFIG_NET_CLS_CGROUP)
+ static_key_slow_dec(&cgroup_cls_enabled);
+ rcu_barrier();
+#endif
+
cgroup_unload_subsys(&net_cls_subsys);
}
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v2 01/10] cgroup: net_cls: Use empty task_cls_classid() when !CONFIG_NET_CLS(_MODULE)
From: Daniel Wagner @ 2012-08-24 14:01 UTC (permalink / raw)
To: netdev, cgroups
Cc: Daniel Wagner, David S. Miller, Gao feng, Jamal Hadi Salim,
John Fastabend, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345816904-21745-1-git-send-email-wagi@monom.org>
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Gao feng <gaofeng@cn.fujitsu.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: John Fastabend <john.r.fastabend@intel.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: netdev@vger.kernel.org
Cc: cgroups@vger.kernel.org
---
include/net/cls_cgroup.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index a4dc5b0..e2fe2b9 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -24,7 +24,8 @@ struct cgroup_cls_state
u32 classid;
};
-#ifdef CONFIG_NET_CLS_CGROUP
+#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
+
static inline u32 task_cls_classid(struct task_struct *p)
{
int classid;
@@ -39,7 +40,9 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid;
}
-#else
+
+#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
+
extern int net_cls_subsys_id;
static inline u32 task_cls_classid(struct task_struct *p)
@@ -60,11 +63,16 @@ static inline u32 task_cls_classid(struct task_struct *p)
return classid;
}
-#endif
+
#else
+
static inline u32 task_cls_classid(struct task_struct *p)
{
return 0;
}
-#endif
+
+#endif /* CONFIG_NET_CLS_CGROUP */
+
+#endif /* CONFIG_CGROURPS */
+
#endif /* _NET_CLS_CGROUP_H */
--
1.7.12.rc1.16.g05a20c8
^ permalink raw reply related
* [PATCH v2 10/10] cgroup: net_prio: Merge builtin and module version of task_netprioidx()
From: Daniel Wagner @ 2012-08-24 14:01 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA, cgroups-u79uwXL29TY76Z2rM5mHXA
Cc: Daniel Wagner, David S. Miller, Gao feng, Jamal Hadi Salim,
John Fastabend, Li Zefan, Neil Horman, Tejun Heo
In-Reply-To: <1345816904-21745-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Signed-off-by: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>
Cc: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Cc: Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
include/net/netprio_cgroup.h | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index ab22019..180ff5e 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -35,24 +35,15 @@ extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
-static inline u32 task_netprioidx(struct task_struct *p)
-{
- struct cgroup_netprio_state *state;
- u32 idx;
-
- rcu_read_lock();
- state = container_of(task_subsys_state(p, net_prio_subsys_id),
- struct cgroup_netprio_state, css);
- idx = state->prioidx;
- rcu_read_unlock();
- return idx;
-}
+#define netpriocg_enabled 1
#elif IS_MODULE(CONFIG_NETPRIO_CGROUP)
extern struct static_key cgroup_netprio_enabled;
#define netpriocg_enabled static_key_false(&cgroup_netprio_enabled)
+#endif
+
static inline u32 task_netprioidx(struct task_struct *p)
{
struct cgroup_netprio_state *state;
@@ -69,8 +60,6 @@ static inline u32 task_netprioidx(struct task_struct *p)
return idx;
}
-#endif
-
#else /* !CONFIG_NETPRIO_CGROUP */
static inline u32 task_netprioidx(struct task_struct *p)
--
1.7.12.rc1.16.g05a20c8
^ 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