* [PATCH net-next 3/3] dsa: Move switch drivers to new directory drivers/net/dsa
From: Ben Hutchings @ 2011-11-28 3:08 UTC (permalink / raw)
To: David Miller; +Cc: Lennert Buytenhek, netdev
In-Reply-To: <1322449506.7454.34.camel@deadeye>
Support for specific hardware belongs under drivers/net/ not net/.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
This seems to work, but again it's compile-tested only.
Ben.
drivers/net/Kconfig | 2 +
drivers/net/Makefile | 1 +
drivers/net/dsa/Kconfig | 36 ++++++++++++++++++++++++++++
drivers/net/dsa/Makefile | 9 +++++++
{net => drivers/net}/dsa/mv88e6060.c | 0
{net => drivers/net}/dsa/mv88e6123_61_65.c | 0
{net => drivers/net}/dsa/mv88e6131.c | 0
{net => drivers/net}/dsa/mv88e6xxx.c | 0
{net => drivers/net}/dsa/mv88e6xxx.h | 0
net/dsa/Kconfig | 36 +---------------------------
net/dsa/Makefile | 11 --------
11 files changed, 49 insertions(+), 46 deletions(-)
create mode 100644 drivers/net/dsa/Kconfig
create mode 100644 drivers/net/dsa/Makefile
rename {net => drivers/net}/dsa/mv88e6060.c (100%)
rename {net => drivers/net}/dsa/mv88e6123_61_65.c (100%)
rename {net => drivers/net}/dsa/mv88e6131.c (100%)
rename {net => drivers/net}/dsa/mv88e6xxx.c (100%)
rename {net => drivers/net}/dsa/mv88e6xxx.h (100%)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index debdf1c..9845afb 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -243,6 +243,8 @@ source "drivers/atm/Kconfig"
source "drivers/net/caif/Kconfig"
+source "drivers/net/dsa/Kconfig"
+
source "drivers/net/ethernet/Kconfig"
source "drivers/net/fddi/Kconfig"
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 4e4ebfe..1988881 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_DEV_APPLETALK) += appletalk/
obj-$(CONFIG_CAIF) += caif/
obj-$(CONFIG_CAN) += can/
obj-$(CONFIG_ETRAX_ETHERNET) += cris/
+obj-$(CONFIG_NET_DSA) += dsa/
obj-$(CONFIG_ETHERNET) += ethernet/
obj-$(CONFIG_FDDI) += fddi/
obj-$(CONFIG_HIPPI) += hippi/
diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
new file mode 100644
index 0000000..dd151d5
--- /dev/null
+++ b/drivers/net/dsa/Kconfig
@@ -0,0 +1,36 @@
+menu "Distributed Switch Architecture drivers"
+ depends on NET_DSA
+
+config NET_DSA_MV88E6XXX
+ tristate
+ default n
+
+config NET_DSA_MV88E6060
+ tristate "Marvell 88E6060 ethernet switch chip support"
+ select NET_DSA_TAG_TRAILER
+ ---help---
+ This enables support for the Marvell 88E6060 ethernet switch
+ chip.
+
+config NET_DSA_MV88E6XXX_NEED_PPU
+ bool
+ default n
+
+config NET_DSA_MV88E6131
+ tristate "Marvell 88E6085/6095/6095F/6131 ethernet switch chip support"
+ select NET_DSA_MV88E6XXX
+ select NET_DSA_MV88E6XXX_NEED_PPU
+ select NET_DSA_TAG_DSA
+ ---help---
+ This enables support for the Marvell 88E6085/6095/6095F/6131
+ ethernet switch chips.
+
+config NET_DSA_MV88E6123_61_65
+ tristate "Marvell 88E6123/6161/6165 ethernet switch chip support"
+ select NET_DSA_MV88E6XXX
+ select NET_DSA_TAG_EDSA
+ ---help---
+ This enables support for the Marvell 88E6123/6161/6165
+ ethernet switch chips.
+
+endmenu
diff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile
new file mode 100644
index 0000000..f3bda05
--- /dev/null
+++ b/drivers/net/dsa/Makefile
@@ -0,0 +1,9 @@
+obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
+obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx_drv.o
+mv88e6xxx_drv-y += mv88e6xxx.o
+ifdef CONFIG_NET_DSA_MV88E6123_61_65
+mv88e6xxx_drv-y += mv88e6123_61_65.o
+endif
+ifdef CONFIG_NET_DSA_MV88E6131
+mv88e6xxx_drv-y += mv88e6131.o
+endif
diff --git a/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
similarity index 100%
rename from net/dsa/mv88e6060.c
rename to drivers/net/dsa/mv88e6060.c
diff --git a/net/dsa/mv88e6123_61_65.c b/drivers/net/dsa/mv88e6123_61_65.c
similarity index 100%
rename from net/dsa/mv88e6123_61_65.c
rename to drivers/net/dsa/mv88e6123_61_65.c
diff --git a/net/dsa/mv88e6131.c b/drivers/net/dsa/mv88e6131.c
similarity index 100%
rename from net/dsa/mv88e6131.c
rename to drivers/net/dsa/mv88e6131.c
diff --git a/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
similarity index 100%
rename from net/dsa/mv88e6xxx.c
rename to drivers/net/dsa/mv88e6xxx.c
diff --git a/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
similarity index 100%
rename from net/dsa/mv88e6xxx.h
rename to drivers/net/dsa/mv88e6xxx.h
diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
index 7e12303..274791c 100644
--- a/net/dsa/Kconfig
+++ b/net/dsa/Kconfig
@@ -1,4 +1,4 @@
-menuconfig NET_DSA
+config NET_DSA
tristate "Distributed Switch Architecture support"
default n
depends on EXPERIMENTAL && NETDEVICES && !S390
@@ -23,38 +23,4 @@ config NET_DSA_TAG_TRAILER
bool
default n
-
-# switch drivers
-config NET_DSA_MV88E6XXX
- tristate
- default n
-
-config NET_DSA_MV88E6060
- tristate "Marvell 88E6060 ethernet switch chip support"
- select NET_DSA_TAG_TRAILER
- ---help---
- This enables support for the Marvell 88E6060 ethernet switch
- chip.
-
-config NET_DSA_MV88E6XXX_NEED_PPU
- bool
- default n
-
-config NET_DSA_MV88E6131
- tristate "Marvell 88E6085/6095/6095F/6131 ethernet switch chip support"
- select NET_DSA_MV88E6XXX
- select NET_DSA_MV88E6XXX_NEED_PPU
- select NET_DSA_TAG_DSA
- ---help---
- This enables support for the Marvell 88E6085/6095/6095F/6131
- ethernet switch chips.
-
-config NET_DSA_MV88E6123_61_65
- tristate "Marvell 88E6123/6161/6165 ethernet switch chip support"
- select NET_DSA_MV88E6XXX
- select NET_DSA_TAG_EDSA
- ---help---
- This enables support for the Marvell 88E6123/6161/6165
- ethernet switch chips.
-
endif
diff --git a/net/dsa/Makefile b/net/dsa/Makefile
index 191dd48..7b9fcbb 100644
--- a/net/dsa/Makefile
+++ b/net/dsa/Makefile
@@ -6,14 +6,3 @@ dsa_core-y += dsa.o slave.o
dsa_core-$(CONFIG_NET_DSA_TAG_DSA) += tag_dsa.o
dsa_core-$(CONFIG_NET_DSA_TAG_EDSA) += tag_edsa.o
dsa_core-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
-
-# switch drivers
-obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
-obj-$(CONFIG_NET_DSA_MV88E6XXX) += mv88e6xxx_drv.o
-mv88e6xxx_drv-y += mv88e6xxx.o
-ifdef CONFIG_NET_DSA_MV88E6123_61_65
-mv88e6xxx_drv-y += mv88e6123_61_65.o
-endif
-ifdef CONFIG_NET_DSA_MV88E6131
-mv88e6xxx_drv-y += mv88e6131.o
-endif
--
1.7.7.3
^ permalink raw reply related
* [PATCH net-next 2/3] dsa: Move all definitions needed by drivers into <net/dsa.h>
From: Ben Hutchings @ 2011-11-28 3:06 UTC (permalink / raw)
To: David Miller; +Cc: Lennert Buytenhek, netdev
In-Reply-To: <1322449506.7454.34.camel@deadeye>
Any headers included by drivers should be under include/, and
any definitions they use are not really private to the core as
the name "dsa_priv.h" suggests.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
include/net/dsa.h | 90 ++++++++++++++++++++++++++++++++++++++++++++
net/dsa/dsa_priv.h | 91 ---------------------------------------------
net/dsa/mv88e6060.c | 2 +-
net/dsa/mv88e6123_61_65.c | 2 +-
net/dsa/mv88e6131.c | 2 +-
net/dsa/mv88e6xxx.c | 2 +-
6 files changed, 94 insertions(+), 95 deletions(-)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 32a1b49..b78db3c 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -11,6 +11,7 @@
#ifndef __LINUX_NET_DSA_H
#define __LINUX_NET_DSA_H
+#include <linux/list.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
@@ -90,6 +91,95 @@ struct dsa_switch_tree {
struct dsa_switch *ds[DSA_MAX_SWITCHES];
};
+struct dsa_switch {
+ /*
+ * Parent switch tree, and switch index.
+ */
+ struct dsa_switch_tree *dst;
+ int index;
+
+ /*
+ * Configuration data for this switch.
+ */
+ struct dsa_chip_data *pd;
+
+ /*
+ * The used switch driver.
+ */
+ struct dsa_switch_driver *drv;
+
+ /*
+ * Reference to mii bus to use.
+ */
+ struct mii_bus *master_mii_bus;
+
+ /*
+ * Slave mii_bus and devices for the individual ports.
+ */
+ u32 dsa_port_mask;
+ u32 phys_port_mask;
+ struct mii_bus *slave_mii_bus;
+ struct net_device *ports[DSA_MAX_PORTS];
+};
+
+static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
+{
+ return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);
+}
+
+static inline u8 dsa_upstream_port(struct dsa_switch *ds)
+{
+ struct dsa_switch_tree *dst = ds->dst;
+
+ /*
+ * If this is the root switch (i.e. the switch that connects
+ * to the CPU), return the cpu port number on this switch.
+ * Else return the (DSA) port number that connects to the
+ * switch that is one hop closer to the cpu.
+ */
+ if (dst->cpu_switch == ds->index)
+ return dst->cpu_port;
+ else
+ return ds->pd->rtable[dst->cpu_switch];
+}
+
+struct dsa_switch_driver {
+ struct list_head list;
+
+ __be16 tag_protocol;
+ int priv_size;
+
+ /*
+ * Probing and setup.
+ */
+ char *(*probe)(struct mii_bus *bus, int sw_addr);
+ int (*setup)(struct dsa_switch *ds);
+ int (*set_addr)(struct dsa_switch *ds, u8 *addr);
+
+ /*
+ * Access to the switch's PHY registers.
+ */
+ int (*phy_read)(struct dsa_switch *ds, int port, int regnum);
+ int (*phy_write)(struct dsa_switch *ds, int port,
+ int regnum, u16 val);
+
+ /*
+ * Link state polling and IRQ handling.
+ */
+ void (*poll_link)(struct dsa_switch *ds);
+
+ /*
+ * ethtool hardware statistics.
+ */
+ void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data);
+ void (*get_ethtool_stats)(struct dsa_switch *ds,
+ int port, uint64_t *data);
+ int (*get_sset_count)(struct dsa_switch *ds);
+};
+
+void register_switch_driver(struct dsa_switch_driver *type);
+void unregister_switch_driver(struct dsa_switch_driver *type);
+
/*
* The original DSA tag format and some other tag formats have no
* ethertype, which means that we need to add a little hack to the
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index 89a2eb4..d4cf5cc 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -11,64 +11,9 @@
#ifndef __DSA_PRIV_H
#define __DSA_PRIV_H
-#include <linux/list.h>
#include <linux/phy.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
#include <net/dsa.h>
-struct dsa_switch {
- /*
- * Parent switch tree, and switch index.
- */
- struct dsa_switch_tree *dst;
- int index;
-
- /*
- * Configuration data for this switch.
- */
- struct dsa_chip_data *pd;
-
- /*
- * The used switch driver.
- */
- struct dsa_switch_driver *drv;
-
- /*
- * Reference to mii bus to use.
- */
- struct mii_bus *master_mii_bus;
-
- /*
- * Slave mii_bus and devices for the individual ports.
- */
- u32 dsa_port_mask;
- u32 phys_port_mask;
- struct mii_bus *slave_mii_bus;
- struct net_device *ports[DSA_MAX_PORTS];
-};
-
-static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p)
-{
- return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port);
-}
-
-static inline u8 dsa_upstream_port(struct dsa_switch *ds)
-{
- struct dsa_switch_tree *dst = ds->dst;
-
- /*
- * If this is the root switch (i.e. the switch that connects
- * to the CPU), return the cpu port number on this switch.
- * Else return the (DSA) port number that connects to the
- * switch that is one hop closer to the cpu.
- */
- if (dst->cpu_switch == ds->index)
- return dst->cpu_port;
- else
- return ds->pd->rtable[dst->cpu_switch];
-}
-
struct dsa_slave_priv {
/*
* The linux network interface corresponding to this
@@ -90,44 +35,8 @@ struct dsa_slave_priv {
struct phy_device *phy;
};
-struct dsa_switch_driver {
- struct list_head list;
-
- __be16 tag_protocol;
- int priv_size;
-
- /*
- * Probing and setup.
- */
- char *(*probe)(struct mii_bus *bus, int sw_addr);
- int (*setup)(struct dsa_switch *ds);
- int (*set_addr)(struct dsa_switch *ds, u8 *addr);
-
- /*
- * Access to the switch's PHY registers.
- */
- int (*phy_read)(struct dsa_switch *ds, int port, int regnum);
- int (*phy_write)(struct dsa_switch *ds, int port,
- int regnum, u16 val);
-
- /*
- * Link state polling and IRQ handling.
- */
- void (*poll_link)(struct dsa_switch *ds);
-
- /*
- * ethtool hardware statistics.
- */
- void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data);
- void (*get_ethtool_stats)(struct dsa_switch *ds,
- int port, uint64_t *data);
- int (*get_sset_count)(struct dsa_switch *ds);
-};
-
/* dsa.c */
extern char dsa_driver_version[];
-void register_switch_driver(struct dsa_switch_driver *type);
-void unregister_switch_driver(struct dsa_switch_driver *type);
/* slave.c */
void dsa_slave_mii_bus_init(struct dsa_switch *ds);
diff --git a/net/dsa/mv88e6060.c b/net/dsa/mv88e6060.c
index 0e028df..7fc4e81 100644
--- a/net/dsa/mv88e6060.c
+++ b/net/dsa/mv88e6060.c
@@ -11,7 +11,7 @@
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
-#include "dsa_priv.h"
+#include <net/dsa.h>
#define REG_PORT(p) (8 + (p))
#define REG_GLOBAL 0x0f
diff --git a/net/dsa/mv88e6123_61_65.c b/net/dsa/mv88e6123_61_65.c
index 6504405..c0a458f 100644
--- a/net/dsa/mv88e6123_61_65.c
+++ b/net/dsa/mv88e6123_61_65.c
@@ -11,7 +11,7 @@
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
-#include "dsa_priv.h"
+#include <net/dsa.h>
#include "mv88e6xxx.h"
static char *mv88e6123_61_65_probe(struct mii_bus *bus, int sw_addr)
diff --git a/net/dsa/mv88e6131.c b/net/dsa/mv88e6131.c
index 6786ba4..e0eb6824 100644
--- a/net/dsa/mv88e6131.c
+++ b/net/dsa/mv88e6131.c
@@ -11,7 +11,7 @@
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
-#include "dsa_priv.h"
+#include <net/dsa.h>
#include "mv88e6xxx.h"
/*
diff --git a/net/dsa/mv88e6xxx.c b/net/dsa/mv88e6xxx.c
index cacd955..5467c04 100644
--- a/net/dsa/mv88e6xxx.c
+++ b/net/dsa/mv88e6xxx.c
@@ -11,7 +11,7 @@
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/phy.h>
-#include "dsa_priv.h"
+#include <net/dsa.h>
#include "mv88e6xxx.h"
/*
--
1.7.7.3
^ permalink raw reply related
* [PATCH 1/3] dsa: Remove unnecessary exports
From: Ben Hutchings @ 2011-11-28 3:05 UTC (permalink / raw)
To: David Miller; +Cc: Lennert Buytenhek, netdev
I mistakenly exported functions from slave.c that are only called from
dsa.c, part of the same module.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
net/dsa/slave.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index c9d52ca..56cf9b8 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -45,7 +45,6 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds)
ds->master_mii_bus->id, ds->pd->sw_addr);
ds->slave_mii_bus->parent = &ds->master_mii_bus->dev;
}
-EXPORT_SYMBOL_GPL(dsa_slave_mii_bus_init);
/* slave device handling ****************************************************/
@@ -403,4 +402,3 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
return slave_dev;
}
-EXPORT_SYMBOL_GPL(dsa_slave_create);
--
1.7.7.3
^ permalink raw reply related
* Re: [PATCH v6 02/10] foundations of per-cgroup memory pressure controlling.
From: KAMEZAWA Hiroyuki @ 2011-11-28 2:55 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, lizf-BthXqXjhjHXQFUHtdCDX3A,
ebiederm-aS9lmoZGLiVWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
paul-inf54ven1CmVyaH7bEyXVA, gthelen-hpIqsD4AKlfQT0dZR+AlfA,
netdev-u79uwXL29TY76Z2rM5mHXA, linux-mm-Bw31MaZKKs3YtjvyW6yDsg,
kirill-oKw7cIdHH8eLwutG50LtGA, avagin-bzQdu9zFT3WakBO8gow8eQ,
devel-GEFAQzZX7r8dnm+yROfE0A, eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w,
cgroups-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1322242696-27682-3-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
On Fri, 25 Nov 2011 15:38:08 -0200
Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> wrote:
> This patch replaces all uses of struct sock fields' memory_pressure,
> memory_allocated, sockets_allocated, and sysctl_mem to acessor
> macros. Those macros can either receive a socket argument, or a mem_cgroup
> argument, depending on the context they live in.
>
> Since we're only doing a macro wrapping here, no performance impact at all is
> expected in the case where we don't have cgroups disabled.
>
> Signed-off-by: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
> CC: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> CC: Hiroyouki Kamezawa <kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
> CC: Eric W. Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
> CC: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
I have some comments on the style. Maybe a nitpick but many patches were
sent for fixing conding style in memcg recently.
+static inline int *sk_memory_pressure(const struct sock *sk)
+{
+ return sk->sk_prot->memory_pressure;
+}
+
+static inline long sk_prot_mem(const struct sock *sk, int index)
+{
+ long *prot = sk->sk_prot->sysctl_mem;
+ return prot[index];
+}
+
I don't think sk_prot_mem() is an easy to undestand name.
sk_prot_memory_limit() ?
> +static inline int
> +kcg_sockets_allocated_sum_positive(struct proto *prot, struct mem_cgroup *cg)
> +{
> + return percpu_counter_sum_positive(prot->sockets_allocated);
> +}
> +
> +static inline long
> +kcg_memory_allocated(struct proto *prot, struct mem_cgroup *cg)
> +{
> + return atomic_long_read(prot->memory_allocated);
> +}
>
I don't like 'kcg'. What it means ?
memory_cgrou_prot_socekts_allocated() ? and
memory_cgroup_prot_memory_allocated() ?
And the variable for memory cgroup should be 'memcg'.
http://www.spinics.net/lists/linux-mm/msg26781.html
So, please rename.
> #ifdef CONFIG_PROC_FS
> /* Called with local bh disabled */
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index e147f42..ccaa3b6 100644
<snip>
seq_printf(seq, "RAW: inuse %d\n",
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 34f5db1..89a2bfe 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -319,9 +319,11 @@ EXPORT_SYMBOL(tcp_memory_pressure);
>
> void tcp_enter_memory_pressure(struct sock *sk)
> {
> - if (!tcp_memory_pressure) {
> + int *memory_pressure = sk_memory_pressure(sk);
> +
Don't you need !memory_pressure check here ?
Hmm, can this function be
+static inline int *sk_memory_pressure(const struct sock *sk)
+{
+ return sk->sk_prot->memory_pressure;
+}
as
static inline bool sk_under_prot_memory_pressure(const struct sock *sk)
{
if (sk->sk_prot->memory_pressure &&
*sk->sk_prot->memory_pressure)
return true;
return false;
}
and have sk_set/unset_prot_memory_pressure(), ?
> + if (!*memory_pressure) {
> NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMEMORYPRESSURES);
> - tcp_memory_pressure = 1;
> + *memory_pressure = 1;
> }
> }
> EXPORT_SYMBOL(tcp_enter_memory_pressure);
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index 52b5c2d..3df862d 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -322,7 +322,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)
> /* Check #1 */
> if (tp->rcv_ssthresh < tp->window_clamp &&
> (int)tp->rcv_ssthresh < tcp_space(sk) &&
> - !tcp_memory_pressure) {
> + !sk_memory_pressure(sk)) {
Don't you need to check !*sk_memory_pressure(sk) ?
> int incr;
>
> /* Check #2. Increase window, if skb with such overhead
> @@ -411,8 +411,8 @@ static void tcp_clamp_window(struct sock *sk)
>
> if (sk->sk_rcvbuf < sysctl_tcp_rmem[2] &&
> !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
> - !tcp_memory_pressure &&
> - atomic_long_read(&tcp_memory_allocated) < sysctl_tcp_mem[0]) {
> + !sk_memory_pressure(sk) &&
> + sk_memory_allocated(sk) < sk_prot_mem(sk, 0)) {
> sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc),
> sysctl_tcp_rmem[2]);
> }
> @@ -4864,7 +4864,7 @@ static int tcp_prune_queue(struct sock *sk)
>
> if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
> tcp_clamp_window(sk);
> - else if (tcp_memory_pressure)
> + else if (sk_memory_pressure(sk))
> tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4U * tp->advmss);
Ditto.
>
> tcp_collapse_ofo_queue(sk);
> @@ -4930,11 +4930,11 @@ static int tcp_should_expand_sndbuf(const struct sock *sk)
> return 0;
>
> /* If we are under global TCP memory pressure, do not expand. */
> - if (tcp_memory_pressure)
> + if (sk_memory_pressure(sk))
> return 0;
again.
Thanks,
-Kame
--
To unsubscribe from this list: send the line "unsubscribe cgroups" 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] net/ethernet: convert drivers/net/ethernet/* to use module_platform_driver()
From: Wan ZongShun @ 2011-11-28 2:48 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, David S. Miller, Pantelis Antoniou, Vitaly Bordug,
Nicolas Pitre, Giuseppe Cavallaro, Marc Kleine-Budde,
Jeff Kirsher, Jiri Pirko, Daniel Hellstrom, Alexey Dobriyan,
Tobias Klauser, Grant Likely, Jiri Kosina, Richard Cochran,
Jonas Bonn, Sebastian Poehn, Yoshihiro Shimoda,
Ricardo Ribalda Delgado, Micha, netdev
In-Reply-To: <1322448257.2408.6.camel@phoenix>
2011/11/28 Axel Lin <axel.lin@gmail.com>:
> This patch converts the drivers in drivers/net/ethernet/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Pantelis Antoniou <pantelis.antoniou@gmail.com>
> Cc: Vitaly Bordug <vbordug@ru.mvista.com>
> Cc: Wan ZongShun <mcuos.com@gmail.com>
> Cc: Nicolas Pitre <nico@fluxnic.net>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Marc Kleine-Budde <mkl@pengutronix.de>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Cc: Jiri Pirko <jpirko@redhat.com>
> Cc: Daniel Hellstrom <daniel@gaisler.com>
> Cc: Alexey Dobriyan <adobriyan@gmail.com>
> Cc: Tobias Klauser <tklauser@distanz.ch>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: Richard Cochran <richard.cochran@omicron.at>
> Cc: Jonas Bonn <jonas@southpole.se>
> Cc: Sebastian Poehn <sebastian.poehn@belden.com>
> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/net/ethernet/8390/ax88796.c | 13 +----------
> drivers/net/ethernet/aeroflex/greth.c | 13 +----------
> drivers/net/ethernet/amd/au1000_eth.c | 15 +----------
> drivers/net/ethernet/amd/sunlance.c | 15 +-----------
> drivers/net/ethernet/broadcom/sb1250-mac.c | 13 +----------
> drivers/net/ethernet/dnet.c | 13 +----------
> drivers/net/ethernet/ethoc.c | 13 +----------
> .../net/ethernet/freescale/fs_enet/fs_enet-main.c | 15 +-----------
> .../net/ethernet/freescale/fs_enet/mii-bitbang.c | 13 +----------
> drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 13 +----------
> drivers/net/ethernet/freescale/fsl_pq_mdio.c | 11 +--------
> drivers/net/ethernet/freescale/gianfar.c | 14 +----------
> drivers/net/ethernet/freescale/gianfar_ptp.c | 16 +------------
> drivers/net/ethernet/korina.c | 13 +----------
> drivers/net/ethernet/marvell/pxa168_eth.c | 13 +----------
> drivers/net/ethernet/micrel/ks8842.c | 13 +----------
> drivers/net/ethernet/micrel/ks8851_mll.c | 13 +----------
> drivers/net/ethernet/natsemi/jazzsonic.c | 13 +----------
> drivers/net/ethernet/natsemi/macsonic.c | 13 +----------
> drivers/net/ethernet/natsemi/xtsonic.c | 13 +----------
> drivers/net/ethernet/nuvoton/w90p910_ether.c | 13 +----------
> drivers/net/ethernet/renesas/sh_eth.c | 13 +----------
> drivers/net/ethernet/seeq/sgiseeq.c | 18 +--------------
> drivers/net/ethernet/sgi/meth.c | 19 +---------------
> drivers/net/ethernet/smsc/smc911x.c | 13 +----------
> drivers/net/ethernet/smsc/smc91x.c | 13 +----------
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +-------------------
> drivers/net/ethernet/sun/sunbmac.c | 13 +----------
> drivers/net/ethernet/tundra/tsi108_eth.c | 20 +---------------
> drivers/net/ethernet/xilinx/ll_temac_main.c | 12 +---------
> drivers/net/ethernet/xilinx/xilinx_emaclite.c | 22 +-----------------
> 31 files changed, 32 insertions(+), 416 deletions(-)
>
> diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
> index 2a3b8c2..9e8ba4f 100644
> --- a/drivers/net/ethernet/8390/ax88796.c
> +++ b/drivers/net/ethernet/8390/ax88796.c
> @@ -990,18 +990,7 @@ static struct platform_driver axdrv = {
> .resume = ax_resume,
> };
>
> -static int __init axdrv_init(void)
> -{
> - return platform_driver_register(&axdrv);
> -}
> -
> -static void __exit axdrv_exit(void)
> -{
> - platform_driver_unregister(&axdrv);
> -}
> -
> -module_init(axdrv_init);
> -module_exit(axdrv_exit);
> +module_platform_driver(axdrv);
>
> MODULE_DESCRIPTION("AX88796 10/100 Ethernet platform driver");
> MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
> diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
> index 442fefa..c885aa9 100644
> --- a/drivers/net/ethernet/aeroflex/greth.c
> +++ b/drivers/net/ethernet/aeroflex/greth.c
> @@ -1623,18 +1623,7 @@ static struct platform_driver greth_of_driver = {
> .remove = __devexit_p(greth_of_remove),
> };
>
> -static int __init greth_init(void)
> -{
> - return platform_driver_register(&greth_of_driver);
> -}
> -
> -static void __exit greth_cleanup(void)
> -{
> - platform_driver_unregister(&greth_of_driver);
> -}
> -
> -module_init(greth_init);
> -module_exit(greth_cleanup);
> +module_platform_driver(greth_of_driver);
>
> MODULE_AUTHOR("Aeroflex Gaisler AB.");
> MODULE_DESCRIPTION("Aeroflex Gaisler Ethernet MAC driver");
> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
> index 4865ff1..cc9262b 100644
> --- a/drivers/net/ethernet/amd/au1000_eth.c
> +++ b/drivers/net/ethernet/amd/au1000_eth.c
> @@ -1339,18 +1339,7 @@ static struct platform_driver au1000_eth_driver = {
> .owner = THIS_MODULE,
> },
> };
> -MODULE_ALIAS("platform:au1000-eth");
> -
> -
> -static int __init au1000_init_module(void)
> -{
> - return platform_driver_register(&au1000_eth_driver);
> -}
>
> -static void __exit au1000_exit_module(void)
> -{
> - platform_driver_unregister(&au1000_eth_driver);
> -}
> +module_platform_driver(au1000_eth_driver);
>
> -module_init(au1000_init_module);
> -module_exit(au1000_exit_module);
> +MODULE_ALIAS("platform:au1000-eth");
> diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c
> index 8fda457..7ea16d3 100644
> --- a/drivers/net/ethernet/amd/sunlance.c
> +++ b/drivers/net/ethernet/amd/sunlance.c
> @@ -1540,17 +1540,4 @@ static struct platform_driver sunlance_sbus_driver = {
> .remove = __devexit_p(sunlance_sbus_remove),
> };
>
> -
> -/* Find all the lance cards on the system and initialize them */
> -static int __init sparc_lance_init(void)
> -{
> - return platform_driver_register(&sunlance_sbus_driver);
> -}
> -
> -static void __exit sparc_lance_exit(void)
> -{
> - platform_driver_unregister(&sunlance_sbus_driver);
> -}
> -
> -module_init(sparc_lance_init);
> -module_exit(sparc_lance_exit);
> +module_platform_driver(sunlance_sbus_driver);
> diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
> index aa58f9e..8fa7abc 100644
> --- a/drivers/net/ethernet/broadcom/sb1250-mac.c
> +++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
> @@ -2675,15 +2675,4 @@ static struct platform_driver sbmac_driver = {
> },
> };
>
> -static int __init sbmac_init_module(void)
> -{
> - return platform_driver_register(&sbmac_driver);
> -}
> -
> -static void __exit sbmac_cleanup_module(void)
> -{
> - platform_driver_unregister(&sbmac_driver);
> -}
> -
> -module_init(sbmac_init_module);
> -module_exit(sbmac_cleanup_module);
> +module_platform_driver(sbmac_driver);
> diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c
> index d94b968..ce88c0f 100644
> --- a/drivers/net/ethernet/dnet.c
> +++ b/drivers/net/ethernet/dnet.c
> @@ -977,18 +977,7 @@ static struct platform_driver dnet_driver = {
> },
> };
>
> -static int __init dnet_init(void)
> -{
> - return platform_driver_register(&dnet_driver);
> -}
> -
> -static void __exit dnet_exit(void)
> -{
> - platform_driver_unregister(&dnet_driver);
> -}
> -
> -module_init(dnet_init);
> -module_exit(dnet_exit);
> +module_platform_driver(dnet_driver);
>
> MODULE_LICENSE("GPL");
> MODULE_DESCRIPTION("Dave DNET Ethernet driver");
> diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
> index 251b635..60f0e78 100644
> --- a/drivers/net/ethernet/ethoc.c
> +++ b/drivers/net/ethernet/ethoc.c
> @@ -1185,18 +1185,7 @@ static struct platform_driver ethoc_driver = {
> },
> };
>
> -static int __init ethoc_init(void)
> -{
> - return platform_driver_register(ðoc_driver);
> -}
> -
> -static void __exit ethoc_exit(void)
> -{
> - platform_driver_unregister(ðoc_driver);
> -}
> -
> -module_init(ethoc_init);
> -module_exit(ethoc_exit);
> +module_platform_driver(ethoc_driver);
>
> MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>");
> MODULE_DESCRIPTION("OpenCores Ethernet MAC driver");
> diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> index 5bf5471..910a8e1 100644
> --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> @@ -1171,16 +1171,6 @@ static struct platform_driver fs_enet_driver = {
> .remove = fs_enet_remove,
> };
>
> -static int __init fs_init(void)
> -{
> - return platform_driver_register(&fs_enet_driver);
> -}
> -
> -static void __exit fs_cleanup(void)
> -{
> - platform_driver_unregister(&fs_enet_driver);
> -}
> -
> #ifdef CONFIG_NET_POLL_CONTROLLER
> static void fs_enet_netpoll(struct net_device *dev)
> {
> @@ -1190,7 +1180,4 @@ static void fs_enet_netpoll(struct net_device *dev)
> }
> #endif
>
> -/**************************************************************************************/
> -
> -module_init(fs_init);
> -module_exit(fs_cleanup);
> +module_platform_driver(fs_enet_driver);
> diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
> index b09270b..2f96019 100644
> --- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
> +++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
> @@ -232,15 +232,4 @@ static struct platform_driver fs_enet_bb_mdio_driver = {
> .remove = fs_enet_mdio_remove,
> };
>
> -static int fs_enet_mdio_bb_init(void)
> -{
> - return platform_driver_register(&fs_enet_bb_mdio_driver);
> -}
> -
> -static void fs_enet_mdio_bb_exit(void)
> -{
> - platform_driver_unregister(&fs_enet_bb_mdio_driver);
> -}
> -
> -module_init(fs_enet_mdio_bb_init);
> -module_exit(fs_enet_mdio_bb_exit);
> +module_platform_driver(fs_enet_bb_mdio_driver);
> diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
> index e0e9d6c..55bb867 100644
> --- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
> +++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
> @@ -237,15 +237,4 @@ static struct platform_driver fs_enet_fec_mdio_driver = {
> .remove = fs_enet_mdio_remove,
> };
>
> -static int fs_enet_mdio_fec_init(void)
> -{
> - return platform_driver_register(&fs_enet_fec_mdio_driver);
> -}
> -
> -static void fs_enet_mdio_fec_exit(void)
> -{
> - platform_driver_unregister(&fs_enet_fec_mdio_driver);
> -}
> -
> -module_init(fs_enet_mdio_fec_init);
> -module_exit(fs_enet_mdio_fec_exit);
> +module_platform_driver(fs_enet_fec_mdio_driver);
> diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
> index 8dee1ae..f109602 100644
> --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
> +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
> @@ -443,15 +443,6 @@ static struct platform_driver fsl_pq_mdio_driver = {
> .remove = fsl_pq_mdio_remove,
> };
>
> -int __init fsl_pq_mdio_init(void)
> -{
> - return platform_driver_register(&fsl_pq_mdio_driver);
> -}
> -module_init(fsl_pq_mdio_init);
> +module_platform_driver(fsl_pq_mdio_driver);
>
> -void fsl_pq_mdio_exit(void)
> -{
> - platform_driver_unregister(&fsl_pq_mdio_driver);
> -}
> -module_exit(fsl_pq_mdio_exit);
> MODULE_LICENSE("GPL");
> diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
> index 8e21ceb..e01cdaa 100644
> --- a/drivers/net/ethernet/freescale/gianfar.c
> +++ b/drivers/net/ethernet/freescale/gianfar.c
> @@ -3281,16 +3281,4 @@ static struct platform_driver gfar_driver = {
> .remove = gfar_remove,
> };
>
> -static int __init gfar_init(void)
> -{
> - return platform_driver_register(&gfar_driver);
> -}
> -
> -static void __exit gfar_exit(void)
> -{
> - platform_driver_unregister(&gfar_driver);
> -}
> -
> -module_init(gfar_init);
> -module_exit(gfar_exit);
> -
> +module_platform_driver(gfar_driver);
> diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
> index f67b8ae..83e0ed7 100644
> --- a/drivers/net/ethernet/freescale/gianfar_ptp.c
> +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
> @@ -562,21 +562,7 @@ static struct platform_driver gianfar_ptp_driver = {
> .remove = gianfar_ptp_remove,
> };
>
> -/* module operations */
> -
> -static int __init ptp_gianfar_init(void)
> -{
> - return platform_driver_register(&gianfar_ptp_driver);
> -}
> -
> -module_init(ptp_gianfar_init);
> -
> -static void __exit ptp_gianfar_exit(void)
> -{
> - platform_driver_unregister(&gianfar_ptp_driver);
> -}
> -
> -module_exit(ptp_gianfar_exit);
> +module_platform_driver(gianfar_ptp_driver);
>
> MODULE_AUTHOR("Richard Cochran <richard.cochran@omicron.at>");
> MODULE_DESCRIPTION("PTP clock using the eTSEC");
> diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
> index d8430f4..6ad094f 100644
> --- a/drivers/net/ethernet/korina.c
> +++ b/drivers/net/ethernet/korina.c
> @@ -1230,18 +1230,7 @@ static struct platform_driver korina_driver = {
> .remove = korina_remove,
> };
>
> -static int __init korina_init_module(void)
> -{
> - return platform_driver_register(&korina_driver);
> -}
> -
> -static void korina_cleanup_module(void)
> -{
> - return platform_driver_unregister(&korina_driver);
> -}
> -
> -module_init(korina_init_module);
> -module_exit(korina_cleanup_module);
> +module_platform_driver(korina_driver);
>
> MODULE_AUTHOR("Philip Rischel <rischelp@idt.com>");
> MODULE_AUTHOR("Felix Fietkau <nbd@openwrt.org>");
> diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
> index d17d062..5ec409e 100644
> --- a/drivers/net/ethernet/marvell/pxa168_eth.c
> +++ b/drivers/net/ethernet/marvell/pxa168_eth.c
> @@ -1645,18 +1645,7 @@ static struct platform_driver pxa168_eth_driver = {
> },
> };
>
> -static int __init pxa168_init_module(void)
> -{
> - return platform_driver_register(&pxa168_eth_driver);
> -}
> -
> -static void __exit pxa168_cleanup_module(void)
> -{
> - platform_driver_unregister(&pxa168_eth_driver);
> -}
> -
> -module_init(pxa168_init_module);
> -module_exit(pxa168_cleanup_module);
> +module_platform_driver(pxa168_eth_driver);
>
> MODULE_LICENSE("GPL");
> MODULE_DESCRIPTION("Ethernet driver for Marvell PXA168");
> diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c
> index de9f2e2..0a85690 100644
> --- a/drivers/net/ethernet/micrel/ks8842.c
> +++ b/drivers/net/ethernet/micrel/ks8842.c
> @@ -1264,18 +1264,7 @@ static struct platform_driver ks8842_platform_driver = {
> .remove = ks8842_remove,
> };
>
> -static int __init ks8842_init(void)
> -{
> - return platform_driver_register(&ks8842_platform_driver);
> -}
> -
> -static void __exit ks8842_exit(void)
> -{
> - platform_driver_unregister(&ks8842_platform_driver);
> -}
> -
> -module_init(ks8842_init);
> -module_exit(ks8842_exit);
> +module_platform_driver(ks8842_platform_driver);
>
> MODULE_DESCRIPTION("Timberdale KS8842 ethernet driver");
> MODULE_AUTHOR("Mocean Laboratories <info@mocean-labs.com>");
> diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
> index 228c5c0..e58e78e 100644
> --- a/drivers/net/ethernet/micrel/ks8851_mll.c
> +++ b/drivers/net/ethernet/micrel/ks8851_mll.c
> @@ -1658,18 +1658,7 @@ static struct platform_driver ks8851_platform_driver = {
> .remove = __devexit_p(ks8851_remove),
> };
>
> -static int __init ks8851_init(void)
> -{
> - return platform_driver_register(&ks8851_platform_driver);
> -}
> -
> -static void __exit ks8851_exit(void)
> -{
> - platform_driver_unregister(&ks8851_platform_driver);
> -}
> -
> -module_init(ks8851_init);
> -module_exit(ks8851_exit);
> +module_platform_driver(ks8851_platform_driver);
>
> MODULE_DESCRIPTION("KS8851 MLL Network driver");
> MODULE_AUTHOR("David Choi <david.choi@micrel.com>");
> diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c
> index fc7c6a9..5b89fd3 100644
> --- a/drivers/net/ethernet/natsemi/jazzsonic.c
> +++ b/drivers/net/ethernet/natsemi/jazzsonic.c
> @@ -294,15 +294,4 @@ static struct platform_driver jazz_sonic_driver = {
> },
> };
>
> -static int __init jazz_sonic_init_module(void)
> -{
> - return platform_driver_register(&jazz_sonic_driver);
> -}
> -
> -static void __exit jazz_sonic_cleanup_module(void)
> -{
> - platform_driver_unregister(&jazz_sonic_driver);
> -}
> -
> -module_init(jazz_sonic_init_module);
> -module_exit(jazz_sonic_cleanup_module);
> +module_platform_driver(jazz_sonic_driver);
> diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c
> index a2eacbf..70367d7 100644
> --- a/drivers/net/ethernet/natsemi/macsonic.c
> +++ b/drivers/net/ethernet/natsemi/macsonic.c
> @@ -643,15 +643,4 @@ static struct platform_driver mac_sonic_driver = {
> },
> };
>
> -static int __init mac_sonic_init_module(void)
> -{
> - return platform_driver_register(&mac_sonic_driver);
> -}
> -
> -static void __exit mac_sonic_cleanup_module(void)
> -{
> - platform_driver_unregister(&mac_sonic_driver);
> -}
> -
> -module_init(mac_sonic_init_module);
> -module_exit(mac_sonic_cleanup_module);
> +module_platform_driver(mac_sonic_driver);
> diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
> index ccf61b9..e01c0a0 100644
> --- a/drivers/net/ethernet/natsemi/xtsonic.c
> +++ b/drivers/net/ethernet/natsemi/xtsonic.c
> @@ -319,15 +319,4 @@ static struct platform_driver xtsonic_driver = {
> },
> };
>
> -static int __init xtsonic_init(void)
> -{
> - return platform_driver_register(&xtsonic_driver);
> -}
> -
> -static void __exit xtsonic_cleanup(void)
> -{
> - platform_driver_unregister(&xtsonic_driver);
> -}
> -
> -module_init(xtsonic_init);
> -module_exit(xtsonic_cleanup);
> +module_platform_driver(xtsonic_driver);
> diff --git a/drivers/net/ethernet/nuvoton/w90p910_ether.c b/drivers/net/ethernet/nuvoton/w90p910_ether.c
> index f1bfb8f..b75a049 100644
> --- a/drivers/net/ethernet/nuvoton/w90p910_ether.c
> +++ b/drivers/net/ethernet/nuvoton/w90p910_ether.c
> @@ -1103,18 +1103,7 @@ static struct platform_driver w90p910_ether_driver = {
> },
> };
>
> -static int __init w90p910_ether_init(void)
> -{
> - return platform_driver_register(&w90p910_ether_driver);
> -}
> -
> -static void __exit w90p910_ether_exit(void)
> -{
> - platform_driver_unregister(&w90p910_ether_driver);
> -}
> -
> -module_init(w90p910_ether_init);
> -module_exit(w90p910_ether_exit);
> +module_platform_driver(w90p910_ether_driver);
>
> MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
> MODULE_DESCRIPTION("w90p910 MAC driver!");
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 9b23074..ebfb682 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -1957,18 +1957,7 @@ static struct platform_driver sh_eth_driver = {
> },
> };
>
> -static int __init sh_eth_init(void)
> -{
> - return platform_driver_register(&sh_eth_driver);
> -}
> -
> -static void __exit sh_eth_cleanup(void)
> -{
> - platform_driver_unregister(&sh_eth_driver);
> -}
> -
> -module_init(sh_eth_init);
> -module_exit(sh_eth_cleanup);
> +module_platform_driver(sh_eth_driver);
>
> MODULE_AUTHOR("Nobuhiro Iwamatsu, Yoshihiro Shimoda");
> MODULE_DESCRIPTION("Renesas SuperH Ethernet driver");
> diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq/sgiseeq.c
> index c3673f1..f955a19 100644
> --- a/drivers/net/ethernet/seeq/sgiseeq.c
> +++ b/drivers/net/ethernet/seeq/sgiseeq.c
> @@ -834,23 +834,7 @@ static struct platform_driver sgiseeq_driver = {
> }
> };
>
> -static int __init sgiseeq_module_init(void)
> -{
> - if (platform_driver_register(&sgiseeq_driver)) {
> - printk(KERN_ERR "Driver registration failed\n");
> - return -ENODEV;
> - }
> -
> - return 0;
> -}
> -
> -static void __exit sgiseeq_module_exit(void)
> -{
> - platform_driver_unregister(&sgiseeq_driver);
> -}
> -
> -module_init(sgiseeq_module_init);
> -module_exit(sgiseeq_module_exit);
> +module_platform_driver(sgiseeq_driver);
>
> MODULE_DESCRIPTION("SGI Seeq 8003 driver");
> MODULE_AUTHOR("Linux/MIPS Mailing List <linux-mips@linux-mips.org>");
> diff --git a/drivers/net/ethernet/sgi/meth.c b/drivers/net/ethernet/sgi/meth.c
> index 60135aa..f98c6c6 100644
> --- a/drivers/net/ethernet/sgi/meth.c
> +++ b/drivers/net/ethernet/sgi/meth.c
> @@ -830,24 +830,7 @@ static struct platform_driver meth_driver = {
> }
> };
>
> -static int __init meth_init_module(void)
> -{
> - int err;
> -
> - err = platform_driver_register(&meth_driver);
> - if (err)
> - printk(KERN_ERR "Driver registration failed\n");
> -
> - return err;
> -}
> -
> -static void __exit meth_exit_module(void)
> -{
> - platform_driver_unregister(&meth_driver);
> -}
> -
> -module_init(meth_init_module);
> -module_exit(meth_exit_module);
> +module_platform_driver(meth_driver);
>
> MODULE_AUTHOR("Ilya Volynets <ilya@theIlya.com>");
> MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");
> diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
> index 8f61fe9..313ba3b 100644
> --- a/drivers/net/ethernet/smsc/smc911x.c
> +++ b/drivers/net/ethernet/smsc/smc911x.c
> @@ -2196,15 +2196,4 @@ static struct platform_driver smc911x_driver = {
> },
> };
>
> -static int __init smc911x_init(void)
> -{
> - return platform_driver_register(&smc911x_driver);
> -}
> -
> -static void __exit smc911x_cleanup(void)
> -{
> - platform_driver_unregister(&smc911x_driver);
> -}
> -
> -module_init(smc911x_init);
> -module_exit(smc911x_cleanup);
> +module_platform_driver(smc911x_driver);
> diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
> index f47f81e..64ad3ed 100644
> --- a/drivers/net/ethernet/smsc/smc91x.c
> +++ b/drivers/net/ethernet/smsc/smc91x.c
> @@ -2417,15 +2417,4 @@ static struct platform_driver smc_driver = {
> },
> };
>
> -static int __init smc_init(void)
> -{
> - return platform_driver_register(&smc_driver);
> -}
> -
> -static void __exit smc_cleanup(void)
> -{
> - platform_driver_unregister(&smc_driver);
> -}
> -
> -module_init(smc_init);
> -module_exit(smc_cleanup);
> +module_platform_driver(smc_driver);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 20e8267..24c2bf6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2131,27 +2131,6 @@ static struct platform_driver stmmac_driver = {
> },
> };
>
> -/**
> - * stmmac_init_module - Entry point for the driver
> - * Description: This function is the entry point for the driver.
> - */
> -static int __init stmmac_init_module(void)
> -{
> - int ret;
> -
> - ret = platform_driver_register(&stmmac_driver);
> - return ret;
> -}
> -
> -/**
> - * stmmac_cleanup_module - Cleanup routine for the driver
> - * Description: This function is the cleanup routine for the driver.
> - */
> -static void __exit stmmac_cleanup_module(void)
> -{
> - platform_driver_unregister(&stmmac_driver);
> -}
> -
> #ifndef MODULE
> static int __init stmmac_cmdline_opt(char *str)
> {
> @@ -2211,8 +2190,7 @@ err:
> __setup("stmmaceth=", stmmac_cmdline_opt);
> #endif
>
> -module_init(stmmac_init_module);
> -module_exit(stmmac_cleanup_module);
> +module_platform_driver(stmmac_driver);
>
> MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet driver");
> MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
> diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c
> index 0d8cfd9..220f724 100644
> --- a/drivers/net/ethernet/sun/sunbmac.c
> +++ b/drivers/net/ethernet/sun/sunbmac.c
> @@ -1293,15 +1293,4 @@ static struct platform_driver bigmac_sbus_driver = {
> .remove = __devexit_p(bigmac_sbus_remove),
> };
>
> -static int __init bigmac_init(void)
> -{
> - return platform_driver_register(&bigmac_sbus_driver);
> -}
> -
> -static void __exit bigmac_exit(void)
> -{
> - platform_driver_unregister(&bigmac_sbus_driver);
> -}
> -
> -module_init(bigmac_init);
> -module_exit(bigmac_exit);
> +module_platform_driver(bigmac_sbus_driver);
> diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c
> index a8df7ec..a9ce01ba 100644
> --- a/drivers/net/ethernet/tundra/tsi108_eth.c
> +++ b/drivers/net/ethernet/tundra/tsi108_eth.c
> @@ -1688,18 +1688,6 @@ static void tsi108_timed_checker(unsigned long dev_ptr)
> mod_timer(&data->timer, jiffies + CHECK_PHY_INTERVAL);
> }
>
> -static int tsi108_ether_init(void)
> -{
> - int ret;
> - ret = platform_driver_register (&tsi_eth_driver);
> - if (ret < 0){
> - printk("tsi108_ether_init: error initializing ethernet "
> - "device\n");
> - return ret;
> - }
> - return 0;
> -}
> -
> static int tsi108_ether_remove(struct platform_device *pdev)
> {
> struct net_device *dev = platform_get_drvdata(pdev);
> @@ -1714,13 +1702,7 @@ static int tsi108_ether_remove(struct platform_device *pdev)
>
> return 0;
> }
> -static void tsi108_ether_exit(void)
> -{
> - platform_driver_unregister(&tsi_eth_driver);
> -}
> -
> -module_init(tsi108_ether_init);
> -module_exit(tsi108_ether_exit);
> +module_platform_driver(tsi_eth_driver);
>
> MODULE_AUTHOR("Tundra Semiconductor Corporation");
> MODULE_DESCRIPTION("Tsi108 Gigabit Ethernet driver");
> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index 1ade9e1..282330d 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -1181,17 +1181,7 @@ static struct platform_driver temac_of_driver = {
> },
> };
>
> -static int __init temac_init(void)
> -{
> - return platform_driver_register(&temac_of_driver);
> -}
> -module_init(temac_init);
> -
> -static void __exit temac_exit(void)
> -{
> - platform_driver_unregister(&temac_of_driver);
> -}
> -module_exit(temac_exit);
> +module_platform_driver(temac_of_driver);
>
> MODULE_DESCRIPTION("Xilinx LL_TEMAC Ethernet driver");
> MODULE_AUTHOR("Yoshio Kashiwagi");
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index 8018d7d..dca6541 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1303,27 +1303,7 @@ static struct platform_driver xemaclite_of_driver = {
> .remove = __devexit_p(xemaclite_of_remove),
> };
>
> -/**
> - * xgpiopss_init - Initial driver registration call
> - *
> - * Return: 0 upon success, or a negative error upon failure.
> - */
> -static int __init xemaclite_init(void)
> -{
> - /* No kernel boot options used, we just need to register the driver */
> - return platform_driver_register(&xemaclite_of_driver);
> -}
> -
> -/**
> - * xemaclite_cleanup - Driver un-registration call
> - */
> -static void __exit xemaclite_cleanup(void)
> -{
> - platform_driver_unregister(&xemaclite_of_driver);
> -}
> -
> -module_init(xemaclite_init);
> -module_exit(xemaclite_cleanup);
> +module_platform_driver(xemaclite_of_driver);
>
> MODULE_AUTHOR("Xilinx, Inc.");
> MODULE_DESCRIPTION("Xilinx Ethernet MAC Lite driver");
For w90x900 ethernet driver
Acked-by: Wan ZongShun <mcuos.com@gmail.com>
> --
> 1.7.5.4
>
>
>
>
--
Wan ZongShun.
www.mcuos.com
^ permalink raw reply
* [PATCH] net/ethernet: convert drivers/net/ethernet/* to use module_platform_driver()
From: Axel Lin @ 2011-11-28 2:44 UTC (permalink / raw)
To: linux-kernel
Cc: David S. Miller, Pantelis Antoniou, Vitaly Bordug, Wan ZongShun,
Nicolas Pitre, Giuseppe Cavallaro, Marc Kleine-Budde,
Jeff Kirsher, Jiri Pirko, Daniel Hellstrom, Alexey Dobriyan,
Tobias Klauser, Grant Likely, Jiri Kosina, Richard Cochran,
Jonas Bonn, Sebastian Poehn, Yoshihiro Shimoda,
Ricardo Ribalda Delgado, Micha, netdev
This patch converts the drivers in drivers/net/ethernet/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Pantelis Antoniou <pantelis.antoniou@gmail.com>
Cc: Vitaly Bordug <vbordug@ru.mvista.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: Jiri Pirko <jpirko@redhat.com>
Cc: Daniel Hellstrom <daniel@gaisler.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Richard Cochran <richard.cochran@omicron.at>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Sebastian Poehn <sebastian.poehn@belden.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/net/ethernet/8390/ax88796.c | 13 +----------
drivers/net/ethernet/aeroflex/greth.c | 13 +----------
drivers/net/ethernet/amd/au1000_eth.c | 15 +----------
drivers/net/ethernet/amd/sunlance.c | 15 +-----------
drivers/net/ethernet/broadcom/sb1250-mac.c | 13 +----------
drivers/net/ethernet/dnet.c | 13 +----------
drivers/net/ethernet/ethoc.c | 13 +----------
.../net/ethernet/freescale/fs_enet/fs_enet-main.c | 15 +-----------
.../net/ethernet/freescale/fs_enet/mii-bitbang.c | 13 +----------
drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 13 +----------
drivers/net/ethernet/freescale/fsl_pq_mdio.c | 11 +--------
drivers/net/ethernet/freescale/gianfar.c | 14 +----------
drivers/net/ethernet/freescale/gianfar_ptp.c | 16 +------------
drivers/net/ethernet/korina.c | 13 +----------
drivers/net/ethernet/marvell/pxa168_eth.c | 13 +----------
drivers/net/ethernet/micrel/ks8842.c | 13 +----------
drivers/net/ethernet/micrel/ks8851_mll.c | 13 +----------
drivers/net/ethernet/natsemi/jazzsonic.c | 13 +----------
drivers/net/ethernet/natsemi/macsonic.c | 13 +----------
drivers/net/ethernet/natsemi/xtsonic.c | 13 +----------
drivers/net/ethernet/nuvoton/w90p910_ether.c | 13 +----------
drivers/net/ethernet/renesas/sh_eth.c | 13 +----------
drivers/net/ethernet/seeq/sgiseeq.c | 18 +--------------
drivers/net/ethernet/sgi/meth.c | 19 +---------------
drivers/net/ethernet/smsc/smc911x.c | 13 +----------
drivers/net/ethernet/smsc/smc91x.c | 13 +----------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 24 +-------------------
drivers/net/ethernet/sun/sunbmac.c | 13 +----------
drivers/net/ethernet/tundra/tsi108_eth.c | 20 +---------------
drivers/net/ethernet/xilinx/ll_temac_main.c | 12 +---------
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 22 +-----------------
31 files changed, 32 insertions(+), 416 deletions(-)
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index 2a3b8c2..9e8ba4f 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -990,18 +990,7 @@ static struct platform_driver axdrv = {
.resume = ax_resume,
};
-static int __init axdrv_init(void)
-{
- return platform_driver_register(&axdrv);
-}
-
-static void __exit axdrv_exit(void)
-{
- platform_driver_unregister(&axdrv);
-}
-
-module_init(axdrv_init);
-module_exit(axdrv_exit);
+module_platform_driver(axdrv);
MODULE_DESCRIPTION("AX88796 10/100 Ethernet platform driver");
MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index 442fefa..c885aa9 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1623,18 +1623,7 @@ static struct platform_driver greth_of_driver = {
.remove = __devexit_p(greth_of_remove),
};
-static int __init greth_init(void)
-{
- return platform_driver_register(&greth_of_driver);
-}
-
-static void __exit greth_cleanup(void)
-{
- platform_driver_unregister(&greth_of_driver);
-}
-
-module_init(greth_init);
-module_exit(greth_cleanup);
+module_platform_driver(greth_of_driver);
MODULE_AUTHOR("Aeroflex Gaisler AB.");
MODULE_DESCRIPTION("Aeroflex Gaisler Ethernet MAC driver");
diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index 4865ff1..cc9262b 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -1339,18 +1339,7 @@ static struct platform_driver au1000_eth_driver = {
.owner = THIS_MODULE,
},
};
-MODULE_ALIAS("platform:au1000-eth");
-
-
-static int __init au1000_init_module(void)
-{
- return platform_driver_register(&au1000_eth_driver);
-}
-static void __exit au1000_exit_module(void)
-{
- platform_driver_unregister(&au1000_eth_driver);
-}
+module_platform_driver(au1000_eth_driver);
-module_init(au1000_init_module);
-module_exit(au1000_exit_module);
+MODULE_ALIAS("platform:au1000-eth");
diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c
index 8fda457..7ea16d3 100644
--- a/drivers/net/ethernet/amd/sunlance.c
+++ b/drivers/net/ethernet/amd/sunlance.c
@@ -1540,17 +1540,4 @@ static struct platform_driver sunlance_sbus_driver = {
.remove = __devexit_p(sunlance_sbus_remove),
};
-
-/* Find all the lance cards on the system and initialize them */
-static int __init sparc_lance_init(void)
-{
- return platform_driver_register(&sunlance_sbus_driver);
-}
-
-static void __exit sparc_lance_exit(void)
-{
- platform_driver_unregister(&sunlance_sbus_driver);
-}
-
-module_init(sparc_lance_init);
-module_exit(sparc_lance_exit);
+module_platform_driver(sunlance_sbus_driver);
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index aa58f9e..8fa7abc 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -2675,15 +2675,4 @@ static struct platform_driver sbmac_driver = {
},
};
-static int __init sbmac_init_module(void)
-{
- return platform_driver_register(&sbmac_driver);
-}
-
-static void __exit sbmac_cleanup_module(void)
-{
- platform_driver_unregister(&sbmac_driver);
-}
-
-module_init(sbmac_init_module);
-module_exit(sbmac_cleanup_module);
+module_platform_driver(sbmac_driver);
diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c
index d94b968..ce88c0f 100644
--- a/drivers/net/ethernet/dnet.c
+++ b/drivers/net/ethernet/dnet.c
@@ -977,18 +977,7 @@ static struct platform_driver dnet_driver = {
},
};
-static int __init dnet_init(void)
-{
- return platform_driver_register(&dnet_driver);
-}
-
-static void __exit dnet_exit(void)
-{
- platform_driver_unregister(&dnet_driver);
-}
-
-module_init(dnet_init);
-module_exit(dnet_exit);
+module_platform_driver(dnet_driver);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Dave DNET Ethernet driver");
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 251b635..60f0e78 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1185,18 +1185,7 @@ static struct platform_driver ethoc_driver = {
},
};
-static int __init ethoc_init(void)
-{
- return platform_driver_register(ðoc_driver);
-}
-
-static void __exit ethoc_exit(void)
-{
- platform_driver_unregister(ðoc_driver);
-}
-
-module_init(ethoc_init);
-module_exit(ethoc_exit);
+module_platform_driver(ethoc_driver);
MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>");
MODULE_DESCRIPTION("OpenCores Ethernet MAC driver");
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 5bf5471..910a8e1 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1171,16 +1171,6 @@ static struct platform_driver fs_enet_driver = {
.remove = fs_enet_remove,
};
-static int __init fs_init(void)
-{
- return platform_driver_register(&fs_enet_driver);
-}
-
-static void __exit fs_cleanup(void)
-{
- platform_driver_unregister(&fs_enet_driver);
-}
-
#ifdef CONFIG_NET_POLL_CONTROLLER
static void fs_enet_netpoll(struct net_device *dev)
{
@@ -1190,7 +1180,4 @@ static void fs_enet_netpoll(struct net_device *dev)
}
#endif
-/**************************************************************************************/
-
-module_init(fs_init);
-module_exit(fs_cleanup);
+module_platform_driver(fs_enet_driver);
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
index b09270b..2f96019 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
@@ -232,15 +232,4 @@ static struct platform_driver fs_enet_bb_mdio_driver = {
.remove = fs_enet_mdio_remove,
};
-static int fs_enet_mdio_bb_init(void)
-{
- return platform_driver_register(&fs_enet_bb_mdio_driver);
-}
-
-static void fs_enet_mdio_bb_exit(void)
-{
- platform_driver_unregister(&fs_enet_bb_mdio_driver);
-}
-
-module_init(fs_enet_mdio_bb_init);
-module_exit(fs_enet_mdio_bb_exit);
+module_platform_driver(fs_enet_bb_mdio_driver);
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
index e0e9d6c..55bb867 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
@@ -237,15 +237,4 @@ static struct platform_driver fs_enet_fec_mdio_driver = {
.remove = fs_enet_mdio_remove,
};
-static int fs_enet_mdio_fec_init(void)
-{
- return platform_driver_register(&fs_enet_fec_mdio_driver);
-}
-
-static void fs_enet_mdio_fec_exit(void)
-{
- platform_driver_unregister(&fs_enet_fec_mdio_driver);
-}
-
-module_init(fs_enet_mdio_fec_init);
-module_exit(fs_enet_mdio_fec_exit);
+module_platform_driver(fs_enet_fec_mdio_driver);
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 8dee1ae..f109602 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -443,15 +443,6 @@ static struct platform_driver fsl_pq_mdio_driver = {
.remove = fsl_pq_mdio_remove,
};
-int __init fsl_pq_mdio_init(void)
-{
- return platform_driver_register(&fsl_pq_mdio_driver);
-}
-module_init(fsl_pq_mdio_init);
+module_platform_driver(fsl_pq_mdio_driver);
-void fsl_pq_mdio_exit(void)
-{
- platform_driver_unregister(&fsl_pq_mdio_driver);
-}
-module_exit(fsl_pq_mdio_exit);
MODULE_LICENSE("GPL");
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 8e21ceb..e01cdaa 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -3281,16 +3281,4 @@ static struct platform_driver gfar_driver = {
.remove = gfar_remove,
};
-static int __init gfar_init(void)
-{
- return platform_driver_register(&gfar_driver);
-}
-
-static void __exit gfar_exit(void)
-{
- platform_driver_unregister(&gfar_driver);
-}
-
-module_init(gfar_init);
-module_exit(gfar_exit);
-
+module_platform_driver(gfar_driver);
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
index f67b8ae..83e0ed7 100644
--- a/drivers/net/ethernet/freescale/gianfar_ptp.c
+++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
@@ -562,21 +562,7 @@ static struct platform_driver gianfar_ptp_driver = {
.remove = gianfar_ptp_remove,
};
-/* module operations */
-
-static int __init ptp_gianfar_init(void)
-{
- return platform_driver_register(&gianfar_ptp_driver);
-}
-
-module_init(ptp_gianfar_init);
-
-static void __exit ptp_gianfar_exit(void)
-{
- platform_driver_unregister(&gianfar_ptp_driver);
-}
-
-module_exit(ptp_gianfar_exit);
+module_platform_driver(gianfar_ptp_driver);
MODULE_AUTHOR("Richard Cochran <richard.cochran@omicron.at>");
MODULE_DESCRIPTION("PTP clock using the eTSEC");
diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c
index d8430f4..6ad094f 100644
--- a/drivers/net/ethernet/korina.c
+++ b/drivers/net/ethernet/korina.c
@@ -1230,18 +1230,7 @@ static struct platform_driver korina_driver = {
.remove = korina_remove,
};
-static int __init korina_init_module(void)
-{
- return platform_driver_register(&korina_driver);
-}
-
-static void korina_cleanup_module(void)
-{
- return platform_driver_unregister(&korina_driver);
-}
-
-module_init(korina_init_module);
-module_exit(korina_cleanup_module);
+module_platform_driver(korina_driver);
MODULE_AUTHOR("Philip Rischel <rischelp@idt.com>");
MODULE_AUTHOR("Felix Fietkau <nbd@openwrt.org>");
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index d17d062..5ec409e 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1645,18 +1645,7 @@ static struct platform_driver pxa168_eth_driver = {
},
};
-static int __init pxa168_init_module(void)
-{
- return platform_driver_register(&pxa168_eth_driver);
-}
-
-static void __exit pxa168_cleanup_module(void)
-{
- platform_driver_unregister(&pxa168_eth_driver);
-}
-
-module_init(pxa168_init_module);
-module_exit(pxa168_cleanup_module);
+module_platform_driver(pxa168_eth_driver);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Ethernet driver for Marvell PXA168");
diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c
index de9f2e2..0a85690 100644
--- a/drivers/net/ethernet/micrel/ks8842.c
+++ b/drivers/net/ethernet/micrel/ks8842.c
@@ -1264,18 +1264,7 @@ static struct platform_driver ks8842_platform_driver = {
.remove = ks8842_remove,
};
-static int __init ks8842_init(void)
-{
- return platform_driver_register(&ks8842_platform_driver);
-}
-
-static void __exit ks8842_exit(void)
-{
- platform_driver_unregister(&ks8842_platform_driver);
-}
-
-module_init(ks8842_init);
-module_exit(ks8842_exit);
+module_platform_driver(ks8842_platform_driver);
MODULE_DESCRIPTION("Timberdale KS8842 ethernet driver");
MODULE_AUTHOR("Mocean Laboratories <info@mocean-labs.com>");
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index 228c5c0..e58e78e 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1658,18 +1658,7 @@ static struct platform_driver ks8851_platform_driver = {
.remove = __devexit_p(ks8851_remove),
};
-static int __init ks8851_init(void)
-{
- return platform_driver_register(&ks8851_platform_driver);
-}
-
-static void __exit ks8851_exit(void)
-{
- platform_driver_unregister(&ks8851_platform_driver);
-}
-
-module_init(ks8851_init);
-module_exit(ks8851_exit);
+module_platform_driver(ks8851_platform_driver);
MODULE_DESCRIPTION("KS8851 MLL Network driver");
MODULE_AUTHOR("David Choi <david.choi@micrel.com>");
diff --git a/drivers/net/ethernet/natsemi/jazzsonic.c b/drivers/net/ethernet/natsemi/jazzsonic.c
index fc7c6a9..5b89fd3 100644
--- a/drivers/net/ethernet/natsemi/jazzsonic.c
+++ b/drivers/net/ethernet/natsemi/jazzsonic.c
@@ -294,15 +294,4 @@ static struct platform_driver jazz_sonic_driver = {
},
};
-static int __init jazz_sonic_init_module(void)
-{
- return platform_driver_register(&jazz_sonic_driver);
-}
-
-static void __exit jazz_sonic_cleanup_module(void)
-{
- platform_driver_unregister(&jazz_sonic_driver);
-}
-
-module_init(jazz_sonic_init_module);
-module_exit(jazz_sonic_cleanup_module);
+module_platform_driver(jazz_sonic_driver);
diff --git a/drivers/net/ethernet/natsemi/macsonic.c b/drivers/net/ethernet/natsemi/macsonic.c
index a2eacbf..70367d7 100644
--- a/drivers/net/ethernet/natsemi/macsonic.c
+++ b/drivers/net/ethernet/natsemi/macsonic.c
@@ -643,15 +643,4 @@ static struct platform_driver mac_sonic_driver = {
},
};
-static int __init mac_sonic_init_module(void)
-{
- return platform_driver_register(&mac_sonic_driver);
-}
-
-static void __exit mac_sonic_cleanup_module(void)
-{
- platform_driver_unregister(&mac_sonic_driver);
-}
-
-module_init(mac_sonic_init_module);
-module_exit(mac_sonic_cleanup_module);
+module_platform_driver(mac_sonic_driver);
diff --git a/drivers/net/ethernet/natsemi/xtsonic.c b/drivers/net/ethernet/natsemi/xtsonic.c
index ccf61b9..e01c0a0 100644
--- a/drivers/net/ethernet/natsemi/xtsonic.c
+++ b/drivers/net/ethernet/natsemi/xtsonic.c
@@ -319,15 +319,4 @@ static struct platform_driver xtsonic_driver = {
},
};
-static int __init xtsonic_init(void)
-{
- return platform_driver_register(&xtsonic_driver);
-}
-
-static void __exit xtsonic_cleanup(void)
-{
- platform_driver_unregister(&xtsonic_driver);
-}
-
-module_init(xtsonic_init);
-module_exit(xtsonic_cleanup);
+module_platform_driver(xtsonic_driver);
diff --git a/drivers/net/ethernet/nuvoton/w90p910_ether.c b/drivers/net/ethernet/nuvoton/w90p910_ether.c
index f1bfb8f..b75a049 100644
--- a/drivers/net/ethernet/nuvoton/w90p910_ether.c
+++ b/drivers/net/ethernet/nuvoton/w90p910_ether.c
@@ -1103,18 +1103,7 @@ static struct platform_driver w90p910_ether_driver = {
},
};
-static int __init w90p910_ether_init(void)
-{
- return platform_driver_register(&w90p910_ether_driver);
-}
-
-static void __exit w90p910_ether_exit(void)
-{
- platform_driver_unregister(&w90p910_ether_driver);
-}
-
-module_init(w90p910_ether_init);
-module_exit(w90p910_ether_exit);
+module_platform_driver(w90p910_ether_driver);
MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
MODULE_DESCRIPTION("w90p910 MAC driver!");
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 9b23074..ebfb682 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1957,18 +1957,7 @@ static struct platform_driver sh_eth_driver = {
},
};
-static int __init sh_eth_init(void)
-{
- return platform_driver_register(&sh_eth_driver);
-}
-
-static void __exit sh_eth_cleanup(void)
-{
- platform_driver_unregister(&sh_eth_driver);
-}
-
-module_init(sh_eth_init);
-module_exit(sh_eth_cleanup);
+module_platform_driver(sh_eth_driver);
MODULE_AUTHOR("Nobuhiro Iwamatsu, Yoshihiro Shimoda");
MODULE_DESCRIPTION("Renesas SuperH Ethernet driver");
diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq/sgiseeq.c
index c3673f1..f955a19 100644
--- a/drivers/net/ethernet/seeq/sgiseeq.c
+++ b/drivers/net/ethernet/seeq/sgiseeq.c
@@ -834,23 +834,7 @@ static struct platform_driver sgiseeq_driver = {
}
};
-static int __init sgiseeq_module_init(void)
-{
- if (platform_driver_register(&sgiseeq_driver)) {
- printk(KERN_ERR "Driver registration failed\n");
- return -ENODEV;
- }
-
- return 0;
-}
-
-static void __exit sgiseeq_module_exit(void)
-{
- platform_driver_unregister(&sgiseeq_driver);
-}
-
-module_init(sgiseeq_module_init);
-module_exit(sgiseeq_module_exit);
+module_platform_driver(sgiseeq_driver);
MODULE_DESCRIPTION("SGI Seeq 8003 driver");
MODULE_AUTHOR("Linux/MIPS Mailing List <linux-mips@linux-mips.org>");
diff --git a/drivers/net/ethernet/sgi/meth.c b/drivers/net/ethernet/sgi/meth.c
index 60135aa..f98c6c6 100644
--- a/drivers/net/ethernet/sgi/meth.c
+++ b/drivers/net/ethernet/sgi/meth.c
@@ -830,24 +830,7 @@ static struct platform_driver meth_driver = {
}
};
-static int __init meth_init_module(void)
-{
- int err;
-
- err = platform_driver_register(&meth_driver);
- if (err)
- printk(KERN_ERR "Driver registration failed\n");
-
- return err;
-}
-
-static void __exit meth_exit_module(void)
-{
- platform_driver_unregister(&meth_driver);
-}
-
-module_init(meth_init_module);
-module_exit(meth_exit_module);
+module_platform_driver(meth_driver);
MODULE_AUTHOR("Ilya Volynets <ilya@theIlya.com>");
MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver");
diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index 8f61fe9..313ba3b 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -2196,15 +2196,4 @@ static struct platform_driver smc911x_driver = {
},
};
-static int __init smc911x_init(void)
-{
- return platform_driver_register(&smc911x_driver);
-}
-
-static void __exit smc911x_cleanup(void)
-{
- platform_driver_unregister(&smc911x_driver);
-}
-
-module_init(smc911x_init);
-module_exit(smc911x_cleanup);
+module_platform_driver(smc911x_driver);
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index f47f81e..64ad3ed 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -2417,15 +2417,4 @@ static struct platform_driver smc_driver = {
},
};
-static int __init smc_init(void)
-{
- return platform_driver_register(&smc_driver);
-}
-
-static void __exit smc_cleanup(void)
-{
- platform_driver_unregister(&smc_driver);
-}
-
-module_init(smc_init);
-module_exit(smc_cleanup);
+module_platform_driver(smc_driver);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 20e8267..24c2bf6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2131,27 +2131,6 @@ static struct platform_driver stmmac_driver = {
},
};
-/**
- * stmmac_init_module - Entry point for the driver
- * Description: This function is the entry point for the driver.
- */
-static int __init stmmac_init_module(void)
-{
- int ret;
-
- ret = platform_driver_register(&stmmac_driver);
- return ret;
-}
-
-/**
- * stmmac_cleanup_module - Cleanup routine for the driver
- * Description: This function is the cleanup routine for the driver.
- */
-static void __exit stmmac_cleanup_module(void)
-{
- platform_driver_unregister(&stmmac_driver);
-}
-
#ifndef MODULE
static int __init stmmac_cmdline_opt(char *str)
{
@@ -2211,8 +2190,7 @@ err:
__setup("stmmaceth=", stmmac_cmdline_opt);
#endif
-module_init(stmmac_init_module);
-module_exit(stmmac_cleanup_module);
+module_platform_driver(stmmac_driver);
MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet driver");
MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>");
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c
index 0d8cfd9..220f724 100644
--- a/drivers/net/ethernet/sun/sunbmac.c
+++ b/drivers/net/ethernet/sun/sunbmac.c
@@ -1293,15 +1293,4 @@ static struct platform_driver bigmac_sbus_driver = {
.remove = __devexit_p(bigmac_sbus_remove),
};
-static int __init bigmac_init(void)
-{
- return platform_driver_register(&bigmac_sbus_driver);
-}
-
-static void __exit bigmac_exit(void)
-{
- platform_driver_unregister(&bigmac_sbus_driver);
-}
-
-module_init(bigmac_init);
-module_exit(bigmac_exit);
+module_platform_driver(bigmac_sbus_driver);
diff --git a/drivers/net/ethernet/tundra/tsi108_eth.c b/drivers/net/ethernet/tundra/tsi108_eth.c
index a8df7ec..a9ce01ba 100644
--- a/drivers/net/ethernet/tundra/tsi108_eth.c
+++ b/drivers/net/ethernet/tundra/tsi108_eth.c
@@ -1688,18 +1688,6 @@ static void tsi108_timed_checker(unsigned long dev_ptr)
mod_timer(&data->timer, jiffies + CHECK_PHY_INTERVAL);
}
-static int tsi108_ether_init(void)
-{
- int ret;
- ret = platform_driver_register (&tsi_eth_driver);
- if (ret < 0){
- printk("tsi108_ether_init: error initializing ethernet "
- "device\n");
- return ret;
- }
- return 0;
-}
-
static int tsi108_ether_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
@@ -1714,13 +1702,7 @@ static int tsi108_ether_remove(struct platform_device *pdev)
return 0;
}
-static void tsi108_ether_exit(void)
-{
- platform_driver_unregister(&tsi_eth_driver);
-}
-
-module_init(tsi108_ether_init);
-module_exit(tsi108_ether_exit);
+module_platform_driver(tsi_eth_driver);
MODULE_AUTHOR("Tundra Semiconductor Corporation");
MODULE_DESCRIPTION("Tsi108 Gigabit Ethernet driver");
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 1ade9e1..282330d 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1181,17 +1181,7 @@ static struct platform_driver temac_of_driver = {
},
};
-static int __init temac_init(void)
-{
- return platform_driver_register(&temac_of_driver);
-}
-module_init(temac_init);
-
-static void __exit temac_exit(void)
-{
- platform_driver_unregister(&temac_of_driver);
-}
-module_exit(temac_exit);
+module_platform_driver(temac_of_driver);
MODULE_DESCRIPTION("Xilinx LL_TEMAC Ethernet driver");
MODULE_AUTHOR("Yoshio Kashiwagi");
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 8018d7d..dca6541 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1303,27 +1303,7 @@ static struct platform_driver xemaclite_of_driver = {
.remove = __devexit_p(xemaclite_of_remove),
};
-/**
- * xgpiopss_init - Initial driver registration call
- *
- * Return: 0 upon success, or a negative error upon failure.
- */
-static int __init xemaclite_init(void)
-{
- /* No kernel boot options used, we just need to register the driver */
- return platform_driver_register(&xemaclite_of_driver);
-}
-
-/**
- * xemaclite_cleanup - Driver un-registration call
- */
-static void __exit xemaclite_cleanup(void)
-{
- platform_driver_unregister(&xemaclite_of_driver);
-}
-
-module_init(xemaclite_init);
-module_exit(xemaclite_cleanup);
+module_platform_driver(xemaclite_of_driver);
MODULE_AUTHOR("Xilinx, Inc.");
MODULE_DESCRIPTION("Xilinx Ethernet MAC Lite driver");
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH v6 01/10] Basic kernel memory functionality for the Memory Controller
From: KAMEZAWA Hiroyuki @ 2011-11-28 2:24 UTC (permalink / raw)
To: Glauber Costa
Cc: linux-kernel, lizf, ebiederm, davem, paul, gthelen, netdev,
linux-mm, kirill, avagin, devel, eric.dumazet, cgroups
In-Reply-To: <1322242696-27682-2-git-send-email-glommer@parallels.com>
On Fri, 25 Nov 2011 15:38:07 -0200
Glauber Costa <glommer@parallels.com> wrote:
> This patch lays down the foundation for the kernel memory component
> of the Memory Controller.
>
> As of today, I am only laying down the following files:
>
> * memory.independent_kmem_limit
> * memory.kmem.limit_in_bytes (currently ignored)
> * memory.kmem.usage_in_bytes (always zero)
>
> Signed-off-by: Glauber Costa <glommer@parallels.com>
> Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name>
> CC: Paul Menage <paul@paulmenage.org>
> CC: Greg Thelen <gthelen@google.com>
> ---
> Documentation/cgroups/memory.txt | 36 ++++++++++++-
> init/Kconfig | 14 +++++
> mm/memcontrol.c | 107 ++++++++++++++++++++++++++++++++++++--
> 3 files changed, 150 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
> index 06eb6d9..bf00cd2 100644
> --- a/Documentation/cgroups/memory.txt
> +++ b/Documentation/cgroups/memory.txt
> @@ -44,8 +44,9 @@ Features:
> - oom-killer disable knob and oom-notifier
> - Root cgroup has no limit controls.
>
> - Kernel memory and Hugepages are not under control yet. We just manage
> - pages on LRU. To add more controls, we have to take care of performance.
> + Hugepages is not under control yet. We just manage pages on LRU. To add more
> + controls, we have to take care of performance. Kernel memory support is work
> + in progress, and the current version provides basically functionality.
>
> Brief summary of control files.
>
> @@ -56,8 +57,11 @@ Brief summary of control files.
> (See 5.5 for details)
> memory.memsw.usage_in_bytes # show current res_counter usage for memory+Swap
> (See 5.5 for details)
> + memory.kmem.usage_in_bytes # show current res_counter usage for kmem only.
> + (See 2.7 for details)
> memory.limit_in_bytes # set/show limit of memory usage
> memory.memsw.limit_in_bytes # set/show limit of memory+Swap usage
> + memory.kmem.limit_in_bytes # if allowed, set/show limit of kernel memory
> memory.failcnt # show the number of memory usage hits limits
> memory.memsw.failcnt # show the number of memory+Swap hits limits
> memory.max_usage_in_bytes # show max memory usage recorded
> @@ -72,6 +76,9 @@ Brief summary of control files.
> memory.oom_control # set/show oom controls.
> memory.numa_stat # show the number of memory usage per numa node
>
> + memory.independent_kmem_limit # select whether or not kernel memory limits are
> + independent of user limits
> +
> 1. History
>
> The memory controller has a long history. A request for comments for the memory
> @@ -255,6 +262,31 @@ When oom event notifier is registered, event will be delivered.
> per-zone-per-cgroup LRU (cgroup's private LRU) is just guarded by
> zone->lru_lock, it has no lock of its own.
>
> +2.7 Kernel Memory Extension (CONFIG_CGROUP_MEM_RES_CTLR_KMEM)
> +
> + With the Kernel memory extension, the Memory Controller is able to limit
> +the amount of kernel memory used by the system. Kernel memory is fundamentally
> +different than user memory, since it can't be swapped out, which makes it
> +possible to DoS the system by consuming too much of this precious resource.
> +Kernel memory limits are not imposed for the root cgroup.
> +
> +Memory limits as specified by the standard Memory Controller may or may not
> +take kernel memory into consideration. This is achieved through the file
> +memory.independent_kmem_limit. A Value different than 0 will allow for kernel
> +memory to be controlled separately.
> +
> +When kernel memory limits are not independent, the limit values set in
> +memory.kmem files are ignored.
> +
> +Currently no soft limit is implemented for kernel memory. It is future work
> +to trigger slab reclaim when those limits are reached.
> +
> +CAUTION: As of this writing, the kmem extention may prevent tasks from moving
> +among cgroups. If a task has kmem accounting in a cgroup, the task cannot be
> +moved until the kmem resource is released. Also, until the resource is fully
> +released, the cgroup cannot be destroyed. So, please consider your use cases
> +and set kmem extention config option carefully.
> +
This seems that memcg 'has' kernel memory limiting feature for all kinds of kmem..
Could you add a list of "currently controled kmems" section ?
And update the list in later patch ?
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
* [PATCH] net/can: convert drivers/net/can/* to use module_platform_driver()
From: Axel Lin @ 2011-11-28 1:42 UTC (permalink / raw)
To: linux-kernel
Cc: Wolfgang Grandegger, David S. Miller, Bhupesh Sharma, Jiri Kosina,
Grant Likely, Anatolij Gustschin, Paul Bolle, Kurt Van Dijck,
Alexey Dobriyan, linux-can, netdev
This patch converts the drivers in drivers/net/can/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Bhupesh Sharma <bhupesh.sharma@st.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: Kurt Van Dijck <kurt.van.dijck@eia.be>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/net/can/at91_can.c | 13 +------------
drivers/net/can/bfin_can.c | 12 +-----------
drivers/net/can/c_can/c_can_platform.c | 12 +-----------
drivers/net/can/flexcan.c | 15 +--------------
drivers/net/can/janz-ican3.c | 13 +------------
drivers/net/can/mscan/mpc5xxx_can.c | 12 +-----------
drivers/net/can/sja1000/sja1000_of_platform.c | 12 +-----------
drivers/net/can/sja1000/sja1000_platform.c | 13 +------------
drivers/net/can/softing/softing_main.c | 16 ++--------------
drivers/net/can/ti_hecc.c | 15 +--------------
10 files changed, 11 insertions(+), 122 deletions(-)
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c
index 044ea06..6ea905c 100644
--- a/drivers/net/can/at91_can.c
+++ b/drivers/net/can/at91_can.c
@@ -1383,18 +1383,7 @@ static struct platform_driver at91_can_driver = {
.id_table = at91_can_id_table,
};
-static int __init at91_can_module_init(void)
-{
- return platform_driver_register(&at91_can_driver);
-}
-
-static void __exit at91_can_module_exit(void)
-{
- platform_driver_unregister(&at91_can_driver);
-}
-
-module_init(at91_can_module_init);
-module_exit(at91_can_module_exit);
+module_platform_driver(at91_can_driver);
MODULE_AUTHOR("Marc Kleine-Budde <mkl@pengutronix.de>");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index a1c5abc..349e0fa 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -676,17 +676,7 @@ static struct platform_driver bfin_can_driver = {
},
};
-static int __init bfin_can_init(void)
-{
- return platform_driver_register(&bfin_can_driver);
-}
-module_init(bfin_can_init);
-
-static void __exit bfin_can_exit(void)
-{
- platform_driver_unregister(&bfin_can_driver);
-}
-module_exit(bfin_can_exit);
+module_platform_driver(bfin_can_driver);
MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
MODULE_LICENSE("GPL");
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index 0b5c6f8..5e1a5ff 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -197,17 +197,7 @@ static struct platform_driver c_can_plat_driver = {
.remove = __devexit_p(c_can_plat_remove),
};
-static int __init c_can_plat_init(void)
-{
- return platform_driver_register(&c_can_plat_driver);
-}
-module_init(c_can_plat_init);
-
-static void __exit c_can_plat_exit(void)
-{
- platform_driver_unregister(&c_can_plat_driver);
-}
-module_exit(c_can_plat_exit);
+module_platform_driver(c_can_plat_driver);
MODULE_AUTHOR("Bhupesh Sharma <bhupesh.sharma@st.com>");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index e023379..165a4c7 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1060,20 +1060,7 @@ static struct platform_driver flexcan_driver = {
.remove = __devexit_p(flexcan_remove),
};
-static int __init flexcan_init(void)
-{
- pr_info("%s netdevice driver\n", DRV_NAME);
- return platform_driver_register(&flexcan_driver);
-}
-
-static void __exit flexcan_exit(void)
-{
- platform_driver_unregister(&flexcan_driver);
- pr_info("%s: driver removed\n", DRV_NAME);
-}
-
-module_init(flexcan_init);
-module_exit(flexcan_exit);
+module_platform_driver(flexcan_driver);
MODULE_AUTHOR("Sascha Hauer <kernel@pengutronix.de>, "
"Marc Kleine-Budde <kernel@pengutronix.de>");
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index 32778d5..08c893c 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -1803,20 +1803,9 @@ static struct platform_driver ican3_driver = {
.remove = __devexit_p(ican3_remove),
};
-static int __init ican3_init(void)
-{
- return platform_driver_register(&ican3_driver);
-}
-
-static void __exit ican3_exit(void)
-{
- platform_driver_unregister(&ican3_driver);
-}
+module_platform_driver(ican3_driver);
MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
MODULE_DESCRIPTION("Janz MODULbus VMOD-ICAN3 Driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:janz-ican3");
-
-module_init(ican3_init);
-module_exit(ican3_exit);
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index 5fedc33..5caa572 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -411,17 +411,7 @@ static struct platform_driver mpc5xxx_can_driver = {
#endif
};
-static int __init mpc5xxx_can_init(void)
-{
- return platform_driver_register(&mpc5xxx_can_driver);
-}
-module_init(mpc5xxx_can_init);
-
-static void __exit mpc5xxx_can_exit(void)
-{
- platform_driver_unregister(&mpc5xxx_can_driver);
-};
-module_exit(mpc5xxx_can_exit);
+module_platform_driver(mpc5xxx_can_driver);
MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>");
MODULE_DESCRIPTION("Freescale MPC5xxx CAN driver");
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index c3dd9d0..f2683eb 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -220,14 +220,4 @@ static struct platform_driver sja1000_ofp_driver = {
.remove = __devexit_p(sja1000_ofp_remove),
};
-static int __init sja1000_ofp_init(void)
-{
- return platform_driver_register(&sja1000_ofp_driver);
-}
-module_init(sja1000_ofp_init);
-
-static void __exit sja1000_ofp_exit(void)
-{
- return platform_driver_unregister(&sja1000_ofp_driver);
-};
-module_exit(sja1000_ofp_exit);
+module_platform_driver(sja1000_ofp_driver);
diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
index d9fadc4..4f50145 100644
--- a/drivers/net/can/sja1000/sja1000_platform.c
+++ b/drivers/net/can/sja1000/sja1000_platform.c
@@ -185,15 +185,4 @@ static struct platform_driver sp_driver = {
},
};
-static int __init sp_init(void)
-{
- return platform_driver_register(&sp_driver);
-}
-
-static void __exit sp_exit(void)
-{
- platform_driver_unregister(&sp_driver);
-}
-
-module_init(sp_init);
-module_exit(sp_exit);
+module_platform_driver(sp_driver);
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index 09a8b86..a7c77c7 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -874,21 +874,9 @@ static struct platform_driver softing_driver = {
.remove = __devexit_p(softing_pdev_remove),
};
-MODULE_ALIAS("platform:softing");
-
-static int __init softing_start(void)
-{
- return platform_driver_register(&softing_driver);
-}
-
-static void __exit softing_stop(void)
-{
- platform_driver_unregister(&softing_driver);
-}
-
-module_init(softing_start);
-module_exit(softing_stop);
+module_platform_driver(softing_driver);
+MODULE_ALIAS("platform:softing");
MODULE_DESCRIPTION("Softing DPRAM CAN driver");
MODULE_AUTHOR("Kurt Van Dijck <kurt.van.dijck@eia.be>");
MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 2adc294..df809e3 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -1037,20 +1037,7 @@ static struct platform_driver ti_hecc_driver = {
.resume = ti_hecc_resume,
};
-static int __init ti_hecc_init_driver(void)
-{
- printk(KERN_INFO DRV_DESC "\n");
- return platform_driver_register(&ti_hecc_driver);
-}
-
-static void __exit ti_hecc_exit_driver(void)
-{
- printk(KERN_INFO DRV_DESC " unloaded\n");
- platform_driver_unregister(&ti_hecc_driver);
-}
-
-module_exit(ti_hecc_exit_driver);
-module_init(ti_hecc_init_driver);
+module_platform_driver(ti_hecc_driver);
MODULE_AUTHOR("Anant Gole <anantgole@ti.com>");
MODULE_LICENSE("GPL v2");
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH v2] net/irda: convert drivers/net/irda/* to use module_platform_driver()
From: David Miller @ 2011-11-28 1:29 UTC (permalink / raw)
To: axel.lin; +Cc: linux-kernel, kuninori.morimoto.gx, samuel, netdev
In-Reply-To: <1322443443.2408.0.camel@phoenix>
From: Axel Lin <axel.lin@gmail.com>
Date: Mon, 28 Nov 2011 09:24:03 +0800
> This patch converts the drivers in drivers/net/irda/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> v2: re-generate the patch against net-next tree.
Applied, thanks a lot.
^ permalink raw reply
* [PATCH v2] net/irda: convert drivers/net/irda/* to use module_platform_driver()
From: Axel Lin @ 2011-11-28 1:24 UTC (permalink / raw)
To: linux-kernel; +Cc: Kuninori Morimoto, Samuel Ortiz, David S. Miller, netdev
This patch converts the drivers in drivers/net/irda/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
v2: re-generate the patch against net-next tree.
drivers/net/irda/bfin_sir.c | 13 +------------
drivers/net/irda/pxaficp_ir.c | 13 +------------
drivers/net/irda/sh_irda.c | 13 +------------
drivers/net/irda/sh_sir.c | 13 +------------
4 files changed, 4 insertions(+), 48 deletions(-)
diff --git a/drivers/net/irda/bfin_sir.c b/drivers/net/irda/bfin_sir.c
index 9d4ce1a..a561ae4 100644
--- a/drivers/net/irda/bfin_sir.c
+++ b/drivers/net/irda/bfin_sir.c
@@ -806,18 +806,7 @@ static struct platform_driver bfin_ir_driver = {
},
};
-static int __init bfin_sir_init(void)
-{
- return platform_driver_register(&bfin_ir_driver);
-}
-
-static void __exit bfin_sir_exit(void)
-{
- platform_driver_unregister(&bfin_ir_driver);
-}
-
-module_init(bfin_sir_init);
-module_exit(bfin_sir_exit);
+module_platform_driver(bfin_ir_driver);
module_param(max_rate, int, 0);
MODULE_PARM_DESC(max_rate, "Maximum baud rate (115200, 57600, 38400, 19200, 9600)");
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index d0851df..81d5275 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -966,18 +966,7 @@ static struct platform_driver pxa_ir_driver = {
.resume = pxa_irda_resume,
};
-static int __init pxa_irda_init(void)
-{
- return platform_driver_register(&pxa_ir_driver);
-}
-
-static void __exit pxa_irda_exit(void)
-{
- platform_driver_unregister(&pxa_ir_driver);
-}
-
-module_init(pxa_irda_init);
-module_exit(pxa_irda_exit);
+module_platform_driver(pxa_ir_driver);
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:pxa2xx-ir");
diff --git a/drivers/net/irda/sh_irda.c b/drivers/net/irda/sh_irda.c
index d275e27..725d6b3 100644
--- a/drivers/net/irda/sh_irda.c
+++ b/drivers/net/irda/sh_irda.c
@@ -873,18 +873,7 @@ static struct platform_driver sh_irda_driver = {
},
};
-static int __init sh_irda_init(void)
-{
- return platform_driver_register(&sh_irda_driver);
-}
-
-static void __exit sh_irda_exit(void)
-{
- platform_driver_unregister(&sh_irda_driver);
-}
-
-module_init(sh_irda_init);
-module_exit(sh_irda_exit);
+module_platform_driver(sh_irda_driver);
MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
MODULE_DESCRIPTION("SuperH IrDA driver");
diff --git a/drivers/net/irda/sh_sir.c b/drivers/net/irda/sh_sir.c
index ed7d7d6..e6661b5 100644
--- a/drivers/net/irda/sh_sir.c
+++ b/drivers/net/irda/sh_sir.c
@@ -808,18 +808,7 @@ static struct platform_driver sh_sir_driver = {
},
};
-static int __init sh_sir_init(void)
-{
- return platform_driver_register(&sh_sir_driver);
-}
-
-static void __exit sh_sir_exit(void)
-{
- platform_driver_unregister(&sh_sir_driver);
-}
-
-module_init(sh_sir_init);
-module_exit(sh_sir_exit);
+module_platform_driver(sh_sir_driver);
MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>");
MODULE_DESCRIPTION("SuperH IrDA driver");
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH 1/1] PHY configuration for compatible issue
From: David Miller @ 2011-11-28 0:22 UTC (permalink / raw)
To: AriesLee; +Cc: ariesleeILan, cooldavid, netdev
In-Reply-To: <1321906842-1476-1-git-send-email-AriesLee@jmicron.com>
From: AriesLee <AriesLee@jmicron.com>
Date: Tue, 22 Nov 2011 04:20:42 +0800
> To perform PHY calibration and set a different EA value by chip ID,
> Whenever the NIC chip power on, ie booting or resuming, we need to
> force HW to calibrate PHY parameter again, and also set a proper EA
> value which gather from experiment.
>
> Those procedures help to reduce compatible issues(NIC is unable to link
> up in some special case) in giga speed.
>
> Signed-off-by: AriesLee <AriesLee@jmicron.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH 5/5] tcp: skip cwnd moderation in TCP_CA_Open in tcp_try_to_open
From: David Miller @ 2011-11-28 0:01 UTC (permalink / raw)
To: ilpo.jarvinen; +Cc: ycheng, ncardwell, netdev, nanditad, therbert
In-Reply-To: <alpine.DEB.2.00.1111221146060.31705@wel-95.cs.helsinki.fi>
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Tue, 22 Nov 2011 13:47:13 +0200 (EET)
> On Mon, 21 Nov 2011, Yuchung Cheng wrote:
>
>> AFAIK cwnd moderation is to lower bursty drops not to discourage
>> (dsack) cheating. I believe the reason is the same in
>> tcp_try_to_open(). We are in common cases, e.g., loss-recovery, this
>> logic hurts performance.
>
> Quote from the patch description: "Senders were overriding cwnd values
> picked during an undo by calling tcp_moderate_cwnd()" ...so after all it
> has to do with undo being limited. IMHO only up to orig_cwnd/2+IW is safe
> due to cheating opportunities. Also FRTO uses orig_cwnd/2 due to same
> reason (it could do the +IW too but IIRC it is only /2 currently). What
> would be the safeguard there after this one is removed? I kind of see your
> point about this particular line being related to burst mitigation but on
> the same time the end result of removal is that undo becomes potentially
> much more aggressive.
I'm apply this patch to net-next now, but Neil and Yucheng are on the hook
to fully look into the issues Ilpo has raised.
Thanks.
^ permalink raw reply
* Re: [PATCH 4/5] tcp: allow undo from reordered DSACKs
From: David Miller @ 2011-11-27 23:58 UTC (permalink / raw)
To: ilpo.jarvinen; +Cc: ncardwell, netdev, nanditad, ycheng, therbert
In-Reply-To: <alpine.DEB.2.00.1111221347290.31705@wel-95.cs.helsinki.fi>
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Tue, 22 Nov 2011 14:44:32 +0200 (EET)
> On Thu, 17 Nov 2011, Neal Cardwell wrote:
>
>> On Thu, Nov 17, 2011 at 12:18 AM, Ilpo Järvinen
>> <ilpo.jarvinen@helsinki.fi> wrote:
>> > On Wed, 16 Nov 2011, Neal Cardwell wrote:
>> >
>> >> Previously, SACK-enabled connections hung around in TCP_CA_Disorder
>> >> state while snd_una==high_seq, just waiting to accumulate DSACKs and
>> >> hopefully undo a cwnd reduction. This could and did lead to the
>> >> following unfortunate scenario: if some incoming ACKs advance snd_una
>> >> beyond high_seq then we were setting undo_marker to 0 and moving to
>> >> TCP_CA_Open, so if (due to reordering in the ACK return path) we
>> >> shortly thereafter received a DSACK then we were no longer able to
>> >> undo the cwnd reduction.
>> >>
>> >> The change: Simplify the congestion avoidance state machine by
>> >> removing the behavior where SACK-enabled connections hung around in
>> >> the TCP_CA_Disorder state just waiting for DSACKs. Instead, when
>> >> snd_una advances to high_seq or beyond we typically move to
>> >> TCP_CA_Open immediately and allow an undo in either TCP_CA_Open or
>> >> TCP_CA_Disorder if we later receive enough DSACKs.
>> >>
>> >> Other patches in this series will provide other changes that are
>> >> necessary to fully fix this problem.
>> >>
>> >> Signed-off-by: Neal Cardwell <ncardwell@google.com>
...
>> > How about extending Disorder state until second cumulative ACK that is
>> > acking >= high_seq?
>>
>> That would seem to add complexity but only provide a partial solution.
>
> Right, I forgot the reordering.
In order to make forward progress I've added Neil's patch to net-next.
> Also, one (serious) word of caution! This change, by its extending of
> CA_Open state, is somewhat similar to what I made FRTO years ago, and
> managed to introduces subtle breaking to the state machine. Please check
> that the problem similar to what was fixed by
> a1c1f281b84a751fdb5ff919da3b09df7297619f does not reappear (possibly in
> some other form causing spurious undos). ...To me it seems that
> tcp_packet_delayed might be similarly confused after the given patch.
Neil, please look into this so we can have any such issues fixed
in time for the next merge window.
Thanks.
^ permalink raw reply
* Re: [PATCH 3/5] tcp: use SACKs and DSACKs that arrive on ACKs below snd_una
From: David Miller @ 2011-11-27 23:57 UTC (permalink / raw)
To: ilpo.jarvinen; +Cc: ncardwell, netdev, nanditad, ycheng, therbert
In-Reply-To: <alpine.DEB.2.00.1111170344580.1205@melkinpaasi.cs.helsinki.fi>
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Thu, 17 Nov 2011 03:52:37 +0200 (EET)
> On Wed, 16 Nov 2011, Neal Cardwell wrote:
>
>> The bug: When the ACK field is below snd_una (which can happen when
>> ACKs are reordered), senders ignored DSACKs (preventing undo) and did
>> not call tcp_fastretrans_alert, so they did not increment
>> prr_delivered to reflect newly-SACKed sequence ranges, and did not
>> call tcp_xmit_retransmit_queue, thus passing up chances to send out
>> more retransmitted and new packets based on any newly-SACKed packets.
>>
>> The change: When the ACK field is below snd_una (the "old_ack" goto
>> label), call tcp_fastretrans_alert to allow undo based on any
>> newly-arrived DSACKs and try to send out more packets based on
>> newly-SACKed packets.
>>
>> Other patches in this series will provide other changes that are
>> necessary to fully fix this problem.
>>
>> Signed-off-by: Neal Cardwell <ncardwell@google.com>
...
> Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Applied to net-next.
> ...unrelated to the fix, I realized that FRTO is not fully thought through
> in this old ACK case, also its RFC seems to lack considerations on what to
> do in such case. ...I'll need to think the FRTO stuff a bit more.
Every feature added to TCP beginning with timestamps has not been well
thought out wrt. reordering. :-)
^ permalink raw reply
* Re: [PATCH 2/5] tcp: use DSACKs that arrive when packets_out is 0
From: David Miller @ 2011-11-27 23:55 UTC (permalink / raw)
To: ilpo.jarvinen; +Cc: ncardwell, netdev, nanditad, ycheng, therbert
In-Reply-To: <alpine.DEB.2.00.1111170323560.1205@melkinpaasi.cs.helsinki.fi>
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Thu, 17 Nov 2011 03:34:17 +0200 (EET)
> On Wed, 16 Nov 2011, Neal Cardwell wrote:
>
>> The bug: Senders ignored DSACKs after recovery when there were no
>> outstanding packets (a common scenario for HTTP servers).
>>
>> The change: when there are no outstanding packets (the "no_queue" goto
>> label), call tcp_fastretrans_alert() in order to use DSACKs to undo
>> congestion window reductions.
>>
>> Other patches in this series will provide other changes that are
>> necessary to fully fix this problem.
>>
>> Signed-off-by: Neal Cardwell <ncardwell@google.com>
...
>
> Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Applied to net-next.
^ permalink raw reply
* Re: [PATCH 1/5] tcp: make is_dupack a parameter to tcp_fastretrans_alert()
From: David Miller @ 2011-11-27 23:55 UTC (permalink / raw)
To: ilpo.jarvinen; +Cc: ncardwell, netdev, nanditad, ycheng, therbert
In-Reply-To: <alpine.DEB.2.00.1111170323020.1205@melkinpaasi.cs.helsinki.fi>
From: "Ilpo Järvinen" <ilpo.jarvinen@helsinki.fi>
Date: Thu, 17 Nov 2011 03:23:53 +0200 (EET)
> On Wed, 16 Nov 2011, Neal Cardwell wrote:
>
>> Allow callers to decide whether an ACK is a duplicate ACK. This is a
>> prerequisite to allowing fastretrans_alert to be called from new
>> contexts, such as the no_queue and old_ack code paths, from which we
>> have extra info that tells us whether an ACK is a dupack.
>>
>> Signed-off-by: Neal Cardwell <ncardwell@google.com>
>
> Acked-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Applied to net-next.
^ permalink raw reply
* Re: [bug?] r8169: hangs under heavy load
From: Francois Romieu @ 2011-11-27 23:11 UTC (permalink / raw)
To: booster
Cc: Jonathan Nieder, Eric Dumazet, netdev, nic_swsd, linux-kernel,
Armin Kazmi, Hayes Wang
In-Reply-To: <4ED2A573.1020807@wolke7.net>
booster@wolke7.net <booster@wolke7.net> :
[...]
> Jonathan, I compiled a new kernel with the patch described above but the
> behavior is still the same. During high network load the link hangs:
>
> [ 195.332478] r8169 0000:02:00.0: eth0: link up
> [ 222.517171] r8169 0000:02:00.0: eth0: link up
> [ 222.908277] r8169 0000:02:00.0: eth0: link up
> [ 223.508249] r8169 0000:02:00.0: eth0: link up
It does recover, doesn't it ?
> Is there a way to activate more driver debugging in the kernel ?
You can lower the delay in rtl8169_schedule_work (4) but it is akin
to papering over the issue.
You may try the stuff below in place of the current patch. I will not
be surprized if the link really hangs (no crash but no traffic).
Hayes, does the 8168c require something special to recover from Rx FIFO
overflow ?
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 6f06aa1..e937737 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -427,6 +427,7 @@ enum rtl_register_content {
/* InterruptStatusBits */
SYSErr = 0x8000,
PCSTimeout = 0x4000,
+ RxFIFOEmpty = 0x0200,
SWInt = 0x0100,
TxDescUnavail = 0x0080,
RxFIFOOver = 0x0040,
@@ -5815,15 +5816,27 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
}
if (unlikely(status & RxFIFOOver)) {
+ int i;
+
switch (tp->mac_version) {
/* Work around for rx fifo overflow */
case RTL_GIGA_MAC_VER_11:
- case RTL_GIGA_MAC_VER_22:
case RTL_GIGA_MAC_VER_26:
netif_stop_queue(dev);
rtl8169_tx_timeout(dev);
goto done;
/* Testers needed. */
+ case RTL_GIGA_MAC_VER_22:
+ for (i = 0; i < 4000000; i++) {
+ if (RTL_R16(IntrStatus) & RxFIFOEmpty) {
+ RTL_W16(IntrStatus, RxFIFOOver);
+ printk(KERN_INFO "FEmp %d\n", i);
+ break;
+ }
+ udelay(10);
+ }
+ if (i >= 4000000)
+ printk(KERN_ERR "no FEmp\n");
case RTL_GIGA_MAC_VER_17:
case RTL_GIGA_MAC_VER_19:
case RTL_GIGA_MAC_VER_20:
^ permalink raw reply related
* Re: [PATCH net-next 6/8] dsa: Allow core and drivers to be built as modules
From: Ben Hutchings @ 2011-11-27 22:39 UTC (permalink / raw)
To: Lennert Buytenhek; +Cc: David Miller, netdev
In-Reply-To: <20111127191955.GU795@wantstofly.org>
[-- Attachment #1: Type: text/plain, Size: 985 bytes --]
On Sun, 2011-11-27 at 20:19 +0100, Lennert Buytenhek wrote:
> On Sat, Nov 26, 2011 at 12:38:38AM +0000, Ben Hutchings wrote:
>
> > Change the kconfig types to tristate and adjust the condition for
> > declaring net_device::dsa_ptr to allow for this.
> >
> > Adjust the makefile so that if NET_DSA_MV88E6123_61_65=y and
> > NET_DSA_MV88E6131=m or vice versa then both drivers are built-in. We
> > could leave these options as bool and make NET_DSA_MV88E6XXX a
> > user-selected option, but that would break existing configurations.
> >
> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
>
> Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
>
> Thanks for the patches!
>
> (While you're at it -- the switch chip drivers in net/dsa/ still
> ought to be moved to drivers/net/dsa/ or so -- feel like whipping up
> a patch for that?)
I agree. Maybe.
Ben.
--
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [PATCH net-next 2/8] dsa: Export functions from core to modules
From: Ben Hutchings @ 2011-11-27 22:38 UTC (permalink / raw)
To: Lennert Buytenhek; +Cc: David Miller, netdev
In-Reply-To: <20111127191556.GQ795@wantstofly.org>
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]
On Sun, 2011-11-27 at 20:15 +0100, Lennert Buytenhek wrote:
[...]
> > diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> > index 56cf9b8..c9d52ca 100644
> > --- a/net/dsa/slave.c
> > +++ b/net/dsa/slave.c
> > @@ -45,6 +45,7 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds)
> > ds->master_mii_bus->id, ds->pd->sw_addr);
> > ds->slave_mii_bus->parent = &ds->master_mii_bus->dev;
> > }
> > +EXPORT_SYMBOL_GPL(dsa_slave_mii_bus_init);
> >
> >
> > /* slave device handling ****************************************************/
> > @@ -402,3 +403,4 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
> >
> > return slave_dev;
> > }
> > +EXPORT_SYMBOL_GPL(dsa_slave_create);
>
> Why do these need to be exported? They are only called from dsa.c,
> and dsa.c and slave.c are always linked into the same entity, even
> after your patches.
Oh, yes. I just failed to revert these exports when I decided they
should be linked together.
Ben.
--
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: [PATCH V2 0/7] net/mlx4 features and fixes
From: David Miller @ 2011-11-27 22:21 UTC (permalink / raw)
To: yevgenyp; +Cc: netdev, ogerlitz, oren, amirv
In-Reply-To: <4ED1D0AB.5010804@mellanox.co.il>
From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Date: Sun, 27 Nov 2011 07:54:51 +0200
> Hello David,
>
> This is V2 ofa series of patches for mlx4_en driver.
> synchronized the different commits into a single series.
>
> The changes from initial commit:
> 1. loobback support patch: control flags are not set on data path.
> 2. Setting number of RSS rings patch was removed for rework following the review.
All applied, thanks.
^ permalink raw reply
* Re: [PATCH] net/irda: convert drivers/net/irda/* to use module_platform_driver()
From: David Miller @ 2011-11-27 22:15 UTC (permalink / raw)
To: axel.lin
Cc: linux-kernel, ppopov, graf.yang, kuninori.morimoto.gx, samuel,
netdev
In-Reply-To: <1322402885.2746.1.camel@phoenix>
From: Axel Lin <axel.lin@gmail.com>
Date: Sun, 27 Nov 2011 22:08:05 +0800
> This patch converts the drivers in drivers/net/irda/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
>
> Cc: Pete Popov <ppopov@mvista.com>
> Cc: Graf Yang <graf.yang@analog.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
This doesn't apply cleanly to the net-next tree, please respin.
^ permalink raw reply
* Re: [PATCH] isdn/gigaset: report ISDN4Linux interface only once
From: David Miller @ 2011-11-27 22:08 UTC (permalink / raw)
To: tilman; +Cc: isdn, hjlipp, keil, i4ldeveloper, netdev, linux-kernel
In-Reply-To: <20111127-patch-gigaset-01.tilman@imap.cc>
From: Tilman Schmidt <tilman@imap.cc>
Date: Sun, 27 Nov 2011 18:39:22 +0100
> Move the "ISDN4Linux interface" message from device registration,
> where it is emitted for each device, to driver registration, where
> it is emitted only once, for consistency with the CAPI variant.
>
> Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Applied to net-next, thanks.
^ permalink raw reply
* Re: [net-next 5/8] bnx2x: Change Warpcore MDIO work around mode
From: David Miller @ 2011-11-27 22:03 UTC (permalink / raw)
To: yanivr; +Cc: netdev, eilong
In-Reply-To: <1322417881-17760-6-git-send-email-yanivr@broadcom.com>
From: "Yaniv Rosner" <yanivr@broadcom.com>
Date: Sun, 27 Nov 2011 20:17:58 +0200
> @@ -11308,7 +11308,9 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port,
> offsetof(struct shmem_region,
> dev_info.port_feature_config[port].link_config)) &
> PORT_FEATURE_CONNECTED_SWITCH_MASK);
> - chip_id = REG_RD(bp, MISC_REG_CHIP_NUM) << 16;
> + chip_id = (REG_RD(bp, MISC_REG_CHIP_NUM) << 16) |
> + ((REG_RD(bp, MISC_REG_CHIP_REV) & 0xf) << 12);
> +
Bad formatting.
^ permalink raw reply
* Re: [net-next 7/8] bnx2x: Fix self test of BCM57800
From: David Miller @ 2011-11-27 22:03 UTC (permalink / raw)
To: yanivr; +Cc: netdev, eilong
In-Reply-To: <1322417881-17760-8-git-send-email-yanivr@broadcom.com>
From: "Yaniv Rosner" <yanivr@broadcom.com>
Date: Sun, 27 Nov 2011 20:18:00 +0200
> + int cfg_idx = bnx2x_get_link_cfg_idx(bp);
> + if (bp->port.supported[cfg_idx] &
> + (SUPPORTED_10000baseT_Full |
> + SUPPORTED_20000baseMLD2_Full |
> + SUPPORTED_20000baseKR2_Full))
Bad tab alignment, again.
^ permalink raw reply
* Re: [net-next 2/8] bnx2x: ETS changes
From: David Miller @ 2011-11-27 22:02 UTC (permalink / raw)
To: yanivr; +Cc: netdev, eilong
In-Reply-To: <1322417881-17760-3-git-send-email-yanivr@broadcom.com>
From: "Yaniv Rosner" <yanivr@broadcom.com>
Date: Sun, 27 Nov 2011 20:17:55 +0200
> + is_bw_cos_exist = 1;
> + if (0 == ets_params->cos[cos_idx].params.bw_params.bw) {
These "0 == X" expressions are not what people commonly use
and therefore hard for others to read. Either use
"X == 0" or "!X" which is much much more preferred.
^ permalink raw reply
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