* Re: [Xen-devel] [PATCH net-next 4/5] xen: convert to 64 bit stats interface
From: Stephen Hemminger @ 2011-06-21 15:29 UTC (permalink / raw)
To: Ian Campbell
Cc: davem@davemloft.net, Jeremy Fitzhardinge, netdev@vger.kernel.org,
xen-devel@lists.xensource.com
In-Reply-To: <1308665154.6920.46.camel@zakaz.uk.xensource.com>
On Tue, 21 Jun 2011 15:05:54 +0100
Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Mon, 2011-06-20 at 21:35 +0100, Stephen Hemminger wrote:
> > Convert xen driver to 64 bit statistics interface.
> > Use stats_sync to ensure that 64 bit update is read atomically
> > on 32 bit platform. Put hot statistics into per-cpu table.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> Thanks Stephen.
>
> > @@ -867,12 +882,13 @@ static int handle_incoming_queue(struct
> > if (checksum_setup(dev, skb)) {
> > kfree_skb(skb);
> > packets_dropped++;
> > - dev->stats.rx_errors++;
>
> Why is this dropped? We should be counting these somehow, I think.
>
> [...]
>
> > >From shemminger@vyatta.com Mon Jun 20 13:36:03 2011
> > Message-Id: <20110620203603.019928129@vyatta.com>
> > User-Agent: quilt/0.48-1
> > Date: Mon, 20 Jun 2011 13:35:11 -0700
> > From: Stephen Hemminger <shemminger@vyatta.com>
> > To: davem@davemloft.net
> > Cc: netdev@vger.kernel.org
> > Subject: [PATCH net-next 5/5] ifb: convert to 64 bit stats
> > References: <20110620203506.363818794@vyatta.com>
> > Content-Disposition: inline; filename=ifb-stats64.patch
> >
> > Convert input functional block device to use 64 bit stats.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> > ---
> > v2 - add stats_sync
> >
> >
> > --- a/drivers/net/ifb.c 2011-06-09 14:39:25.000000000 -0700
> > +++ b/drivers/net/ifb.c 2011-06-20 13:30:30.135992612 -0700
>
> This entire patch was appended in the mail I got -- something up with
> your scripting?
Bad mbox file to quilt, merged two patches
^ permalink raw reply
* Re: [Xen-devel] [PATCH net-next 4/5] xen: convert to 64 bit stats interface
From: Stephen Hemminger @ 2011-06-21 15:35 UTC (permalink / raw)
To: Ian Campbell
Cc: davem@davemloft.net, Jeremy Fitzhardinge, netdev@vger.kernel.org,
xen-devel@lists.xensource.com
In-Reply-To: <1308665154.6920.46.camel@zakaz.uk.xensource.com>
Convert xen driver to 64 bit statistics interface.
Use stats_sync to ensure that 64 bit update is read atomically on 32 bit platform.
Put hot statistics into per-cpu table.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
v2 - add stats_sync and per-cpu
v2.1 - keep rx_errors on checksum error
--- a/drivers/net/xen-netfront.c 2011-06-20 14:50:01.271989938 -0700
+++ b/drivers/net/xen-netfront.c 2011-06-21 08:33:12.851953760 -0700
@@ -70,6 +70,14 @@ struct netfront_cb {
#define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE)
#define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
+struct netfront_stats {
+ u64 rx_packets;
+ u64 tx_packets;
+ u64 rx_bytes;
+ u64 tx_bytes;
+ struct u64_stats_sync syncp;
+};
+
struct netfront_info {
struct list_head list;
struct net_device *netdev;
@@ -122,6 +130,8 @@ struct netfront_info {
struct mmu_update rx_mmu[NET_RX_RING_SIZE];
/* Statistics */
+ struct netfront_stats __percpu *stats;
+
unsigned long rx_gso_checksum_fixup;
};
@@ -468,6 +478,7 @@ static int xennet_start_xmit(struct sk_b
{
unsigned short id;
struct netfront_info *np = netdev_priv(dev);
+ struct netfront_stats *stats = this_cpu_ptr(np->stats);
struct xen_netif_tx_request *tx;
struct xen_netif_extra_info *extra;
char *data = skb->data;
@@ -552,8 +563,10 @@ static int xennet_start_xmit(struct sk_b
if (notify)
notify_remote_via_irq(np->netdev->irq);
- dev->stats.tx_bytes += skb->len;
- dev->stats.tx_packets++;
+ u64_stats_update_begin(&stats->syncp);
+ stats->tx_bytes += skb->len;
+ stats->tx_packets++;
+ u64_stats_update_end(&stats->syncp);
/* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
xennet_tx_buf_gc(dev);
@@ -847,6 +860,8 @@ out:
static int handle_incoming_queue(struct net_device *dev,
struct sk_buff_head *rxq)
{
+ struct netfront_info *np = netdev_priv(dev);
+ struct netfront_stats *stats = this_cpu_ptr(np->stats);
int packets_dropped = 0;
struct sk_buff *skb;
@@ -871,8 +886,10 @@ static int handle_incoming_queue(struct
continue;
}
- dev->stats.rx_packets++;
- dev->stats.rx_bytes += skb->len;
+ u64_stats_update_begin(&stats->syncp);
+ stats->rx_packets++;
+ stats->rx_bytes += skb->len;
+ u64_stats_update_end(&stats->syncp);
/* Pass it up. */
netif_receive_skb(skb);
@@ -1034,6 +1051,38 @@ static int xennet_change_mtu(struct net_
return 0;
}
+static struct rtnl_link_stats64 *xennet_get_stats64(struct net_device *dev,
+ struct rtnl_link_stats64 *tot)
+{
+ struct netfront_info *np = netdev_priv(dev);
+ int cpu;
+
+ for_each_possible_cpu(cpu) {
+ struct netfront_stats *stats = per_cpu_ptr(np->stats, cpu);
+ u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
+ unsigned int start;
+
+ do {
+ start = u64_stats_fetch_begin_bh(&stats->syncp);
+
+ rx_packets = stats->rx_packets;
+ tx_packets = stats->tx_packets;
+ rx_bytes = stats->rx_bytes;
+ tx_bytes = stats->tx_bytes;
+ } while (u64_stats_fetch_retry_bh(&stats->syncp, start));
+
+ tot->rx_packets += rx_packets;
+ tot->tx_packets += tx_packets;
+ tot->rx_bytes += rx_bytes;
+ tot->tx_bytes += tx_bytes;
+ }
+
+ tot->rx_errors = dev->stats.rx_errors;
+ tot->tx_dropped = dev->stats.tx_dropped;
+
+ return tot;
+}
+
static void xennet_release_tx_bufs(struct netfront_info *np)
{
struct sk_buff *skb;
@@ -1182,6 +1231,7 @@ static const struct net_device_ops xenne
.ndo_stop = xennet_close,
.ndo_start_xmit = xennet_start_xmit,
.ndo_change_mtu = xennet_change_mtu,
+ .ndo_get_stats64 = xennet_get_stats64,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_fix_features = xennet_fix_features,
@@ -1216,6 +1266,11 @@ static struct net_device * __devinit xen
np->rx_refill_timer.data = (unsigned long)netdev;
np->rx_refill_timer.function = rx_refill_timeout;
+ err = -ENOMEM;
+ np->stats = alloc_percpu(struct netfront_stats);
+ if (np->stats == NULL)
+ goto exit;
+
/* Initialise tx_skbs as a free chain containing every entry. */
np->tx_skb_freelist = 0;
for (i = 0; i < NET_TX_RING_SIZE; i++) {
@@ -1234,7 +1289,7 @@ static struct net_device * __devinit xen
&np->gref_tx_head) < 0) {
printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
err = -ENOMEM;
- goto exit;
+ goto exit_free_stats;
}
/* A grant for every rx ring slot */
if (gnttab_alloc_grant_references(RX_MAX_TARGET,
@@ -1270,6 +1325,8 @@ static struct net_device * __devinit xen
exit_free_tx:
gnttab_free_grant_references(np->gref_tx_head);
+ exit_free_stats:
+ free_percpu(np->stats);
exit:
free_netdev(netdev);
return ERR_PTR(err);
@@ -1869,6 +1926,8 @@ static int __devexit xennet_remove(struc
xennet_sysfs_delif(info->netdev);
+ free_percpu(info->stats);
+
free_netdev(info->netdev);
return 0;
^ permalink raw reply
* Re: [Xen-devel] [PATCH net-next 4/5] xen: convert to 64 bit stats interface
From: Ian Campbell @ 2011-06-21 15:38 UTC (permalink / raw)
To: Stephen Hemminger
Cc: davem@davemloft.net, Jeremy Fitzhardinge, netdev@vger.kernel.org,
xen-devel@lists.xensource.com
In-Reply-To: <20110621083531.00442d7f@nehalam.ftrdhcpuser.net>
On Tue, 2011-06-21 at 16:35 +0100, Stephen Hemminger wrote:
> Convert xen driver to 64 bit statistics interface.
> Use stats_sync to ensure that 64 bit update is read atomically on 32 bit platform.
> Put hot statistics into per-cpu table.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> ---
> v2 - add stats_sync and per-cpu
> v2.1 - keep rx_errors on checksum error
Thanks. Looks good to me from the Xen side.
Acked-by: Ian Campbell <ian.campbell@citrix.com>
>
> --- a/drivers/net/xen-netfront.c 2011-06-20 14:50:01.271989938 -0700
> +++ b/drivers/net/xen-netfront.c 2011-06-21 08:33:12.851953760 -0700
> @@ -70,6 +70,14 @@ struct netfront_cb {
> #define NET_RX_RING_SIZE __CONST_RING_SIZE(xen_netif_rx, PAGE_SIZE)
> #define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
>
> +struct netfront_stats {
> + u64 rx_packets;
> + u64 tx_packets;
> + u64 rx_bytes;
> + u64 tx_bytes;
> + struct u64_stats_sync syncp;
> +};
> +
> struct netfront_info {
> struct list_head list;
> struct net_device *netdev;
> @@ -122,6 +130,8 @@ struct netfront_info {
> struct mmu_update rx_mmu[NET_RX_RING_SIZE];
>
> /* Statistics */
> + struct netfront_stats __percpu *stats;
> +
> unsigned long rx_gso_checksum_fixup;
> };
>
> @@ -468,6 +478,7 @@ static int xennet_start_xmit(struct sk_b
> {
> unsigned short id;
> struct netfront_info *np = netdev_priv(dev);
> + struct netfront_stats *stats = this_cpu_ptr(np->stats);
> struct xen_netif_tx_request *tx;
> struct xen_netif_extra_info *extra;
> char *data = skb->data;
> @@ -552,8 +563,10 @@ static int xennet_start_xmit(struct sk_b
> if (notify)
> notify_remote_via_irq(np->netdev->irq);
>
> - dev->stats.tx_bytes += skb->len;
> - dev->stats.tx_packets++;
> + u64_stats_update_begin(&stats->syncp);
> + stats->tx_bytes += skb->len;
> + stats->tx_packets++;
> + u64_stats_update_end(&stats->syncp);
>
> /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
> xennet_tx_buf_gc(dev);
> @@ -847,6 +860,8 @@ out:
> static int handle_incoming_queue(struct net_device *dev,
> struct sk_buff_head *rxq)
> {
> + struct netfront_info *np = netdev_priv(dev);
> + struct netfront_stats *stats = this_cpu_ptr(np->stats);
> int packets_dropped = 0;
> struct sk_buff *skb;
>
> @@ -871,8 +886,10 @@ static int handle_incoming_queue(struct
> continue;
> }
>
> - dev->stats.rx_packets++;
> - dev->stats.rx_bytes += skb->len;
> + u64_stats_update_begin(&stats->syncp);
> + stats->rx_packets++;
> + stats->rx_bytes += skb->len;
> + u64_stats_update_end(&stats->syncp);
>
> /* Pass it up. */
> netif_receive_skb(skb);
> @@ -1034,6 +1051,38 @@ static int xennet_change_mtu(struct net_
> return 0;
> }
>
> +static struct rtnl_link_stats64 *xennet_get_stats64(struct net_device *dev,
> + struct rtnl_link_stats64 *tot)
> +{
> + struct netfront_info *np = netdev_priv(dev);
> + int cpu;
> +
> + for_each_possible_cpu(cpu) {
> + struct netfront_stats *stats = per_cpu_ptr(np->stats, cpu);
> + u64 rx_packets, rx_bytes, tx_packets, tx_bytes;
> + unsigned int start;
> +
> + do {
> + start = u64_stats_fetch_begin_bh(&stats->syncp);
> +
> + rx_packets = stats->rx_packets;
> + tx_packets = stats->tx_packets;
> + rx_bytes = stats->rx_bytes;
> + tx_bytes = stats->tx_bytes;
> + } while (u64_stats_fetch_retry_bh(&stats->syncp, start));
> +
> + tot->rx_packets += rx_packets;
> + tot->tx_packets += tx_packets;
> + tot->rx_bytes += rx_bytes;
> + tot->tx_bytes += tx_bytes;
> + }
> +
> + tot->rx_errors = dev->stats.rx_errors;
> + tot->tx_dropped = dev->stats.tx_dropped;
> +
> + return tot;
> +}
> +
> static void xennet_release_tx_bufs(struct netfront_info *np)
> {
> struct sk_buff *skb;
> @@ -1182,6 +1231,7 @@ static const struct net_device_ops xenne
> .ndo_stop = xennet_close,
> .ndo_start_xmit = xennet_start_xmit,
> .ndo_change_mtu = xennet_change_mtu,
> + .ndo_get_stats64 = xennet_get_stats64,
> .ndo_set_mac_address = eth_mac_addr,
> .ndo_validate_addr = eth_validate_addr,
> .ndo_fix_features = xennet_fix_features,
> @@ -1216,6 +1266,11 @@ static struct net_device * __devinit xen
> np->rx_refill_timer.data = (unsigned long)netdev;
> np->rx_refill_timer.function = rx_refill_timeout;
>
> + err = -ENOMEM;
> + np->stats = alloc_percpu(struct netfront_stats);
> + if (np->stats == NULL)
> + goto exit;
> +
> /* Initialise tx_skbs as a free chain containing every entry. */
> np->tx_skb_freelist = 0;
> for (i = 0; i < NET_TX_RING_SIZE; i++) {
> @@ -1234,7 +1289,7 @@ static struct net_device * __devinit xen
> &np->gref_tx_head) < 0) {
> printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
> err = -ENOMEM;
> - goto exit;
> + goto exit_free_stats;
> }
> /* A grant for every rx ring slot */
> if (gnttab_alloc_grant_references(RX_MAX_TARGET,
> @@ -1270,6 +1325,8 @@ static struct net_device * __devinit xen
>
> exit_free_tx:
> gnttab_free_grant_references(np->gref_tx_head);
> + exit_free_stats:
> + free_percpu(np->stats);
> exit:
> free_netdev(netdev);
> return ERR_PTR(err);
> @@ -1869,6 +1926,8 @@ static int __devexit xennet_remove(struc
>
> xennet_sysfs_delif(info->netdev);
>
> + free_percpu(info->stats);
> +
> free_netdev(info->netdev);
>
> return 0;
>
^ permalink raw reply
* TCP new-reno support?
From: Ben Greear @ 2011-06-21 15:50 UTC (permalink / raw)
To: netdev
I see a large number of TCP congestion algorithms supported, but
nothing that explicitly says newreno. Is it actually supported?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [PATCH iproute2] ss: fix autobound filter
From: Stephen Hemminger @ 2011-06-21 15:54 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <1308316911.2780.6.camel@edumazet-laptop>
On Fri, 17 Jun 2011 15:21:51 +0200
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Fixes following error. We currently provide garbage data to kernel, that
> can abort the validation process or produce unexpected results.
>
> $ ss -a autobound
> State Recv-Q Send-Q Local Address:Port Peer Address:Port
> TCPDIAG answers: Invalid argument
>
> After patch:
>
> $ misc/ss -a autobound
> State Recv-Q Send-Q Local Address:Port Peer Address:Port
> LISTEN 0 128 *:44624 *:*
> ESTAB 0 0 192.168.1.21:47141 74.125.79.109:imaps
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied thanks
^ permalink raw reply
* Dear Webmail Subscriber
From: WEBMAIL MANAGEMENT SERVICE @ 2011-06-21 12:18 UTC (permalink / raw)
Dear Webmail Subscribers,
webmail service has upgraded its security level to prevent hackers,
viruses and spywares from getting into your mailbox.
In order to complete this security update, We encourage you to clik on
this link just to upgrad your webmail account
https://spreadsheets.google.com/spreadsheet/viewform?formkey=dGl6cmV1WEFSYTdJTU9SM0l2TkNtSnc6MQ
We hope you'll enjoy our approach to webmail service.
Please don't reply directly to this automatically-generated e-mail message.
Sincerely,
WEBMAIL MANAGEMENT SERVICE!
^ permalink raw reply
* Re: [PATCH] netconsole: fix build when CONFIG_NETCONSOLE_DYNAMIC is turned on
From: Randy Dunlap @ 2011-06-21 16:12 UTC (permalink / raw)
To: WANG Cong, Ben Hutchings; +Cc: netdev, Andrew Morton, davem, hilld
In-Reply-To: <itq425$lqb$1@dough.gmane.org>
On Tue, 21 Jun 2011 12:50:14 +0000 (UTC) WANG Cong wrote:
> On Mon, 20 Jun 2011 21:25:04 -0700, Randy Dunlap wrote:
>
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> >
> > When NETCONSOLE_DYNAMIC=y and CONFIGFS_FS=m, there are build errors in
> > netconsole:
> >
> > drivers/built-in.o: In function `drop_netconsole_target':
> > netconsole.c:(.text+0x1a100f): undefined reference to `config_item_put'
> > drivers/built-in.o: In function `make_netconsole_target':
> > netconsole.c:(.text+0x1a10b9): undefined reference to
> > `config_item_init_type_name' drivers/built-in.o: In function
> > `write_msg': netconsole.c:(.text+0x1a11a4): undefined reference to
> > `config_item_get' netconsole.c:(.text+0x1a1211): undefined reference to
> > `config_item_put' drivers/built-in.o: In function
> > `netconsole_netdev_event': netconsole.c:(.text+0x1a12cc): undefined
> > reference to `config_item_put' netconsole.c:(.text+0x1a12ec): undefined
> > reference to `config_item_get' netconsole.c:(.text+0x1a1366): undefined
> > reference to `config_item_put' drivers/built-in.o: In function
> > `init_netconsole': netconsole.c:(.init.text+0x953a): undefined reference
> > to `config_group_init' netconsole.c:(.init.text+0x9560): undefined
> > reference to `configfs_register_subsystem' drivers/built-in.o: In
> > function `dynamic_netconsole_exit': netconsole.c:(.exit.text+0x809):
> > undefined reference to `configfs_unregister_subsystem'
> >
> > so make NETCONSOLE_DYNAMIC require CONFIGFS_FS=y to fix the build
> > errors.
> >
> > This is one possible fix.
> > Fixes https://bugzilla.kernel.org/show_bug.cgi?id=37992
> >
> > Reported-by: David Hill <hilld@binarystorm.net> Signed-off-by: Randy
> > Dunlap <randy.dunlap@oracle.com> ---
> > drivers/net/Kconfig | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- lnx-30-rc3.orig/drivers/net/Kconfig +++
> > lnx-30-rc3/drivers/net/Kconfig
> > @@ -3416,7 +3416,7 @@ config NETCONSOLE
> >
> > config NETCONSOLE_DYNAMIC
> > bool "Dynamic reconfiguration of logging targets"
> > - depends on NETCONSOLE && SYSFS && CONFIGFS_FS
> > + depends on NETCONSOLE
> > && SYSFS && CONFIGFS_FS=y
>
> I recall someone already fixed this by adding "select CONFIGFS_FS",
> who removed it again... :-/
Hi,
Thanks for the reminder. I'll try Ben Hutchings' suggestion.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply
* Re: TCP new-reno support?
From: Alexander Zimmermann @ 2011-06-21 16:32 UTC (permalink / raw)
To: Ben Greear; +Cc: netdev
In-Reply-To: <4E00BDAB.1040309@candelatech.com>
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
Hi,
Am 21.06.2011 um 17:50 schrieb Ben Greear:
> I see a large number of TCP congestion algorithms supported, but
> nothing that explicitly says newreno.
It's implicit :-)
> Is it actually supported?
tcp_congestion_control=reno
tcp_dsack=0
tcp_fack=0
tcp_sack=0
tcp_frto=0
then, you get NewReno. And, yes, it's not possible to get Reno
Alex
>
> Thanks,
> Ben
>
> --
> Ben Greear <greearb@candelatech.com>
> Candela Technologies Inc http://www.candelatech.com
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
//
// Dipl.-Inform. Alexander Zimmermann
// Department of Computer Science, Informatik 4
// RWTH Aachen University
// Ahornstr. 55, 52056 Aachen, Germany
// phone: (49-241) 80-21422, fax: (49-241) 80-22222
// email: zimmermann@cs.rwth-aachen.de
// web: http://www.umic-mesh.net
//
[-- Attachment #2: Signierter Teil der Nachricht --]
[-- Type: application/pgp-signature, Size: 243 bytes --]
^ permalink raw reply
* Re: TCP new-reno support?
From: Ben Greear @ 2011-06-21 16:35 UTC (permalink / raw)
To: Alexander Zimmermann; +Cc: netdev
In-Reply-To: <A6200100-A147-481C-8230-9782822EA1F7@comsys.rwth-aachen.de>
On 06/21/2011 09:32 AM, Alexander Zimmermann wrote:
> Hi,
>
> Am 21.06.2011 um 17:50 schrieb Ben Greear:
>
>> I see a large number of TCP congestion algorithms supported, but
>> nothing that explicitly says newreno.
>
> It's implicit :-)
>
>> Is it actually supported?
>
> tcp_congestion_control=reno
> tcp_dsack=0
> tcp_fack=0
> tcp_sack=0
> tcp_frto=0
>
> then, you get NewReno. And, yes, it's not possible to get Reno
Thanks!
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* [RFC 3/7] ixgbe: use netdev_irqname
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20110621170541.309890798@vyatta.com>
[-- Attachment #1: ixgbe-use-irq-name.patch --]
[-- Type: text/plain, Size: 1563 bytes --]
New standard function for generating irq names.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/ixgbe/ixgbe_main.c 2011-06-21 09:30:35.327952251 -0700
+++ b/drivers/net/ixgbe/ixgbe_main.c 2011-06-21 09:32:33.483952184 -0700
@@ -2352,20 +2352,19 @@ static int ixgbe_request_msix_irqs(struc
struct ixgbe_q_vector *q_vector = adapter->q_vector[vector];
handler = SET_HANDLER(q_vector);
- if (handler == &ixgbe_msix_clean_rx) {
- snprintf(q_vector->name, sizeof(q_vector->name) - 1,
- "%s-%s-%d", netdev->name, "rx", ri++);
- } else if (handler == &ixgbe_msix_clean_tx) {
- snprintf(q_vector->name, sizeof(q_vector->name) - 1,
- "%s-%s-%d", netdev->name, "tx", ti++);
- } else if (handler == &ixgbe_msix_clean_many) {
- snprintf(q_vector->name, sizeof(q_vector->name) - 1,
- "%s-%s-%d", netdev->name, "TxRx", ri++);
+ if (handler == &ixgbe_msix_clean_rx)
+ netdev_irqname(q_vector->name, sizeof(q_vector->name),
+ netdev, NETIF_IRQ_RX, ri++);
+ else if (handler == &ixgbe_msix_clean_tx)
+ netdev_irqname(q_vector->name, sizeof(q_vector->name),
+ netdev, NETIF_IRQ_TX, ti++);
+ else if (handler == &ixgbe_msix_clean_many) {
+ netdev_irqname(q_vector->name, sizeof(q_vector->name),
+ netdev, NETIF_IRQ_TXRX, ri++);
ti++;
- } else {
- /* skip this unused q_vector */
+ } else /* skip this unused q_vector */
continue;
- }
+
err = request_irq(adapter->msix_entries[vector].vector,
handler, 0, q_vector->name,
q_vector);
^ permalink raw reply
* [RFC 0/7] network device irq naming
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
This is a proposal for a wrapper routine to cause
network devices to have standard convention for IRQ naming.
Includes a subset of devices to show how it would be used
and some of the existing problems.
^ permalink raw reply
* [RFC 1/7] netdev: add standardized irq naming function
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20110621170541.309890798@vyatta.com>
[-- Attachment #1: netdev-irq-name.patch --]
[-- Type: text/plain, Size: 1561 bytes --]
To force driver developers to use a standard convention for naming
network device IRQ's, provide a standardized method for creating
the name.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/include/linux/netdevice.h 2011-06-21 08:58:32.207953328 -0700
+++ b/include/linux/netdevice.h 2011-06-21 09:12:12.155952869 -0700
@@ -2631,6 +2631,46 @@ static inline const char *netdev_name(co
return dev->name;
}
+/* function bits for netdev_irqname */
+#define NETIF_IRQ_TX 1
+#define NETIF_IRQ_RX 2
+#define NETIF_IRQ_TXRX 3
+#define NETIF_IRQ_OTHER 0 /* none of the above */
+
+/**
+ * netdev_irqname - generate name for irq
+ * @buf: space to store result
+ * @buflen: sizeof buf
+ * @dev: network device
+ * @queue: assoctiated network queue
+ * @function: function of irq
+ *
+ * Format a IRQ name according to standard convention to be passed
+ * to request_irq().
+ */
+static inline const char *netdev_irqname(char *buf, size_t buflen,
+ const struct net_device *dev,
+ unsigned queue,
+ unsigned function)
+{
+ switch (function) {
+ case NETIF_IRQ_TX:
+ snprintf(buf, buflen, "%s-tx-%u", dev->name, queue);
+ break;
+ case NETIF_IRQ_RX:
+ snprintf(buf, buflen, "%s-rx-%u", dev->name, queue);
+ break;
+ case NETIF_IRQ_TXRX:
+ snprintf(buf, buflen, "%s-%u", dev->name, queue);
+ break;
+ default:
+ snprintf(buf, buflen, "%s", dev->name);
+ }
+
+ return buf;
+}
+
+
extern int netdev_printk(const char *level, const struct net_device *dev,
const char *format, ...)
__attribute__ ((format (printf, 3, 4)));
^ permalink raw reply
* [RFC 6/7] niu: use netdev_irqname
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20110621170541.309890798@vyatta.com>
[-- Attachment #1: niu-use-irqname.patch --]
[-- Type: text/plain, Size: 841 bytes --]
This device also has some other IRQ's unrelated to rings
which are named with another convention.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/niu.c 2011-06-21 09:57:00.739951363 -0700
+++ b/drivers/net/niu.c 2011-06-21 09:59:22.683951282 -0700
@@ -6048,11 +6048,12 @@ static void niu_set_irq_name(struct niu
for (i = 0; i < np->num_ldg - j; i++) {
if (i < np->num_rx_rings)
- sprintf(np->irq_name[i+j], "%s-rx-%d",
- np->dev->name, i);
+ netdev_irqname(np->irq_name[i+j], IFNAMSIZ+6,
+ np->dev, NETIF_IRQ_RX, i);
else if (i < np->num_tx_rings + np->num_rx_rings)
- sprintf(np->irq_name[i+j], "%s-tx-%d", np->dev->name,
- i - np->num_rx_rings);
+ netdev_irqname(np->irq_name[i+j], IFNAMSIZ+6,
+ np->dev, NETIF_IRQ_TX,
+ i - np->num_rx_rings);
}
}
^ permalink raw reply
* [RFC 2/7] igb: use netdev_irqname
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20110621170541.309890798@vyatta.com>
[-- Attachment #1: igb-use-irq-name.patch --]
[-- Type: text/plain, Size: 1563 bytes --]
This is an example of usage of netdev_irqname to create standard
IRQ names. There is a change of behavior, the driver will now skip
unused IRQ vectors (similar to ixgbe).
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/igb/igb_main.c 2011-06-21 09:12:49.567952849 -0700
+++ b/drivers/net/igb/igb_main.c 2011-06-21 09:29:48.211952277 -0700
@@ -920,16 +920,20 @@ static int igb_request_msix(struct igb_a
q_vector->itr_register = hw->hw_addr + E1000_EITR(vector);
if (q_vector->rx_ring && q_vector->tx_ring)
- sprintf(q_vector->name, "%s-TxRx-%u", netdev->name,
- q_vector->rx_ring->queue_index);
+ netdev_irqname(q_vector->name, sizeof(q_vector->name),
+ netdev, NETIF_IRQ_TXRX,
+ q_vector->rx_ring->queue_index);
else if (q_vector->tx_ring)
- sprintf(q_vector->name, "%s-tx-%u", netdev->name,
- q_vector->tx_ring->queue_index);
+ netdev_irqname(q_vector->name, sizeof(q_vector->name),
+ netdev, NETIF_IRQ_TX,
+ q_vector->tx_ring->queue_index);
else if (q_vector->rx_ring)
- sprintf(q_vector->name, "%s-rx-%u", netdev->name,
- q_vector->rx_ring->queue_index);
- else
- sprintf(q_vector->name, "%s-unused", netdev->name);
+ netdev_irqname(q_vector->name, sizeof(q_vector->name),
+ netdev, NETIF_IRQ_RX,
+ q_vector->rx_ring->queue_index);
+ else /* skip this unused q_vector */
+ continue;
+
err = request_irq(adapter->msix_entries[vector].vector,
igb_msix_ring, 0, q_vector->name,
^ permalink raw reply
* [RFC 5/7] bnx2: use netdev_irqname
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20110621170541.309890798@vyatta.com>
[-- Attachment #1: bnx2-use-irqname.patch --]
[-- Type: text/plain, Size: 1006 bytes --]
Also increase size of irq name to account for longer device names.
Original code was broken for full size names.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/bnx2.c 2011-06-21 09:52:00.527951530 -0700
+++ b/drivers/net/bnx2.c 2011-06-21 09:52:58.807951497 -0700
@@ -6173,7 +6173,8 @@ bnx2_enable_msix(struct bnx2 *bp, int ms
bp->flags |= BNX2_FLAG_USING_MSIX | BNX2_FLAG_ONE_SHOT_MSI;
for (i = 0; i < total_vecs; i++) {
bp->irq_tbl[i].vector = msix_ent[i].vector;
- snprintf(bp->irq_tbl[i].name, len, "%s-%d", dev->name, i);
+ netdev_irqname(bp->irq_tbl[i].name, len,
+ dev, NETIF_IRQ_TXRX, i);
bp->irq_tbl[i].handler = bnx2_msi_1shot;
}
}
--- a/drivers/net/bnx2.h 2011-06-21 09:53:18.331951487 -0700
+++ b/drivers/net/bnx2.h 2011-06-21 09:53:51.723951469 -0700
@@ -6657,7 +6657,7 @@ struct bnx2_irq {
irq_handler_t handler;
unsigned int vector;
u8 requested;
- char name[IFNAMSIZ + 2];
+ char name[32];
};
struct bnx2_tx_ring_info {
^ permalink raw reply
* [RFC 4/7] benet: use irq naming standard
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20110621170541.309890798@vyatta.com>
[-- Attachment #1: benet-use-irqname.patch --]
[-- Type: text/plain, Size: 1687 bytes --]
Use the standard for network device IRQ nameing for multiqueue devices.
It appears, this device has one transmit interrup, but multiple receive
interrupts. They will now be named:
ethX-tx-0 ethX-rx-0 ethX-rx-1 ...
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/benet/be_main.c 2011-06-21 09:34:01.407952135 -0700
+++ b/drivers/net/benet/be_main.c 2011-06-21 09:41:03.643951899 -0700
@@ -2196,13 +2196,16 @@ static inline int be_msix_vec_get(struct
}
static int be_request_irq(struct be_adapter *adapter,
- struct be_eq_obj *eq_obj,
- void *handler, char *desc, void *context)
+ struct be_eq_obj *eq_obj,
+ unsigned int usage, unsigned int queue,
+ irq_handler_t handler, void *context)
{
struct net_device *netdev = adapter->netdev;
int vec;
- sprintf(eq_obj->desc, "%s-%s", netdev->name, desc);
+ netdev_irqname(eq_obj->desc, sizeof(eq_obj->desc),
+ netdev, usage, queue);
+
vec = be_msix_vec_get(adapter, eq_obj);
return request_irq(vec, handler, 0, eq_obj->desc, context);
}
@@ -2218,17 +2221,17 @@ static int be_msix_register(struct be_ad
{
struct be_rx_obj *rxo;
int status, i;
- char qname[10];
- status = be_request_irq(adapter, &adapter->tx_eq, be_msix_tx_mcc, "tx",
- adapter);
+ status = be_request_irq(adapter, &adapter->tx_eq,
+ NETIF_IRQ_TX, 0,
+ be_msix_tx_mcc, adapter);
if (status)
goto err;
for_all_rx_queues(adapter, rxo, i) {
- sprintf(qname, "rxq%d", i);
- status = be_request_irq(adapter, &rxo->rx_eq, be_msix_rx,
- qname, rxo);
+ status = be_request_irq(adapter, &rxo->rx_eq,
+ NETIF_IRQ_RX, i,
+ be_msix_rx, rxo);
if (status)
goto err_msix;
}
^ permalink raw reply
* [RFC 7/7] netxen: use netdev_irqname
From: Stephen Hemminger @ 2011-06-21 17:05 UTC (permalink / raw)
To: davem; +Cc: netdev
In-Reply-To: <20110621170541.309890798@vyatta.com>
[-- Attachment #1: netxen-use-irqname.patch --]
[-- Type: text/plain, Size: 763 bytes --]
Use the new netdev_irqname to cause network device interrupts to
be named according to the standard convention of "ethX-N".
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/drivers/net/netxen/netxen_nic_main.c 2011-06-21 10:00:10.223951255 -0700
+++ b/drivers/net/netxen/netxen_nic_main.c 2011-06-21 10:02:46.695951169 -0700
@@ -955,7 +955,8 @@ netxen_nic_request_irq(struct netxen_ada
for (ring = 0; ring < adapter->max_sds_rings; ring++) {
sds_ring = &recv_ctx->sds_rings[ring];
- sprintf(sds_ring->name, "%s[%d]", netdev->name, ring);
+ netdev_irqname(sds_ring->name, sizeof(sds_ring->name),
+ netdev, NETIF_IRQ_TXRX, ring);
err = request_irq(sds_ring->irq, handler,
flags, sds_ring->name, sds_ring);
if (err)
^ permalink raw reply
* Re: [PATCH]: Add Network Sysrq Support
From: Stephen Hemminger @ 2011-06-21 17:08 UTC (permalink / raw)
To: Prarit Bhargava; +Cc: netdev, davem, agospoda, nhorman, lwoodman
In-Reply-To: <20110621130040.12035.62533.sendpatchset@prarit.bos.redhat.com>
On Tue, 21 Jun 2011 09:00:40 -0400
Prarit Bhargava <prarit@redhat.com> wrote:
> Add Network Sysrq Support
>
> In some circumstances, a system can hang/lockup in such a way that the system
> is completely unresponsive to keyboard or console input but is still
> responsive to ping. The config option, CONFIG_SYSRQ_PING, builds
> net/ipv4/sysrq-ping.ko which allows a root user to configure the system for
> a remote sysrq.
>
> To use this do:
>
> mount -t debugfs none /sys/kernel/debug/
> echo 1 > /proc/sys/kernel/sysrq
> echo <hex digit val> > /sys/kernel/debug/network_sysrq_magic
> echo 1 > /sys/kernel/debug/network_sysrq_enable
>
> Then on another system on the network you can do:
>
> ping -c 1 -p <up to 30 hex digit val><hex val of sysrq> <target_system_name>
>
> ex) sysrq-m, m is ascii 0x6d
>
> ping -c 1 p 1623a06f554d46d676d <target_system_name>
>
> Note that the network sysrq automatically disables after the receipt of
> the ping, ie) it is single-shot mode. If you want to use this again, you
> must complete the above four steps again.
>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Isn't same functionality already available with netconsole?
^ permalink raw reply
* Re: [PATCH 1/2] udp: add tracepoints for queueing skb to rcvbuf
From: Steven Rostedt @ 2011-06-21 17:14 UTC (permalink / raw)
To: Hagen Paul Pfeifer
Cc: Neil Horman, Satoru Moriya, netdev, Seiji Aguchi, Ingo Molnar
In-Reply-To: <5b828bb3667480edda9a4a77918007ee@localhost>
On Tue, 2011-06-21 at 16:48 +0200, Hagen Paul Pfeifer wrote:
> On Tue, 21 Jun 2011 09:50:09 -0400, Neil Horman wrote:
>
> > I hadn't really thought about that much, but yes, I suppose I could
> migrate
> > dropwatch to export kfree_skb data via perf. Admittedly I don't know
> much
> > about
> > the perf api. Do you have any pointers on its use (to save me time in
> > figuring
> > out how it all works)? If so I'll start looking into it.
>
> http://git.kernel.org/?p=status/powertop/powertop.git;a=tree;f=perf;hb=HEAD
Please please do not copy this code and reuse it. You will end up
forcing us to this ABI forever!
Please read this for background:
http://lwn.net/Articles/442113/
I plan on doing a libperf.so that will allow any tool to interact with
trace events in the kernel the proper way. Yes trace-cmd currently has
its own library that deals with this properly, but the library is not
shipped with distros.
I plan on taking the trace-cmd library (which perf even uses - an older
verion) and make it into the libperf.so that distros will ship. But
unfortunately, my work has gotten in the way (the work that actually
pays me) and I'm doing other things at the moment.
-- Steve
>
> is probably a good starting point. Especially
> perf_bundle.cpp:handle_trace_point(). But I am not sure if this is the most
> clever way. The direct us of the perf api is somewhat dodgy (not sure if
> the ABI will change). IIRC Steven Rostedt wrote about a user space library
> (I CC'ed Steven). BUT: tracing via /sys/kernel/debug/tracing/* may be
> enough, eventually there is no need for perf at all. Then trace-cmd may
> provide some nice ideas how to wrap the /sys/kernel/debug/tracing interface
> programmatically.
>
> The idea behind dropwatch is great! There is currently to much
> unconsolidated information. It takes a genius to understand where and later
> why packets are dropped. A userspace tool where no kernel patch is required
> is a big plus! ;-)
>
> Hagen
^ permalink raw reply
* RE: [RFC 2/2] ethtool: Add support for DMA Coalescing feature config to ethtool.
From: Wyborny, Carolyn @ 2011-06-21 17:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev@vger.kernel.org, bhutchings@solarflare.com
In-Reply-To: <20110617.145420.866989290749857501.davem@davemloft.net>
>-----Original Message-----
>From: David Miller [mailto:davem@davemloft.net]
>Sent: Friday, June 17, 2011 11:54 AM
>To: Wyborny, Carolyn
>Cc: netdev@vger.kernel.org; bhutchings@solarflare.com
>Subject: Re: [RFC 2/2] ethtool: Add support for DMA Coalescing feature
>config to ethtool.
>
>From: "Wyborny, Carolyn" <carolyn.wyborny@intel.com>
>Date: Fri, 17 Jun 2011 08:50:11 -0700
>
>> I will add a fuller description of the feature in my updated patch.
>> I thought the feature was more well known. Quick description is that
>> it's a power saving feature that causes the adapter to coalesce its
>> DMA writes at low traffic times to save power on the platform by
>> reducing wakeups. The parameter is intended as a simple u32 value,
>> not just an on or off, but also to allow a variety of configuration
>> by adapter vendors, with validation of the input on the driver side.
>> Since I left out the implementation in my patch, this wasn't clear.
>> I will also fix this in my next submission.
>
>The value cannot have adapter specific meaning, you must define it
>precisely and in a generic manner, such that the user can specify the
>same setting across different card types.
Ok, good point. I will refine the definition of the parameter in the next submission, once the dust clears on the major revisions in progress.
Thanks,
Carolyn
Carolyn Wyborny
Linux Development
LAN Access Division
Intel Corporation
^ permalink raw reply
* [PATCH] mcp251x: Fix duplicate transmissions
From: Ken Ballentine @ 2011-06-21 17:28 UTC (permalink / raw)
To: wg-5Yr1BZd7O62+XT7JhA+gdA
Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1.1: Type: text/plain, Size: 383 bytes --]
Use the RTS SPI instruction instead of setting the TXREQ bit. This works
around errata item 5 for the MCP2515, as described by Microchip in
http://ww1.microchip.com/downloads/en/DeviceDoc/80179g.pdf.
Signed-off-by: Ken Ballentine <ken.ballentine-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
Signed-off-by: Michael Williamson <michael.williamson-wZX4cNJlHJ2sVWG7oymsAA@public.gmane.org>
[-- Attachment #1.2: Type: text/html, Size: 631 bytes --]
[-- Attachment #2: mcp251x.patch --]
[-- Type: application/octet-stream, Size: 1289 bytes --]
diff -uNr linux-2.6.39.1.orig/drivers/net/can/mcp251x.c linux-2.6.39.1.new/drivers/net/can/mcp251x.c
--- linux-2.6.39.1.orig/drivers/net/can/mcp251x.c 2011-06-02 20:34:20.000000000 -0400
+++ linux-2.6.39.1.new/drivers/net/can/mcp251x.c 2011-06-21 12:07:43.720708907 -0400
@@ -82,6 +82,7 @@
#define INSTRUCTION_BIT_MODIFY 0x05
#define INSTRUCTION_LOAD_TXB(n) (0x40 + 2 * (n))
#define INSTRUCTION_READ_RXB(n) (((n) == 0) ? 0x90 : 0x94)
+#define INSTRUCTION_RTS(n) (0x80 | (1 << n))
#define INSTRUCTION_RESET 0xC0
/* MPC251x registers */
@@ -377,6 +378,15 @@
mcp251x_spi_trans(spi, 4);
}
+static void mcp251x_write_rts(struct spi_device *spi, int tx_buf_idx)
+{
+ struct mcp251x_priv *priv = dev_get_drvdata(&spi->dev);
+
+ priv->spi_tx_buf[0] = INSTRUCTION_RTS(tx_buf_idx);
+
+ mcp251x_spi_trans(spi, 1);
+}
+
static void mcp251x_hw_tx_frame(struct spi_device *spi, u8 *buf,
int len, int tx_buf_idx)
{
@@ -418,7 +428,7 @@
buf[TXBDLC_OFF] = (rtr << DLC_RTR_SHIFT) | frame->can_dlc;
memcpy(buf + TXBDAT_OFF, frame->data, frame->can_dlc);
mcp251x_hw_tx_frame(spi, buf, frame->can_dlc, tx_buf_idx);
- mcp251x_write_reg(spi, TXBCTRL(tx_buf_idx), TXBCTRL_TXREQ);
+ mcp251x_write_rts(spi, tx_buf_idx);
}
static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf,
[-- Attachment #3: Type: text/plain, Size: 188 bytes --]
_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core
^ permalink raw reply
* Re: [RFC 1/7] netdev: add standardized irq naming function
From: Michał Mirosław @ 2011-06-21 17:30 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: davem, netdev
In-Reply-To: <20110621170658.395370414@vyatta.com>
2011/6/21 Stephen Hemminger <shemminger@vyatta.com>:
> To force driver developers to use a standard convention for naming
> network device IRQ's, provide a standardized method for creating
> the name.
Can this be modified to track netdev renames?
Best Regards,
Michał Mirosław
^ permalink raw reply
* RE: [RFC 2/2] ethtool: Add support for DMA Coalescing feature config to ethtool.
From: Ben Hutchings @ 2011-06-21 17:38 UTC (permalink / raw)
To: Wyborny, Carolyn; +Cc: David Miller, netdev@vger.kernel.org
In-Reply-To: <EDC0E76513226749BFBC9C3FB031318F016F501D8D@orsmsx508.amr.corp.intel.com>
On Tue, 2011-06-21 at 10:23 -0700, Wyborny, Carolyn wrote:
>
> >-----Original Message-----
> >From: David Miller [mailto:davem@davemloft.net]
> >Sent: Friday, June 17, 2011 11:54 AM
> >To: Wyborny, Carolyn
> >Cc: netdev@vger.kernel.org; bhutchings@solarflare.com
> >Subject: Re: [RFC 2/2] ethtool: Add support for DMA Coalescing feature
> >config to ethtool.
> >
> >From: "Wyborny, Carolyn" <carolyn.wyborny@intel.com>
> >Date: Fri, 17 Jun 2011 08:50:11 -0700
> >
> >> I will add a fuller description of the feature in my updated patch.
> >> I thought the feature was more well known. Quick description is that
> >> it's a power saving feature that causes the adapter to coalesce its
> >> DMA writes at low traffic times to save power on the platform by
> >> reducing wakeups. The parameter is intended as a simple u32 value,
> >> not just an on or off, but also to allow a variety of configuration
> >> by adapter vendors, with validation of the input on the driver side.
> >> Since I left out the implementation in my patch, this wasn't clear.
> >> I will also fix this in my next submission.
> >
> >The value cannot have adapter specific meaning, you must define it
> >precisely and in a generic manner, such that the user can specify the
> >same setting across different card types.
>
> Ok, good point. I will refine the definition of the parameter in the
> next submission, once the dust clears on the major revisions in
> progress.
You may wish to propose a new command structure that covers both IRQ and
DMA moderation. They seem to be related, since DMA cannot be delayed
longer than the corresponding IRQ. We are currently lacking a way to
specify different IRQ moderation for multiqueue devices where the queues
are not all used in the same way.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [net-next PATCH v2 1/7] dcb: Add DCBX capabilities bitmask to the get_ieee response
From: John Fastabend @ 2011-06-21 17:34 UTC (permalink / raw)
To: davem; +Cc: netdev, shmulikr
Adding the capabilities bitmask to the get_ieee response allows
user space to determine the current DCBX mode. Either CEE or IEEE
this is useful with devices that support switching between modes
where knowing the current state is relevant.
Derived from work by Mark Rustad
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
net/dcb/dcbnl.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ed1bb8c..3a6d97d 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1288,6 +1288,7 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
struct nlattr *ieee, *app;
struct dcb_app_type *itr;
const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
+ int dcbx;
int err;
if (!ops)
@@ -1338,6 +1339,12 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
}
}
}
+
+ if (netdev->dcbnl_ops->getdcbx)
+ dcbx = netdev->dcbnl_ops->getdcbx(netdev);
+ else
+ dcbx = -EOPNOTSUPP;
+
spin_unlock(&dcb_lock);
nla_nest_end(skb, app);
@@ -1366,6 +1373,11 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
}
nla_nest_end(skb, ieee);
+ if (dcbx >= 0) {
+ err = nla_put_u8(skb, DCB_ATTR_DCBX, dcbx);
+ if (err)
+ goto nla_put_failure;
+ }
nlmsg_end(skb, nlh);
return rtnl_unicast(skb, &init_net, pid);
^ permalink raw reply related
* [net-next PATCH v2 2/7] net: dcbnl, add multicast group for DCB
From: John Fastabend @ 2011-06-21 17:34 UTC (permalink / raw)
To: davem; +Cc: netdev, shmulikr
In-Reply-To: <20110621173431.2777.39482.stgit@jf-dev1-dcblab>
Now that dcbnl is being used in many cases by more
than a single agent it is beneficial to be notified
when some entity either driver or user space has
changed the DCB attributes.
Today applications either end up polling the interface
or relying on a user space database to maintain the DCB
state and post events. Polling is a poor solution for
obvious reasons. And relying on a user space database
has its own downside. Namely it has created strange
boot dependencies requiring the database be populated
before any applications dependent on DCB attributes
starts or the application goes into a polling loop.
Populating the database requires negotiating link
setting with the peer and can take anywhere from less
than a second up to a few seconds depending on the switch
implementation.
Perhaps more importantly if another application or an
embedded agent sets a DCB link attribute the database
has no way of knowing other than polling the kernel.
This prevents applications from responding quickly to
changes in link events which at least in the FCoE case
and probably any other protocols expecting a lossless
link may result in IO errors.
By adding a multicast group for DCB we have clean way
to disseminate kernel DCB link attributes up to user
space. Avoiding the need for user space to maintain
a coherant database and disperse events that potentially
do not reflect the current link state.
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
include/linux/rtnetlink.h | 2
include/net/dcbnl.h | 2
net/dcb/dcbnl.c | 229 +++++++++++++++++++++++++++++----------------
3 files changed, 150 insertions(+), 83 deletions(-)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index bbad657..c81226a 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -585,6 +585,8 @@ enum rtnetlink_groups {
#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR
RTNLGRP_PHONET_ROUTE,
#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
+ RTNLGRP_DCB,
+#define RTNLGRP_DCB RTNLGRP_DCB
__RTNLGRP_MAX
};
#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index e5983c9..b3cf10d 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -31,6 +31,8 @@ struct dcb_app_type {
u8 dcb_setapp(struct net_device *, struct dcb_app *);
u8 dcb_getapp(struct net_device *, struct dcb_app *);
+int dcbnl_notify(struct net_device *dev, int event, int cmd, u32 seq, u32 pid);
+
/*
* Ops struct for the netlink callbacks. Used by DCB-enabled drivers through
* the netdevice struct.
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 3a6d97d..ffba326 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1166,64 +1166,6 @@ err:
return ret;
}
-/* Handle IEEE 802.1Qaz SET commands. If any requested operation can not
- * be completed the entire msg is aborted and error value is returned.
- * No attempt is made to reconcile the case where only part of the
- * cmd can be completed.
- */
-static int dcbnl_ieee_set(struct net_device *netdev, struct nlattr **tb,
- u32 pid, u32 seq, u16 flags)
-{
- const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
- struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1];
- int err = -EOPNOTSUPP;
-
- if (!ops)
- goto err;
-
- err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX,
- tb[DCB_ATTR_IEEE], dcbnl_ieee_policy);
- if (err)
- goto err;
-
- if (ieee[DCB_ATTR_IEEE_ETS] && ops->ieee_setets) {
- struct ieee_ets *ets = nla_data(ieee[DCB_ATTR_IEEE_ETS]);
- err = ops->ieee_setets(netdev, ets);
- if (err)
- goto err;
- }
-
- if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setpfc) {
- struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]);
- err = ops->ieee_setpfc(netdev, pfc);
- if (err)
- goto err;
- }
-
- if (ieee[DCB_ATTR_IEEE_APP_TABLE]) {
- struct nlattr *attr;
- int rem;
-
- nla_for_each_nested(attr, ieee[DCB_ATTR_IEEE_APP_TABLE], rem) {
- struct dcb_app *app_data;
- if (nla_type(attr) != DCB_ATTR_IEEE_APP)
- continue;
- app_data = nla_data(attr);
- if (ops->ieee_setapp)
- err = ops->ieee_setapp(netdev, app_data);
- else
- err = dcb_setapp(netdev, app_data);
- if (err)
- goto err;
- }
- }
-
-err:
- dcbnl_reply(err, RTM_SETDCB, DCB_CMD_IEEE_SET, DCB_ATTR_IEEE,
- pid, seq, flags);
- return err;
-}
-
static int dcbnl_build_peer_app(struct net_device *netdev, struct sk_buff* skb,
int app_nested_type, int app_info_type,
int app_entry_type)
@@ -1279,30 +1221,13 @@ nla_put_failure:
}
/* Handle IEEE 802.1Qaz GET commands. */
-static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
- u32 pid, u32 seq, u16 flags)
+static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
{
- struct sk_buff *skb;
- struct nlmsghdr *nlh;
- struct dcbmsg *dcb;
struct nlattr *ieee, *app;
struct dcb_app_type *itr;
const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
int dcbx;
- int err;
-
- if (!ops)
- return -EOPNOTSUPP;
-
- skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
- if (!skb)
- return -ENOBUFS;
-
- nlh = NLMSG_NEW(skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
-
- dcb = NLMSG_DATA(nlh);
- dcb->dcb_family = AF_UNSPEC;
- dcb->cmd = DCB_CMD_IEEE_GET;
+ int err = -EMSGSIZE;
NLA_PUT_STRING(skb, DCB_ATTR_IFNAME, netdev->name);
@@ -1378,16 +1303,154 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
if (err)
goto nla_put_failure;
}
- nlmsg_end(skb, nlh);
- return rtnl_unicast(skb, &init_net, pid);
+ return 0;
+
nla_put_failure:
- nlmsg_cancel(skb, nlh);
-nlmsg_failure:
- kfree_skb(skb);
- return -1;
+ return err;
}
+int dcbnl_notify(struct net_device *dev, int event, int cmd,
+ u32 seq, u32 pid)
+{
+ struct net *net = dev_net(dev);
+ struct sk_buff *skb;
+ struct nlmsghdr *nlh;
+ struct dcbmsg *dcb;
+ const struct dcbnl_rtnl_ops *ops = dev->dcbnl_ops;
+ int err;
+
+ if (!ops)
+ return -EOPNOTSUPP;
+
+ skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!skb)
+ return -ENOBUFS;
+
+ nlh = nlmsg_put(skb, pid, 0, event, sizeof(*dcb), 0);
+ if (nlh == NULL) {
+ kfree(skb);
+ return -EMSGSIZE;
+ }
+
+ dcb = NLMSG_DATA(nlh);
+ dcb->dcb_family = AF_UNSPEC;
+ dcb->cmd = cmd;
+
+ err = dcbnl_ieee_fill(skb, dev);
+ if (err < 0) {
+ /* Report error to broadcast listeners */
+ nlmsg_cancel(skb, nlh);
+ kfree_skb(skb);
+ rtnl_set_sk_err(net, RTNLGRP_DCB, err);
+ } else {
+ /* End nlmsg and notify broadcast listeners */
+ nlmsg_end(skb, nlh);
+ rtnl_notify(skb, net, 0, RTNLGRP_DCB, NULL, GFP_KERNEL);
+ }
+
+ return err;
+}
+EXPORT_SYMBOL(dcbnl_notify);
+
+/* Handle IEEE 802.1Qaz SET commands. If any requested operation can not
+ * be completed the entire msg is aborted and error value is returned.
+ * No attempt is made to reconcile the case where only part of the
+ * cmd can be completed.
+ */
+static int dcbnl_ieee_set(struct net_device *netdev, struct nlattr **tb,
+ u32 pid, u32 seq, u16 flags)
+{
+ const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
+ struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1];
+ int err = -EOPNOTSUPP;
+
+ if (!ops)
+ return err;
+
+ err = nla_parse_nested(ieee, DCB_ATTR_IEEE_MAX,
+ tb[DCB_ATTR_IEEE], dcbnl_ieee_policy);
+ if (err)
+ return err;
+
+ if (ieee[DCB_ATTR_IEEE_ETS] && ops->ieee_setets) {
+ struct ieee_ets *ets = nla_data(ieee[DCB_ATTR_IEEE_ETS]);
+ err = ops->ieee_setets(netdev, ets);
+ if (err)
+ goto err;
+ }
+
+ if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setpfc) {
+ struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]);
+ err = ops->ieee_setpfc(netdev, pfc);
+ if (err)
+ goto err;
+ }
+
+ if (ieee[DCB_ATTR_IEEE_APP_TABLE]) {
+ struct nlattr *attr;
+ int rem;
+
+ nla_for_each_nested(attr, ieee[DCB_ATTR_IEEE_APP_TABLE], rem) {
+ struct dcb_app *app_data;
+ if (nla_type(attr) != DCB_ATTR_IEEE_APP)
+ continue;
+ app_data = nla_data(attr);
+ if (ops->ieee_setapp)
+ err = ops->ieee_setapp(netdev, app_data);
+ else
+ err = dcb_setapp(netdev, app_data);
+ if (err)
+ goto err;
+ }
+ }
+
+err:
+ dcbnl_reply(err, RTM_SETDCB, DCB_CMD_IEEE_SET, DCB_ATTR_IEEE,
+ pid, seq, flags);
+ dcbnl_notify(netdev, RTM_SETDCB, DCB_CMD_IEEE_SET, seq, 0);
+ return err;
+}
+
+static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
+ u32 pid, u32 seq, u16 flags)
+{
+ struct net *net = dev_net(netdev);
+ struct sk_buff *skb;
+ struct nlmsghdr *nlh;
+ struct dcbmsg *dcb;
+ const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
+ int err;
+
+ if (!ops)
+ return -EOPNOTSUPP;
+
+ skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+ if (!skb)
+ return -ENOBUFS;
+
+ nlh = nlmsg_put(skb, pid, seq, RTM_GETDCB, sizeof(*dcb), flags);
+ if (nlh == NULL) {
+ kfree(skb);
+ return -EMSGSIZE;
+ }
+
+ dcb = NLMSG_DATA(nlh);
+ dcb->dcb_family = AF_UNSPEC;
+ dcb->cmd = DCB_CMD_IEEE_GET;
+
+ err = dcbnl_ieee_fill(skb, netdev);
+
+ if (err < 0) {
+ nlmsg_cancel(skb, nlh);
+ kfree_skb(skb);
+ } else {
+ nlmsg_end(skb, nlh);
+ err = rtnl_unicast(skb, net, pid);
+ }
+
+ return err;
+}
/* DCBX configuration */
static int dcbnl_getdcbx(struct net_device *netdev, struct nlattr **tb,
u32 pid, u32 seq, u16 flags)
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox