* [PATCH 0/4] Small network device interface changes
@ 2007-08-16 13:25 Stephen Hemminger
2007-08-16 13:25 ` [PATCH 1/4] net: cleanup left over decl Stephen Hemminger
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Stephen Hemminger @ 2007-08-16 13:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev
These cleanups should go in 2.6.24. Hope they don't conflict too bad
with the NAPI stuff.
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] net: cleanup left over decl
2007-08-16 13:25 [PATCH 0/4] Small network device interface changes Stephen Hemminger
@ 2007-08-16 13:25 ` Stephen Hemminger
2007-08-16 13:25 ` [PATCH 2/4] net: deinline dev_kfree_skb_irq Stephen Hemminger
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2007-08-16 13:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: dev_init.patch --]
[-- Type: text/plain, Size: 497 bytes --]
Remove unneeded declaration.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/include/linux/netdevice.h 2007-08-15 14:29:02.000000000 +0100
+++ b/include/linux/netdevice.h 2007-08-15 14:35:25.000000000 +0100
@@ -833,8 +833,6 @@ extern int dev_set_mac_address(struct n
extern int dev_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev);
-extern void dev_init(void);
-
extern int netdev_budget;
/* Called by rtnetlink.c:rtnl_unlock() */
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] net: deinline dev_kfree_skb_irq
2007-08-16 13:25 [PATCH 0/4] Small network device interface changes Stephen Hemminger
2007-08-16 13:25 ` [PATCH 1/4] net: cleanup left over decl Stephen Hemminger
@ 2007-08-16 13:25 ` Stephen Hemminger
2007-08-16 13:25 ` [PATCH 3/4] net: add dev_get_stats Stephen Hemminger
2007-08-16 13:25 ` [PATCH 4/4] net: netdev_budget rearrangement Stephen Hemminger
3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2007-08-16 13:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: dev_kfree_skb_irq.patch --]
[-- Type: text/plain, Size: 2821 bytes --]
Deinline dev_kfree_skb_irq. This saves about 100bytes per call
site on UP, probably more on SMP.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/include/linux/netdevice.h 2007-08-06 09:26:41.000000000 +0100
+++ b/include/linux/netdevice.h 2007-08-15 14:12:32.000000000 +0100
@@ -793,29 +793,6 @@ static inline int netif_is_multiqueue(co
#endif
}
-/* Use this variant when it is known for sure that it
- * is executing from interrupt context.
- */
-static inline void dev_kfree_skb_irq(struct sk_buff *skb)
-{
- if (atomic_dec_and_test(&skb->users)) {
- struct softnet_data *sd;
- unsigned long flags;
-
- local_irq_save(flags);
- sd = &__get_cpu_var(softnet_data);
- skb->next = sd->completion_queue;
- sd->completion_queue = skb;
- raise_softirq_irqoff(NET_TX_SOFTIRQ);
- local_irq_restore(flags);
- }
-}
-
-/* Use this variant in places where it could be invoked
- * either from interrupt or non-interrupt context.
- */
-extern void dev_kfree_skb_any(struct sk_buff *skb);
-
#define HAVE_NETIF_RX 1
extern int netif_rx(struct sk_buff *skb);
extern int netif_rx_ni(struct sk_buff *skb);
--- a/include/linux/skbuff.h 2007-08-06 09:26:43.000000000 +0100
+++ b/include/linux/skbuff.h 2007-08-15 14:09:04.000000000 +0100
@@ -378,6 +378,8 @@ extern int skb_cow_data(struct sk
struct sk_buff **trailer);
extern int skb_pad(struct sk_buff *skb, int pad);
#define dev_kfree_skb(a) kfree_skb(a)
+extern void dev_kfree_skb_any(struct sk_buff *skb);
+extern void dev_kfree_skb_irq(struct sk_buff *skb);
extern void skb_over_panic(struct sk_buff *skb, int len,
void *here);
extern void skb_under_panic(struct sk_buff *skb, int len,
--- a/net/core/dev.c 2007-08-06 09:26:48.000000000 +0100
+++ b/net/core/dev.c 2007-08-15 14:12:16.000000000 +0100
@@ -1249,6 +1249,36 @@ void __netif_rx_schedule(struct net_devi
}
EXPORT_SYMBOL(__netif_rx_schedule);
+/**
+ * dev_kfree_skb_irq - free skb from IRQ context
+ * @skb: skb to free
+ *
+ * Queue skb for later release. Used when skb needs to be
+ * free but executing in IRQ context.
+ */
+void dev_kfree_skb_irq(struct sk_buff *skb)
+{
+ if (atomic_dec_and_test(&skb->users)) {
+ struct softnet_data *sd;
+ unsigned long flags;
+
+ local_irq_save(flags);
+ sd = &__get_cpu_var(softnet_data);
+ skb->next = sd->completion_queue;
+ sd->completion_queue = skb;
+ raise_softirq_irqoff(NET_TX_SOFTIRQ);
+ local_irq_restore(flags);
+ }
+}
+EXPORT_SYMBOL(dev_kfree_skb_irq);
+
+/**
+ * dev_kfree_skb_any - free skb from any context
+ * @skb: skb to free
+ *
+ * Free skb from interrupt or non-interrupt context.
+ * Use this variant in places where context is not easily determined.
+ */
void dev_kfree_skb_any(struct sk_buff *skb)
{
if (in_irq() || irqs_disabled())
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] net: add dev_get_stats
2007-08-16 13:25 [PATCH 0/4] Small network device interface changes Stephen Hemminger
2007-08-16 13:25 ` [PATCH 1/4] net: cleanup left over decl Stephen Hemminger
2007-08-16 13:25 ` [PATCH 2/4] net: deinline dev_kfree_skb_irq Stephen Hemminger
@ 2007-08-16 13:25 ` Stephen Hemminger
2007-08-16 13:25 ` [PATCH 4/4] net: netdev_budget rearrangement Stephen Hemminger
3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2007-08-16 13:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: dev_get_stats.patch --]
[-- Type: text/plain, Size: 3819 bytes --]
Since we now have internal stats, it cleans up code to have a
dev_get_stats() interface. This allows for future patches where
'network device ops' patch where get_stats is immutable.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/include/linux/netdevice.h 2007-08-16 06:34:25.000000000 -0400
+++ b/include/linux/netdevice.h 2007-08-16 06:38:33.000000000 -0400
@@ -809,6 +809,7 @@ extern int dev_set_mac_address(struct n
struct sockaddr *);
extern int dev_hard_start_xmit(struct sk_buff *skb,
struct net_device *dev);
+extern struct net_device_stats *dev_get_stats(struct net_device *dev);
extern int netdev_budget;
--- a/net/core/dev.c 2007-08-16 06:34:25.000000000 -0400
+++ b/net/core/dev.c 2007-08-16 08:26:04.000000000 -0400
@@ -2304,7 +2304,7 @@ void dev_seq_stop(struct seq_file *seq,
static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
{
- struct net_device_stats *stats = dev->get_stats(dev);
+ struct net_device_stats *stats = dev_get_stats(dev);
seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
"%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
@@ -3682,10 +3682,21 @@ out:
mutex_unlock(&net_todo_run_mutex);
}
-static struct net_device_stats *internal_stats(struct net_device *dev)
+/**
+ * dev_get_stats - get network device statistics
+ * @dev: network device
+ *
+ * Get standard network device statistics.
+ * Use internal stastics unless device overides
+ */
+struct net_device_stats *dev_get_stats(struct net_device *dev)
{
- return &dev->stats;
+ if (!dev->get_stats)
+ return &dev->stats;
+
+ return dev->get_stats(dev);
}
+EXPORT_SYMBOL(dev_get_stats);
/**
* alloc_netdev_mq - allocate network device
@@ -3733,7 +3744,6 @@ struct net_device *alloc_netdev_mq(int s
dev->egress_subqueue_count = queue_count;
- dev->get_stats = internal_stats;
setup(dev);
strcpy(dev->name, name);
return dev;
--- a/net/core/net-sysfs.c 2007-08-16 06:34:25.000000000 -0400
+++ b/net/core/net-sysfs.c 2007-08-16 09:23:13.000000000 -0400
@@ -264,8 +264,7 @@ static ssize_t netstat_show(const struct
WARN_ON(1);
read_lock(&dev_base_lock);
- if (dev_isalive(dev) && dev->get_stats &&
- (stats = (*dev->get_stats)(dev)))
+ if (dev_isalive(dev) && (stats = dev_get_stats(dev)))
ret = sprintf(buf, fmt_ulong,
*(unsigned long *)(((u8 *) stats) + offset));
@@ -481,8 +480,7 @@ int netdev_register_sysfs(struct net_dev
BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ);
strlcpy(dev->bus_id, net->name, BUS_ID_SIZE);
- if (net->get_stats)
- *groups++ = &netstat_group;
+ *groups++ = &netstat_group;
#ifdef CONFIG_WIRELESS_EXT
if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
--- a/net/core/rtnetlink.c 2007-08-16 06:34:25.000000000 -0400
+++ b/net/core/rtnetlink.c 2007-08-16 08:26:13.000000000 -0400
@@ -619,6 +619,7 @@ static int rtnl_fill_ifinfo(struct sk_bu
{
struct ifinfomsg *ifm;
struct nlmsghdr *nlh;
+ struct net_device_stats *stats;
nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags);
if (nlh == NULL)
@@ -666,18 +667,13 @@ static int rtnl_fill_ifinfo(struct sk_bu
NLA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast);
}
- if (dev->get_stats) {
- struct net_device_stats *stats = dev->get_stats(dev);
- if (stats) {
- struct nlattr *attr;
-
- attr = nla_reserve(skb, IFLA_STATS,
- sizeof(struct rtnl_link_stats));
- if (attr == NULL)
- goto nla_put_failure;
+ if ((stats = dev_get_stats(dev))) {
+ struct nlattr *attr = nla_reserve(skb, IFLA_STATS,
+ sizeof(struct rtnl_link_stats));
+ if (attr == NULL)
+ goto nla_put_failure;
- copy_rtnl_link_stats(nla_data(attr), stats);
- }
+ copy_rtnl_link_stats(nla_data(attr), stats);
}
if (dev->rtnl_link_ops) {
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] net: netdev_budget rearrangement
2007-08-16 13:25 [PATCH 0/4] Small network device interface changes Stephen Hemminger
` (2 preceding siblings ...)
2007-08-16 13:25 ` [PATCH 3/4] net: add dev_get_stats Stephen Hemminger
@ 2007-08-16 13:25 ` Stephen Hemminger
3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2007-08-16 13:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: netdev_budget.patch --]
[-- Type: text/plain, Size: 867 bytes --]
Trivial patch, move netdev_budget declaration out of netdevice.h
to a new home with the other sysctl externs.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/include/linux/netdevice.h 2007-08-16 06:38:33.000000000 -0400
+++ b/include/linux/netdevice.h 2007-08-16 09:24:08.000000000 -0400
@@ -811,8 +811,6 @@ extern int dev_hard_start_xmit(struct s
struct net_device *dev);
extern struct net_device_stats *dev_get_stats(struct net_device *dev);
-extern int netdev_budget;
-
/* Called by rtnetlink.c:rtnl_unlock() */
extern void netdev_run_todo(void);
--- a/net/core/sysctl_net_core.c 2007-08-06 04:26:48.000000000 -0400
+++ b/net/core/sysctl_net_core.c 2007-08-16 09:24:08.000000000 -0400
@@ -13,6 +13,7 @@
#ifdef CONFIG_SYSCTL
+extern int netdev_budget;
extern int netdev_max_backlog;
extern int weight_p;
--
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-08-16 13:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16 13:25 [PATCH 0/4] Small network device interface changes Stephen Hemminger
2007-08-16 13:25 ` [PATCH 1/4] net: cleanup left over decl Stephen Hemminger
2007-08-16 13:25 ` [PATCH 2/4] net: deinline dev_kfree_skb_irq Stephen Hemminger
2007-08-16 13:25 ` [PATCH 3/4] net: add dev_get_stats Stephen Hemminger
2007-08-16 13:25 ` [PATCH 4/4] net: netdev_budget rearrangement Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.