* Re: [PATCH 8/9] myri10ge: update version
From: David Miller @ 2011-06-29 13:04 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <1309187108-12715-8-git-send-email-mason@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 10:05:07 -0500
> Update version and copyright
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH 7/9 v2] myri10ge: misc style cleanups
From: David Miller @ 2011-06-29 13:03 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <20110627205640.GB18978@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 15:56:41 -0500
> Miscellaneous white space, style, and other cleanups
>
> v2 includes corrections from Joe Perches
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH 6/9] myri10ge: remove unnecessary read of PCI_CAP_ID_EXP
From: David Miller @ 2011-06-29 13:03 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <1309187108-12715-6-git-send-email-mason@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 10:05:05 -0500
> The PCIE capability offset is saved during PCI bus walking. It will
> remove an unnecessary search in the PCI configuration space if this
> value is referenced instead of reacquiring it.
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH 5/9] myri10ge: add support for set_phys_id
From: David Miller @ 2011-06-29 13:03 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <1309187108-12715-5-git-send-email-mason@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 10:05:04 -0500
> Add myri10ge driver support for the ethtool identify operation.
> NOTE: Rather than blinking (which is the normal case), when identify is
> used, the yellow LED turns solid.
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH 4/9] myri10ge: allow small_bytes = 0
From: David Miller @ 2011-06-29 13:03 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <1309187108-12715-4-git-send-email-mason@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 10:05:03 -0500
> Allow page-based receive to work when small_bytes is set to 0.
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH 3/9 v3] myri10ge: rework parity error check and cleanup
From: David Miller @ 2011-06-29 13:02 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <20110628035727.GA23979@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 22:57:28 -0500
> Clean up watchdog reset code:
> - move code that checks for stuck slice to a common routine
> - unless there is a confirmed h/w fault, verify that a stuck
> slice is still stuck in the watchdog worker; if the slice is no
> longer stuck, abort the reset.
> - this removes an egregious 2000ms pause in the watchdog worker that
> was a diagnostic aid (to look for spurious resets) the snuck into
> production code.
>
> v3 includes corrections from Joe Perches
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH 2/9] myri10ge: Mask PCI Surprise Link Down Events
From: David Miller @ 2011-06-29 13:02 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <1309187108-12715-2-git-send-email-mason@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 10:05:01 -0500
> A SRAM parity error can cause a surprise link down. Since We can
> recover from SRAM parity errors, mask PCI surprise down events.
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH 1/9] myri10ge: ensure tx queues remain stopped
From: David Miller @ 2011-06-29 13:02 UTC (permalink / raw)
To: mason; +Cc: netdev, gallatin
In-Reply-To: <1309187108-12715-1-git-send-email-mason@myri.com>
From: Jon Mason <mason@myri.com>
Date: Mon, 27 Jun 2011 10:05:00 -0500
> Ensure that our tx queues remain stopped when we stop them in
> myri10ge_close(). Not doing so can potentially lead to traffic being
> transmitted when the interface is removed, which can lead to NULL
> pointer dereferences.
>
> Signed-off-by: Jon Mason <mason@myri.com>
Applied.
^ permalink raw reply
* Re: [PATCH] net/can: activate bit-timing calculation and netlink based drivers by default
From: David Miller @ 2011-06-29 12:58 UTC (permalink / raw)
To: mkl; +Cc: socketcan-users, wg, netdev
In-Reply-To: <1309160391-22486-1-git-send-email-mkl@pengutronix.de>
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Mon, 27 Jun 2011 09:39:51 +0200
> The two options "CAN bit-timing calculation" and
> "Platform CAN drivers with Netlink support" have a "default Y". In order to
> activate them by default, change to "default y".
>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Applied.
^ permalink raw reply
* Re: [PATCH]rionet: fix NULL pointer dereference in rionet_remove
From: David Miller @ 2011-06-29 12:57 UTC (permalink / raw)
To: synmyth; +Cc: netdev, mporter, jj, cmdkhh
In-Reply-To: <4e098bf5.87f62a0a.4c71.571a@mx.google.com>
From: Yinglin Luan <synmyth@gmail.com>
Date: Sun, 26 Jun 2011 12:12:12 +0800
> Function rionet_remove initializes local variable 'ndev' to NULL
> and do nothing changes before the call to unregister_netdev(ndev),
> this could cause a NULL pointer dereference.
>
> Reported-by: Jesper Juhl <jj@chaosbits.net>
> Signed-off-by: Yinglin Luan <synmyth@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH V3 1/1] DSA: Enable cascading in multi-chip 6131 configuration
From: David Miller @ 2011-06-29 12:54 UTC (permalink / raw)
To: barry; +Cc: netdev, buytenh
In-Reply-To: <1308981231-2561-1-git-send-email-barry@grussling.com>
From: Barry Grussling <barry@grussling.com>
Date: Fri, 24 Jun 2011 22:53:51 -0700
> From: Barry Grussling <barry@grussling.com>
>
> This patch enables the 6131 family of chips to forward DSA
> packets to other switch chips. This is needed if multiple
> DSA chips are used in a device. Without this patch the
> chip will drop any DSA packets not destined for it.
>
> This patch only enables the forwarding of DSA packets if
> multiple chips are used in the switch configuration.
>
> Signed-off-by: Barry Grussling <barry@grussling.com>
Applied.
^ permalink raw reply
* Re: [PATCH] caif: Fix recieve/receive typo
From: David Miller @ 2011-06-29 12:52 UTC (permalink / raw)
To: joe; +Cc: sjur.brandeland, netdev, linux-kernel
In-Reply-To: <661bd38a1d84b746ad6879baf83b3a98c93676e6.1308938176.git.joe@perches.com>
From: Joe Perches <joe@perches.com>
Date: Fri, 24 Jun 2011 10:59:19 -0700
> Just spelling fixes.
>
> Actually, a twofer with vaiables/variables as well.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Applied.
^ permalink raw reply
* [PATCH net-next] net: de4x5: Omit check for multicast bit in netdev_for_each_mc_addr
From: Tobias Klauser @ 2011-06-29 12:16 UTC (permalink / raw)
To: David S. Miller, Grant Grundler; +Cc: netdev
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/tulip/de4x5.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index efaa1d6..0c3151a 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -1954,7 +1954,6 @@ SetMulticastFilter(struct net_device *dev)
u16 hashcode;
u32 omr, crc;
char *pa;
- unsigned char *addrs;
omr = inl(DE4X5_OMR);
omr &= ~(OMR_PR | OMR_PM);
@@ -1964,9 +1963,7 @@ SetMulticastFilter(struct net_device *dev)
omr |= OMR_PM; /* Pass all multicasts */
} else if (lp->setup_f == HASH_PERF) { /* Hash Filtering */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
- if ((*addrs & 0x01) == 1) { /* multicast address? */
- crc = ether_crc_le(ETH_ALEN, addrs);
+ crc = ether_crc_le(ETH_ALEN, ha->addr);
hashcode = crc & HASH_BITS; /* hashcode is 9 LSb of CRC */
byte = hashcode >> 3; /* bit[3-8] -> byte in filter */
@@ -1977,7 +1974,6 @@ SetMulticastFilter(struct net_device *dev)
byte -= 1;
}
lp->setup_frame[byte] |= bit;
- }
}
} else { /* Perfect filtering */
netdev_for_each_mc_addr(ha, dev) {
--
1.7.5.4
^ permalink raw reply related
* [PATCH net-next] net: ucc_geth: Omit check for multicast bit in netdev_for_each_mc_addr
From: Tobias Klauser @ 2011-06-29 12:16 UTC (permalink / raw)
To: David S. Miller, Li Yang; +Cc: netdev, linuxppc-dev
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/ucc_geth.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 3127700..d3465ab 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2030,11 +2030,6 @@ static void ucc_geth_set_multi(struct net_device *dev)
out_be32(&p_82xx_addr_filt->gaddr_l, 0x0);
netdev_for_each_mc_addr(ha, dev) {
- /* Only support group multicast for now.
- */
- if (!is_multicast_ether_addr(ha->addr))
- continue;
-
/* Ask CPM to run CRC and set bit in
* filter mask.
*/
--
1.7.5.4
^ permalink raw reply related
* [PATCH net-next] net: depca: Omit check for multicast bit in netdev_for_each_mc_addr
From: Tobias Klauser @ 2011-06-29 12:15 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/depca.c | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/net/depca.c b/drivers/net/depca.c
index d54a0e9..a7ccaa6 100644
--- a/drivers/net/depca.c
+++ b/drivers/net/depca.c
@@ -1270,7 +1270,6 @@ static void SetMulticastFilter(struct net_device *dev)
{
struct depca_private *lp = netdev_priv(dev);
struct netdev_hw_addr *ha;
- char *addrs;
int i, j, bit, byte;
u16 hashcode;
u32 crc;
@@ -1285,19 +1284,15 @@ static void SetMulticastFilter(struct net_device *dev)
}
/* Add multicast addresses */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
- if ((*addrs & 0x01) == 1) { /* multicast address? */
- crc = ether_crc(ETH_ALEN, addrs);
- hashcode = (crc & 1); /* hashcode is 6 LSb of CRC ... */
- for (j = 0; j < 5; j++) { /* ... in reverse order. */
- hashcode = (hashcode << 1) | ((crc >>= 1) & 1);
- }
-
-
- byte = hashcode >> 3; /* bit[3-5] -> byte in filter */
- bit = 1 << (hashcode & 0x07); /* bit[0-2] -> bit in byte */
- lp->init_block.mcast_table[byte] |= bit;
+ crc = ether_crc(ETH_ALEN, ha->addr);
+ hashcode = (crc & 1); /* hashcode is 6 LSb of CRC ... */
+ for (j = 0; j < 5; j++) { /* ... in reverse order. */
+ hashcode = (hashcode << 1) | ((crc >>= 1) & 1);
}
+
+ byte = hashcode >> 3; /* bit[3-5] -> byte in filter */
+ bit = 1 << (hashcode & 0x07); /* bit[0-2] -> bit in byte */
+ lp->init_block.mcast_table[byte] |= bit;
}
}
}
--
1.7.5.4
^ permalink raw reply related
* [PATCH net-next] net: iseries_veth: Omit check for multicast bit in netdev_for_each_mc_addr
From: Tobias Klauser @ 2011-06-29 12:15 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/iseries_veth.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index b6c296f..242bf52 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -964,11 +964,9 @@ static void veth_set_multicast_list(struct net_device *dev)
u8 *addr = ha->addr;
u64 xaddr = 0;
- if (addr[0] & 0x01) {/* multicast address? */
- memcpy(&xaddr, addr, ETH_ALEN);
- port->mcast_addr[port->num_mcast] = xaddr;
- port->num_mcast++;
- }
+ memcpy(&xaddr, addr, ETH_ALEN);
+ port->mcast_addr[port->num_mcast] = xaddr;
+ port->num_mcast++;
}
}
--
1.7.5.4
^ permalink raw reply related
* RE: [PATCH RFC] r8169: minimal rtl8111e-vl support
From: hayeswang @ 2011-06-29 12:18 UTC (permalink / raw)
To: 'Francois Romieu'; +Cc: netdev
In-Reply-To: <20110628214410.GA4163@electric-eye.fr.zoreil.com>
Hi,
The driver of Realtek includes testing chips which are used internally and don't
need be supported.
I plan to start implementing the new chips next week. Maybe you could continue
after that time if you don't mind.
Best Regards,
Hayes
-----Original Message-----
From: Francois Romieu [mailto:romieu@fr.zoreil.com]
Sent: Wednesday, June 29, 2011 5:44 AM
To: Hayeswang
Cc: netdev@vger.kernel.org
Subject: [PATCH RFC] r8169: minimal rtl8111e-vl support
Mostly bits from version 8.023.00 of Realtek's own r8168 driver. It applies on
top of davem's net-next branch + a small, uninteresting attached patch.
I have given it a short testing w/o the new-format rtl8168e-3_0.0.1 firmware and
it is fairly encouraging.
The code is still incomplete :
- WoL needs some care. No difficulty here.
- rtl8168e_2_hw_phy_config imho deserves a few comments similar to those in
rtl8168e_1_hw_phy_config. Hayes, can you take care of it ?
- I have excluded a set of completely unidentified registers / bits
operations, for instance:
- Config5
BIT_0
- Config2
BIT_5
BIT_7
- TxConfig
BIT_7
- 0x1a
BIT_2
BIT_3
- 0x1b
0xf8 / 0x07
- 0xb0,
0xee480010
- 0xd0
BIT_6
- 0xd3
BIT_7
- 0xf2
BIT_6
Either they are not needed or someone will have to name them adequately.
Hayes ?
- Short packets apparently need to be checksummed by the driver (?) but
the work-around seems strange. It is not clear to me what Realtek's
driver is trying to achieve in hard_start_xmit. Hayes, can you elaborate ?
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
^ permalink raw reply
* [PATCH net-next] net: am79c961a: Omit check for multicast bit in netdev_for_each_mc_addr
From: Tobias Klauser @ 2011-06-29 12:14 UTC (permalink / raw)
To: Russell King, David S. Miller; +Cc: netdev, linux-arm-kernel
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/arm/am79c961a.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 7b3e23f..52fe21e 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -199,17 +199,15 @@ am79c961_ramtest(struct net_device *dev, unsigned int val)
static void am79c961_mc_hash(char *addr, u16 *hash)
{
- if (addr[0] & 0x01) {
- int idx, bit;
- u32 crc;
+ int idx, bit;
+ u32 crc;
- crc = ether_crc_le(ETH_ALEN, addr);
+ crc = ether_crc_le(ETH_ALEN, addr);
- idx = crc >> 30;
- bit = (crc >> 26) & 15;
+ idx = crc >> 30;
+ bit = (crc >> 26) & 15;
- hash[idx] |= 1 << bit;
- }
+ hash[idx] |= 1 << bit;
}
static unsigned int am79c961_get_rx_mode(struct net_device *dev, u16 *hash)
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH] net/core: Convert to current logging forms
From: David Miller @ 2011-06-29 11:55 UTC (permalink / raw)
To: nhorman; +Cc: joe, netdev, linux-kernel
In-Reply-To: <20110629111109.GA1613@hmsreliant.think-freely.org>
Neil, please do not quote a entire large patch just to comment on one
or two hunks of it. Just quote the patch hunks you want to provide
feedback on.
What you're doing makes it completely unmanageable when I review the
feedback a patch gets, both in my mailbox and in patchwork.
Thanks.
^ permalink raw reply
* Re: [RFC v2 2/2] e100: Support RXFCS feature flag.
From: Michał Mirosław @ 2011-06-29 11:37 UTC (permalink / raw)
To: greearb; +Cc: netdev
In-Reply-To: <1308942371-12748-3-git-send-email-greearb@candelatech.com>
2011/6/24 <greearb@candelatech.com>:
> From: Ben Greear <greearb@candelatech.com>
>
> This allows e100 to be configured to append the
> Ethernet FCS to the skb.
>
> Useful for sniffing networks.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
> :100644 100644 c1352c6... 761f6f5... M drivers/net/e100.c
> drivers/net/e100.c | 15 ++++++++++++---
> 1 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/e100.c b/drivers/net/e100.c
> index c1352c6..761f6f5 100644
> --- a/drivers/net/e100.c
> +++ b/drivers/net/e100.c
> @@ -1089,6 +1089,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
> {
> struct config *config = &cb->u.config;
> u8 *c = (u8 *)config;
> + struct net_device *netdev = nic->netdev;
>
> cb->command = cpu_to_le16(cb_config);
>
> @@ -1132,6 +1133,9 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
> config->promiscuous_mode = 0x1; /* 1=on, 0=off */
> }
>
> + if (netdev->wanted_features & NETIF_F_RXFCS)
> + config->rx_crc_transfer = 0x1; /* 1=save, 0=discard */
> +
You should check netdev->features here.
> if (nic->flags & multicast_all)
> config->multicast_all = 0x1; /* 1=accept, 0=no */
>
> @@ -1919,6 +1923,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
> struct sk_buff *skb = rx->skb;
> struct rfd *rfd = (struct rfd *)skb->data;
> u16 rfd_status, actual_size;
> + u16 fcs_pad = 0;
>
> if (unlikely(work_done && *work_done >= work_to_do))
> return -EAGAIN;
> @@ -1951,9 +1956,11 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
> }
>
> /* Get actual data size */
> + if (dev->wanted_features & NETIF_F_RXFCS)
> + fcs_pad = 4;
Same here.
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: [PATCH] net/core: Convert to current logging forms
From: Neil Horman @ 2011-06-29 11:11 UTC (permalink / raw)
To: Joe Perches; +Cc: netdev, David S. Miller, linux-kernel
In-Reply-To: <385ebf7e98e377e6e6c384beb961b65d4a95fb18.1309289792.git.joe@perches.com>
On Tue, Jun 28, 2011 at 12:40:10PM -0700, Joe Perches wrote:
> Use pr_fmt, pr_<level>, and netdev_<level> as appropriate.
>
> Coalesce long formats.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> net/core/dev.c | 121 +++++++++++++++++++---------------------------
> net/core/drop_monitor.c | 10 ++--
> net/core/neighbour.c | 15 +++---
> net/core/net_namespace.c | 6 ++-
> net/core/netpoll.c | 60 +++++++++++-----------
> net/core/pktgen.c | 27 +++++-----
> net/core/rtnetlink.c | 9 ++--
> net/core/skbuff.c | 24 ++++------
> net/core/sock.c | 21 ++++----
> 9 files changed, 136 insertions(+), 157 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 6b6ef14..3401227 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -72,6 +72,8 @@
> * - netif_rx() feedback
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <asm/uaccess.h>
> #include <asm/system.h>
> #include <linux/bitops.h>
> @@ -433,7 +435,7 @@ void __dev_remove_pack(struct packet_type *pt)
> }
> }
>
> - printk(KERN_WARNING "dev_remove_pack: %p not found.\n", pt);
> + pr_warn("dev_remove_pack: %p not found\n", pt);
> out:
> spin_unlock(&ptype_lock);
> }
> @@ -1026,9 +1028,8 @@ rollback:
> memcpy(dev->name, oldname, IFNAMSIZ);
> goto rollback;
> } else {
> - printk(KERN_ERR
> - "%s: name change rollback failed: %d.\n",
> - dev->name, ret);
> + netdev_err(dev, "name change rollback failed: %d\n",
> + ret);
> }
> }
>
> @@ -1126,9 +1127,10 @@ void dev_load(struct net *net, const char *name)
> no_module = request_module("netdev-%s", name);
> if (no_module && capable(CAP_SYS_MODULE)) {
> if (!request_module("%s", name))
> - pr_err("Loading kernel module for a network device "
> -"with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s "
> -"instead\n", name);
> + pr_err(
> +"Loading kernel module for a network device with CAP_SYS_MODULE (deprecated)\n"
> +"Use CAP_NET_ADMIN and alias netdev-%s instead\n",
> + name);
> }
> }
> EXPORT_SYMBOL(dev_load);
> @@ -1569,10 +1571,8 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
> if (skb_network_header(skb2) < skb2->data ||
> skb2->network_header > skb2->tail) {
> if (net_ratelimit())
> - printk(KERN_CRIT "protocol %04x is "
> - "buggy, dev %s\n",
> - ntohs(skb2->protocol),
> - dev->name);
> + netdev_crit(dev, "protocol %04x is buggy\n",
> + ntohs(skb2->protocol));
> skb_reset_network_header(skb2);
> }
>
> @@ -1605,9 +1605,7 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq)
>
> /* If TC0 is invalidated disable TC mapping */
> if (tc->offset + tc->count > txq) {
> - pr_warning("Number of in use tx queues changed "
> - "invalidating tc mappings. Priority "
> - "traffic classification disabled!\n");
> + netdev_warn(dev, "Number of in use tx queues changed invalidating tc mappings. Priority traffic classification disabled!\n");
> dev->num_tc = 0;
> return;
> }
> @@ -1618,11 +1616,8 @@ static void netif_setup_tc(struct net_device *dev, unsigned int txq)
>
> tc = &dev->tc_to_txq[q];
> if (tc->offset + tc->count > txq) {
> - pr_warning("Number of in use tx queues "
> - "changed. Priority %i to tc "
> - "mapping %i is no longer valid "
> - "setting map to 0\n",
> - i, q);
> + netdev_warn(dev, "Number of in use tx queues changed. Priority %i to tc mapping %i is no longer valid. Setting map to 0.\n",
> + i, q);
> netdev_set_prio_tc_map(dev, i, 0);
> }
> }
> @@ -1919,8 +1914,7 @@ EXPORT_SYMBOL(skb_gso_segment);
> void netdev_rx_csum_fault(struct net_device *dev)
> {
> if (net_ratelimit()) {
> - printk(KERN_ERR "%s: hw csum failure.\n",
> - dev ? dev->name : "<unknown>");
> + netdev_err(dev, "hw csum failure\n");
> dump_stack();
> }
> }
> @@ -2233,9 +2227,8 @@ static inline u16 dev_cap_txqueue(struct net_device *dev, u16 queue_index)
> {
> if (unlikely(queue_index >= dev->real_num_tx_queues)) {
> if (net_ratelimit()) {
> - pr_warning("%s selects TX queue %d, but "
> - "real number of TX queues is %d\n",
> - dev->name, queue_index, dev->real_num_tx_queues);
> + netdev_warn(dev, "selects TX queue %d, but real number of TX queues is %d\n",
> + queue_index, dev->real_num_tx_queues);
> }
> return 0;
> }
> @@ -2465,16 +2458,14 @@ int dev_queue_xmit(struct sk_buff *skb)
> }
> HARD_TX_UNLOCK(dev, txq);
> if (net_ratelimit())
> - printk(KERN_CRIT "Virtual device %s asks to "
> - "queue packet!\n", dev->name);
> + netdev_crit(dev, "Virtual device asks to queue packet!\n");
> } else {
> /* Recursion is detected! It is possible,
> * unfortunately
> */
> recursion_alert:
> if (net_ratelimit())
> - printk(KERN_CRIT "Dead loop on virtual device "
> - "%s, fix it urgently!\n", dev->name);
> + netdev_crit(dev, "Dead loop on virtual device, fix it urgently!\n");
> }
> }
>
> @@ -2996,8 +2987,8 @@ static int ing_filter(struct sk_buff *skb, struct netdev_queue *rxq)
>
> if (unlikely(MAX_RED_LOOP < ttl++)) {
> if (net_ratelimit())
> - pr_warning( "Redir loop detected Dropping packet (%d->%d)\n",
> - skb->skb_iif, dev->ifindex);
> + netdev_warn(dev, "Redir loop detected - Dropping packet (%d->%d)\n",
> + skb->skb_iif, dev->ifindex);
> return TC_ACT_SHOT;
> }
>
> @@ -4366,16 +4357,13 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
> dev->flags &= ~IFF_PROMISC;
> else {
> dev->promiscuity -= inc;
> - printk(KERN_WARNING "%s: promiscuity touches roof, "
> - "set promiscuity failed, promiscuity feature "
> - "of device might be broken.\n", dev->name);
> + netdev_warn(dev, "promiscuity touches roof, set promiscuity failed, promiscuity feature of device might be broken\n");
> return -EOVERFLOW;
> }
> }
> if (dev->flags != old_flags) {
> - printk(KERN_INFO "device %s %s promiscuous mode\n",
> - dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
> - "left");
> + netdev_info(dev, "%s promiscuous mode\n",
> + (dev->flags & IFF_PROMISC) ? "entered" : "left");
> if (audit_enabled) {
> current_uid_gid(&uid, &gid);
> audit_log(current->audit_context, GFP_ATOMIC,
> @@ -4448,9 +4436,7 @@ int dev_set_allmulti(struct net_device *dev, int inc)
> dev->flags &= ~IFF_ALLMULTI;
> else {
> dev->allmulti -= inc;
> - printk(KERN_WARNING "%s: allmulti touches roof, "
> - "set allmulti failed, allmulti feature of "
> - "device might be broken.\n", dev->name);
> + netdev_warn(dev, "allmulti touches roof, set allmulti failed, allmulti feature of device might be broken\n");
> return -EOVERFLOW;
> }
> }
> @@ -5127,8 +5113,8 @@ static void rollback_registered_many(struct list_head *head)
> * devices and proceed with the remaining.
> */
> if (dev->reg_state == NETREG_UNINITIALIZED) {
> - pr_debug("unregister_netdevice: device %s/%p never "
> - "was registered\n", dev->name, dev);
> + netdev_dbg(dev, "unregister_netdevice: (%p) device never was registered\n",
> + dev);
>
> WARN_ON(1);
> list_del(&dev->unreg_list);
> @@ -5204,27 +5190,26 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
> /* Fix illegal checksum combinations */
> if ((features & NETIF_F_HW_CSUM) &&
> (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
> - netdev_warn(dev, "mixed HW and IP checksum settings.\n");
> + netdev_warn(dev, "mixed HW and IP checksum settings\n");
> features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM);
> }
>
> if ((features & NETIF_F_NO_CSUM) &&
> (features & (NETIF_F_HW_CSUM|NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
> - netdev_warn(dev, "mixed no checksumming and other settings.\n");
> + netdev_warn(dev, "mixed no checksumming and other settings\n");
> features &= ~(NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM|NETIF_F_HW_CSUM);
> }
>
> /* Fix illegal SG+CSUM combinations. */
> if ((features & NETIF_F_SG) &&
> !(features & NETIF_F_ALL_CSUM)) {
> - netdev_dbg(dev,
> - "Dropping NETIF_F_SG since no checksum feature.\n");
> + netdev_dbg(dev, "Dropping NETIF_F_SG since no checksum feature\n");
> features &= ~NETIF_F_SG;
> }
>
> /* TSO requires that SG is present as well. */
> if ((features & NETIF_F_ALL_TSO) && !(features & NETIF_F_SG)) {
> - netdev_dbg(dev, "Dropping TSO features since no SG feature.\n");
> + netdev_dbg(dev, "Dropping TSO features since no SG feature\n");
> features &= ~NETIF_F_ALL_TSO;
> }
>
> @@ -5234,7 +5219,7 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
>
> /* Software GSO depends on SG. */
> if ((features & NETIF_F_GSO) && !(features & NETIF_F_SG)) {
> - netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature.\n");
> + netdev_dbg(dev, "Dropping NETIF_F_GSO since no SG feature\n");
> features &= ~NETIF_F_GSO;
> }
>
> @@ -5244,14 +5229,12 @@ u32 netdev_fix_features(struct net_device *dev, u32 features)
> if (!((features & NETIF_F_GEN_CSUM) ||
> (features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
> == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))) {
> - netdev_dbg(dev,
> - "Dropping NETIF_F_UFO since no checksum offload features.\n");
> + netdev_dbg(dev, "Dropping NETIF_F_UFO since no checksum offload features\n");
> features &= ~NETIF_F_UFO;
> }
>
> if (!(features & NETIF_F_SG)) {
> - netdev_dbg(dev,
> - "Dropping NETIF_F_UFO since no NETIF_F_SG feature.\n");
> + netdev_dbg(dev, "Dropping NETIF_F_UFO since no NETIF_F_SG feature\n");
> features &= ~NETIF_F_UFO;
> }
> }
> @@ -5279,15 +5262,14 @@ int __netdev_update_features(struct net_device *dev)
> return 0;
>
> netdev_dbg(dev, "Features changed: 0x%08x -> 0x%08x\n",
> - dev->features, features);
> + dev->features, features);
>
> if (dev->netdev_ops->ndo_set_features)
> err = dev->netdev_ops->ndo_set_features(dev, features);
>
> if (unlikely(err < 0)) {
> - netdev_err(dev,
> - "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
> - err, features, dev->features);
> + netdev_err(dev, "set_features() failed (%d); wanted 0x%08x, left 0x%08x\n",
> + err, features, dev->features);
> return -1;
> }
>
> @@ -5366,7 +5348,8 @@ static int netif_alloc_rx_queues(struct net_device *dev)
>
> rx = kcalloc(count, sizeof(struct netdev_rx_queue), GFP_KERNEL);
> if (!rx) {
> - pr_err("netdev: Unable to allocate %u rx queues.\n", count);
> + netdev_err(dev, "netdev: Unable to allocate %u rx queues\n",
> + count);
> return -ENOMEM;
> }
> dev->_rx = rx;
> @@ -5397,8 +5380,8 @@ static int netif_alloc_netdev_queues(struct net_device *dev)
>
> tx = kcalloc(count, sizeof(struct netdev_queue), GFP_KERNEL);
> if (!tx) {
> - pr_err("netdev: Unable to allocate %u tx queues.\n",
> - count);
> + netdev_err(dev, "netdev: Unable to allocate %u tx queues\n",
> + count);
> return -ENOMEM;
> }
Don't all of these get called prior to device registration? This change will
have us printing out unregistered net device: ... rather than netdev: ... on
these errors. Not tragic, but I rather think its nicer to just say netdev:...
> dev->_tx = tx;
> @@ -5658,10 +5641,8 @@ static void netdev_wait_allrefs(struct net_device *dev)
> refcnt = netdev_refcnt_read(dev);
>
> if (time_after(jiffies, warning_time + 10 * HZ)) {
> - printk(KERN_EMERG "unregister_netdevice: "
> - "waiting for %s to become free. Usage "
> - "count = %d\n",
> - dev->name, refcnt);
> + netdev_emerg(dev, "unregister_netdevice: waiting to become free. Usage count = %d\n",
> + refcnt);
> warning_time = jiffies;
> }
> }
> @@ -5706,8 +5687,8 @@ void netdev_run_todo(void)
> list_del(&dev->todo_list);
>
> if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
> - printk(KERN_ERR "network todo '%s' but state %d\n",
> - dev->name, dev->reg_state);
> + netdev_err(dev, "network todo but state %d\n",
> + dev->reg_state);
> dump_stack();
> continue;
> }
Ditto on the unregistered net device thing.
><snip>
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index ceb505b..adcf198 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -15,6 +15,8 @@
> * Harald Welte Add neighbour cache statistics like rtstat
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/slab.h>
> #include <linux/types.h>
> #include <linux/kernel.h>
> @@ -693,14 +695,13 @@ void neigh_destroy(struct neighbour *neigh)
> NEIGH_CACHE_STAT_INC(neigh->tbl, destroys);
>
> if (!neigh->dead) {
> - printk(KERN_WARNING
> - "Destroying alive neighbour %p\n", neigh);
> + pr_warn("Destroying alive neighbour %p\n", neigh);
> dump_stack();
> return;
> }
>
> if (neigh_del_timer(neigh))
> - printk(KERN_WARNING "Impossible event.\n");
> + pr_warn("Impossible event\n");
>
> while ((hh = neigh->hh) != NULL) {
> neigh->hh = hh->hh_next;
> @@ -882,7 +883,7 @@ static void neigh_timer_handler(unsigned long arg)
>
> if (!(state & NUD_IN_TIMER)) {
> #ifndef CONFIG_SMP
> - printk(KERN_WARNING "neigh: timer & !nud_in_timer\n");
> + pr_warn("timer & !nud_in_timer\n");
> #endif
> goto out;
> }
> @@ -1575,8 +1576,8 @@ void neigh_table_init(struct neigh_table *tbl)
> write_unlock(&neigh_tbl_lock);
>
> if (unlikely(tmp)) {
> - printk(KERN_ERR "NEIGH: Registering multiple tables for "
> - "family %d\n", tbl->family);
> + pr_err("Registering multiple tables for family %d\n",
> + tbl->family);
> dump_stack();
> }
> }
> @@ -1592,7 +1593,7 @@ int neigh_table_clear(struct neigh_table *tbl)
> pneigh_queue_purge(&tbl->proxy_queue);
> neigh_ifdown(tbl, NULL);
> if (atomic_read(&tbl->entries))
> - printk(KERN_CRIT "neighbour leakage\n");
> + pr_crit("neighbour leakage\n");
> write_lock(&neigh_tbl_lock);
> for (tp = &neigh_tables; *tp; tp = &(*tp)->next) {
> if (*tp == tbl) {
> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> index ea489db..95ac0de 100644
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -1,3 +1,5 @@
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/workqueue.h>
> #include <linux/rtnetlink.h>
> #include <linux/cache.h>
> @@ -202,8 +204,8 @@ static void net_free(struct net *net)
> {
> #ifdef NETNS_REFCNT_DEBUG
> if (unlikely(atomic_read(&net->use_count) != 0)) {
> - printk(KERN_EMERG "network namespace not free! Usage: %d\n",
> - atomic_read(&net->use_count));
> + pr_emerg("network namespace not free! Usage: %d\n",
> + atomic_read(&net->use_count));
> return;
> }
> #endif
> diff --git a/net/core/netpoll.c b/net/core/netpoll.c
> index 18d9cbd..25e9af5 100644
> --- a/net/core/netpoll.c
> +++ b/net/core/netpoll.c
> @@ -9,6 +9,8 @@
> * Copyright (C) 2002 Red Hat, Inc.
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/moduleparam.h>
> #include <linux/netdevice.h>
> #include <linux/etherdevice.h>
> @@ -629,18 +631,18 @@ out:
>
> void netpoll_print_options(struct netpoll *np)
> {
> - printk(KERN_INFO "%s: local port %d\n",
> - np->name, np->local_port);
> - printk(KERN_INFO "%s: local IP %pI4\n",
> - np->name, &np->local_ip);
> - printk(KERN_INFO "%s: interface '%s'\n",
> - np->name, np->dev_name);
> - printk(KERN_INFO "%s: remote port %d\n",
> - np->name, np->remote_port);
> - printk(KERN_INFO "%s: remote IP %pI4\n",
> - np->name, &np->remote_ip);
> - printk(KERN_INFO "%s: remote ethernet address %pM\n",
> - np->name, np->remote_mac);
> + pr_info("%s: local port %d\n",
> + np->name, np->local_port);
> + pr_info("%s: local IP %pI4\n",
> + np->name, &np->local_ip);
> + pr_info("%s: interface '%s'\n",
> + np->name, np->dev_name);
> + pr_info("%s: remote port %d\n",
> + np->name, np->remote_port);
> + pr_info("%s: remote IP %pI4\n",
> + np->name, &np->remote_ip);
> + pr_info("%s: remote ethernet address %pM\n",
> + np->name, np->remote_mac);
> }
> EXPORT_SYMBOL(netpoll_print_options);
>
> @@ -682,8 +684,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
> goto parse_failed;
> *delim = 0;
> if (*cur == ' ' || *cur == '\t')
> - printk(KERN_INFO "%s: warning: whitespace"
> - "is not allowed\n", np->name);
> + pr_info("%s: warning: whitespace is not allowed\n",
> + np->name);
> np->remote_port = simple_strtol(cur, NULL, 10);
> cur = delim;
> }
> @@ -707,8 +709,8 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
> return 0;
>
> parse_failed:
> - printk(KERN_INFO "%s: couldn't parse config at '%s'!\n",
> - np->name, cur);
> + pr_info("%s: couldn't parse config at '%s'!\n",
> + np->name, cur);
> return -1;
> }
> EXPORT_SYMBOL(netpoll_parse_options);
> @@ -723,7 +725,7 @@ int __netpoll_setup(struct netpoll *np)
>
> if ((ndev->priv_flags & IFF_DISABLE_NETPOLL) ||
> !ndev->netdev_ops->ndo_poll_controller) {
> - printk(KERN_ERR "%s: %s doesn't support polling, aborting.\n",
> + pr_err("%s: %s doesn't support polling, aborting\n",
> np->name, np->dev_name);
> err = -ENOTSUPP;
> goto out;
> @@ -787,13 +789,13 @@ int netpoll_setup(struct netpoll *np)
> if (np->dev_name)
> ndev = dev_get_by_name(&init_net, np->dev_name);
> if (!ndev) {
> - printk(KERN_ERR "%s: %s doesn't exist, aborting.\n",
> + pr_err("%s: %s doesn't exist, aborting\n",
> np->name, np->dev_name);
> return -ENODEV;
> }
>
> if (ndev->master) {
> - printk(KERN_ERR "%s: %s is a slave device, aborting.\n",
> + pr_err("%s: %s is a slave device, aborting\n",
> np->name, np->dev_name);
> err = -EBUSY;
> goto put;
> @@ -802,15 +804,15 @@ int netpoll_setup(struct netpoll *np)
> if (!netif_running(ndev)) {
> unsigned long atmost, atleast;
>
> - printk(KERN_INFO "%s: device %s not up yet, forcing it\n",
> - np->name, np->dev_name);
> + pr_info("%s: device %s not up yet, forcing it\n",
> + np->name, np->dev_name);
>
> rtnl_lock();
> err = dev_open(ndev);
> rtnl_unlock();
>
> if (err) {
> - printk(KERN_ERR "%s: failed to open %s\n",
> + pr_err("%s: failed to open %s\n",
> np->name, ndev->name);
> goto put;
> }
> @@ -819,9 +821,8 @@ int netpoll_setup(struct netpoll *np)
> atmost = jiffies + carrier_timeout * HZ;
> while (!netif_carrier_ok(ndev)) {
> if (time_after(jiffies, atmost)) {
> - printk(KERN_NOTICE
> - "%s: timeout waiting for carrier\n",
> - np->name);
> + pr_notice("%s: timeout waiting for carrier\n",
> + np->name);
> break;
> }
> msleep(1);
> @@ -833,9 +834,8 @@ int netpoll_setup(struct netpoll *np)
> */
>
> if (time_before(jiffies, atleast)) {
> - printk(KERN_NOTICE "%s: carrier detect appears"
> - " untrustworthy, waiting 4 seconds\n",
> - np->name);
> + pr_notice("%s: carrier detect appears untrustworthy, waiting 4 seconds\n",
> + np->name);
> msleep(4000);
> }
> }
> @@ -846,7 +846,7 @@ int netpoll_setup(struct netpoll *np)
>
> if (!in_dev || !in_dev->ifa_list) {
> rcu_read_unlock();
> - printk(KERN_ERR "%s: no IP address for %s, aborting\n",
> + pr_err("%s: no IP address for %s, aborting\n",
> np->name, np->dev_name);
> err = -EDESTADDRREQ;
> goto put;
> @@ -854,7 +854,7 @@ int netpoll_setup(struct netpoll *np)
>
> np->local_ip = in_dev->ifa_list->ifa_local;
> rcu_read_unlock();
> - printk(KERN_INFO "%s: local IP %pI4\n", np->name, &np->local_ip);
> + pr_info("%s: local IP %pI4\n", np->name, &np->local_ip);
> }
>
> np->dev = ndev;
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index f76079c..be6224c 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -505,7 +505,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user *buf,
> pktgen_reset_all_threads();
>
> else
> - pr_warning("Unknown command: %s\n", data);
> + pr_warn("Unknown command: %s\n", data);
>
> err = count;
>
> @@ -855,14 +855,14 @@ static ssize_t pktgen_if_write(struct file *file,
> pg_result = &(pkt_dev->result[0]);
>
> if (count < 1) {
> - pr_warning("wrong command format\n");
> + pr_warn("wrong command format\n");
> return -EINVAL;
> }
>
> max = count;
> tmp = count_trail_chars(user_buffer, max);
> if (tmp < 0) {
> - pr_warning("illegal format\n");
> + pr_warn("illegal format\n");
> return tmp;
> }
> i = tmp;
> @@ -2020,15 +2020,15 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
> ntxq = pkt_dev->odev->real_num_tx_queues;
>
> if (ntxq <= pkt_dev->queue_map_min) {
> - pr_warning("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
> - pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq,
> - pkt_dev->odevname);
> + pr_warn("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
> + pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq,
> + pkt_dev->odevname);
> pkt_dev->queue_map_min = ntxq - 1;
> }
> if (pkt_dev->queue_map_max >= ntxq) {
> - pr_warning("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
> - pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq,
> - pkt_dev->odevname);
> + pr_warn("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
> + pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq,
> + pkt_dev->odevname);
> pkt_dev->queue_map_max = ntxq - 1;
> }
>
> @@ -3159,8 +3159,7 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev)
> int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1;
>
> if (!pkt_dev->running) {
> - pr_warning("interface: %s is already stopped\n",
> - pkt_dev->odevname);
> + pr_warn("interface: %s is already stopped\n", pkt_dev->odevname);
> return -EINVAL;
> }
>
> @@ -3675,7 +3674,7 @@ static int pktgen_remove_device(struct pktgen_thread *t,
> pr_debug("remove_device pkt_dev=%p\n", pkt_dev);
>
> if (pkt_dev->running) {
> - pr_warning("WARNING: trying to remove a running interface, stopping it now\n");
> + pr_warn("WARNING: trying to remove a running interface, stopping it now\n");
> pktgen_stop_device(pkt_dev);
> }
>
> @@ -3729,8 +3728,8 @@ static int __init pg_init(void)
>
> err = pktgen_create_thread(cpu);
> if (err)
> - pr_warning("WARNING: Cannot create thread for cpu %d (%d)\n",
> - cpu, err);
> + pr_warn("WARNING: Cannot create thread for cpu %d (%d)\n",
> + cpu, err);
> }
>
> if (list_empty(&pktgen_threads)) {
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index a798fc6..53fc9f6 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -16,6 +16,8 @@
> * Vitaly E. Lavrov RTA_OK arithmetics was wrong.
> */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> #include <linux/errno.h>
> #include <linux/module.h>
> #include <linux/types.h>
> @@ -1468,10 +1470,9 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
>
> errout:
> if (err < 0 && modified && net_ratelimit())
> - printk(KERN_WARNING "A link change request failed with "
> - "some changes committed already. Interface %s may "
> - "have been left with an inconsistent configuration, "
> - "please check.\n", dev->name);
> + netdev_warn(dev,
> +"A link change request failed with some changes committed already.\n"
> +"Interface may have been left with an inconsistent configuration, please check.\n");
>
> if (send_addr_notify)
> call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 46cbd28..e67b4a4 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -120,11 +120,9 @@ static const struct pipe_buf_operations sock_pipe_buf_ops = {
> */
> static void skb_over_panic(struct sk_buff *skb, int sz, void *here)
> {
> - printk(KERN_EMERG "skb_over_panic: text:%p len:%d put:%d head:%p "
> - "data:%p tail:%#lx end:%#lx dev:%s\n",
> - here, skb->len, sz, skb->head, skb->data,
> - (unsigned long)skb->tail, (unsigned long)skb->end,
> - skb->dev ? skb->dev->name : "<NULL>");
> + netdev_emerg(skb->dev, "skb_over_panic: text:%p len:%d put:%d head:%p data:%p tail:%#lx end:%#lx\n",
> + here, skb->len, sz, skb->head, skb->data,
> + (unsigned long)skb->tail, (unsigned long)skb->end);
> BUG();
> }
>
Are you guaranteed to have skb->dev be non-null here? netdev_printk handles
that, but flaggin the fact that we have a NULL net device when thats not really
an issue seems like it would destract from the purpose of this printk. Same
with the others in this file below
> @@ -139,11 +137,9 @@ static void skb_over_panic(struct sk_buff *skb, int sz, void *here)
>
> static void skb_under_panic(struct sk_buff *skb, int sz, void *here)
> {
> - printk(KERN_EMERG "skb_under_panic: text:%p len:%d put:%d head:%p "
> - "data:%p tail:%#lx end:%#lx dev:%s\n",
> - here, skb->len, sz, skb->head, skb->data,
> - (unsigned long)skb->tail, (unsigned long)skb->end,
> - skb->dev ? skb->dev->name : "<NULL>");
> + netdev_emerg(skb->dev, "skb_under_panic: text:%p len:%d put:%d head:%p data:%p tail:%#lx end:%#lx\n",
> + here, skb->len, sz, skb->head, skb->data,
> + (unsigned long)skb->tail, (unsigned long)skb->end);
> BUG();
> }
>
> @@ -3061,9 +3057,8 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
> if (unlikely(start > skb_headlen(skb)) ||
> unlikely((int)start + off > skb_headlen(skb) - 2)) {
> if (net_ratelimit())
> - printk(KERN_WARNING
> - "bad partial csum: csum=%u/%u len=%u\n",
> - start, off, skb_headlen(skb));
> + netdev_warn(skb->dev, "bad partial csum: csum=%u/%u len=%u\n",
> + start, off, skb_headlen(skb));
> return false;
> }
> skb->ip_summed = CHECKSUM_PARTIAL;
> @@ -3076,7 +3071,6 @@ EXPORT_SYMBOL_GPL(skb_partial_csum_set);
> void __skb_warn_lro_forwarding(const struct sk_buff *skb)
> {
> if (net_ratelimit())
> - pr_warning("%s: received packets cannot be forwarded"
> - " while LRO is enabled\n", skb->dev->name);
> + netdev_warn(skb->dev, "received packets cannot be forwarded while LRO is enabled\n");
> }
> EXPORT_SYMBOL(__skb_warn_lro_forwarding);
><snip>
Neil
>
> --
> 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
>
^ permalink raw reply
* Re: [PATCH] vmxnet3: Convert to new vlan model.
From: Michał Mirosław @ 2011-06-29 11:06 UTC (permalink / raw)
To: Jesse Gross; +Cc: David Miller, netdev, Shreyas Bhatewara, VMware PV-Drivers
In-Reply-To: <1308870279-30773-1-git-send-email-jesse@nicira.com>
2011/6/24 Jesse Gross <jesse@nicira.com>:
> This converts the vmxnet3 driver to use the new vlan model. In doing so
> it fixes missing tags in tcpdump and failure to do checksum offload when
> tx vlan offload is disabled.
[...]
> --- a/drivers/net/vmxnet3/vmxnet3_drv.c
> +++ b/drivers/net/vmxnet3/vmxnet3_drv.c
[...]
> @@ -2639,12 +2588,13 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64)
>
> netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
> NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX |
> - NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
> + NETIF_F_HW_VLAN_RX | NETIF_F_TSO | NETIF_F_TSO6 |
> + NETIF_F_LRO;
> if (dma64)
> netdev->features |= NETIF_F_HIGHDMA;
***
> - netdev->vlan_features = netdev->hw_features & ~NETIF_F_HW_VLAN_TX;
> - netdev->features = netdev->hw_features |
> - NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
> + netdev->vlan_features = netdev->hw_features &
> + ~(NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
> + netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_FILTER;
This will disable NETIF_F_HIGHDMA even if dma64 == true. I propose a
fix that sets NETIF_F_HIGHDMA
in hw_features instead of features at line before '***' mark.
Best Regards,
Michał Mirosław
^ permalink raw reply
* Re: linux-next: build failure after merge of the final tree (net tree related)
From: David Miller @ 2011-06-29 9:58 UTC (permalink / raw)
To: sfr; +Cc: adobriyan, netdev, linux-next, linux-kernel
In-Reply-To: <20110629160901.2d3cd6da.sfr@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 29 Jun 2011 16:09:01 +1000
> Again, this has taken some time to fix ...
>
> Dave, I think you have raised my expectations too far ;-)
Sorry. I try to give the offender time to fix the build failure
himself, but as you saw this time that didn't work out.
To be honest I'm going to be quite reluctant to apply these kinds of
header removal patches in the future if this is how responsive the
patch submitter is going to be to build fallout. :-/
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Wed, 29 Jun 2011 16:03:18 +1000
> Subject: [PATCH] net: include dma-mapping.h for dma_map_single etc
>
> fixes thses build errors:
...
> Caused by commit commit b7f080cfe223 ("net: remove mm.h inclusion from
> netdevice.h").
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Applied, thanks!
^ permalink raw reply
* Re: linux-next: build failure after merge of the final tree (net tree related)
From: David Miller @ 2011-06-29 9:56 UTC (permalink / raw)
To: sfr; +Cc: netdev, linux-next, linux-kernel, adobriyan
In-Reply-To: <20110629160133.372e53ed.sfr@canb.auug.org.au>
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Wed, 29 Jun 2011 16:01:33 +1000
> From: Stephen Rothwell <sfr@canb.auug.org.au>
> Date: Wed, 29 Jun 2011 15:52:00 +1000
> Subject: [PATCH] net: include io.h in for iounmap etc
>
> fixes these build errors:
...
> Caused by commit b7f080cfe223 ("net: remove mm.h inclusion from
> netdevice.h").
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Applied.
^ permalink raw reply
* Re: [PATCH V7 4/4 net-next] vhost: vhost TX zero-copy support
From: Michael S. Tsirkin @ 2011-06-29 9:13 UTC (permalink / raw)
To: Shirley Ma
Cc: David Miller, Eric Dumazet, Avi Kivity, Arnd Bergmann, netdev,
kvm, linux-kernel
In-Reply-To: <1306611267.5180.97.camel@localhost.localdomain>
On Sat, May 28, 2011 at 12:34:27PM -0700, Shirley Ma wrote:
> Hello Michael,
>
> In order to use wait for completion in shutting down, seems to me
> another work thread is needed to call vhost_zerocopy_add_used,
Hmm I don't see vhost_zerocopy_add_used here.
> it seems
> too much work to address a minor issue here. Do we really need it?
Assuming you mean vhost_zerocopy_signal_used, here's how I would do it:
add a kref and a completion, signal completion in kref_put
callback, when backend is set - kref_get, on cleanup,
kref_put and then wait_for_completion_interruptible.
Where's the need for another thread coming from?
If you like, post a patch with busywait + a FIXME comment,
and I can write up a patch on top.
(BTW, ideally the function that does the signalling should be
in core networking bits so that it's still around
even if the vhost module gets removed).
> Right now, the approach I am using is to ignore outstanding userspace
> buffers during shutting down if any, the device might DMAed some wrong
> data to the wire, do we really care?
>
> Thanks
> Shirley
I think so, yes, guest is told that memory can be reused so
it might put the credit card number or whatever there :)
> ------------
>
> This patch maintains the outstanding userspace buffers in the
> sequence it is delivered to vhost. The outstanding userspace buffers
> will be marked as done once the lower device buffers DMA has finished.
> This is monitored through last reference of kfree_skb callback. Two
> buffer index are used for this purpose.
>
> The vhost passes the userspace buffers info to lower device skb
> through message control. Since there will be some done DMAs when
> entering vhost handle_tx. The worse case is all buffers in the vq are
> in pending/done status, so we need to notify guest to release DMA done
> buffers first before get any new buffers from the vq.
>
> Signed-off-by: Shirley <xma@us.ibm.com>
> ---
>
> drivers/vhost/net.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
> drivers/vhost/vhost.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
> drivers/vhost/vhost.h | 15 +++++++++++++++
> 3 files changed, 107 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 2f7c76a..e2eaba6 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -32,6 +32,11 @@
> * Using this limit prevents one virtqueue from starving others. */
> #define VHOST_NET_WEIGHT 0x80000
>
> +/* MAX number of TX used buffers for outstanding zerocopy */
> +#define VHOST_MAX_PEND 128
> +/* change it to 256 when small message size performance issue is addressed */
> +#define VHOST_GOODCOPY_LEN 2048
> +
> enum {
> VHOST_NET_VQ_RX = 0,
> VHOST_NET_VQ_TX = 1,
> @@ -151,6 +156,10 @@ static void handle_tx(struct vhost_net *net)
> hdr_size = vq->vhost_hlen;
>
> for (;;) {
> + /* Release DMAs done buffers first */
> + if (atomic_read(&vq->refcnt) > VHOST_MAX_PEND)
> + vhost_zerocopy_signal_used(vq, false);
> +
> head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
> ARRAY_SIZE(vq->iov),
> &out, &in,
> @@ -166,6 +175,12 @@ static void handle_tx(struct vhost_net *net)
> set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> break;
> }
> + /* If more outstanding DMAs, queue the work */
> + if (atomic_read(&vq->refcnt) > VHOST_MAX_PEND) {
> + tx_poll_start(net, sock);
> + set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> + break;
> + }
> if (unlikely(vhost_enable_notify(vq))) {
> vhost_disable_notify(vq);
> continue;
> @@ -188,6 +203,26 @@ static void handle_tx(struct vhost_net *net)
> iov_length(vq->hdr, s), hdr_size);
> break;
> }
> + /* use msg_control to pass vhost zerocopy ubuf info to skb */
> + if (sock_flag(sock->sk, SOCK_ZEROCOPY)) {
> + vq->heads[vq->upend_idx].id = head;
> + if (len < VHOST_GOODCOPY_LEN)
> + /* copy don't need to wait for DMA done */
> + vq->heads[vq->upend_idx].len =
> + VHOST_DMA_DONE_LEN;
> + else {
> + struct ubuf_info *ubuf = &vq->ubuf_info[head];
> +
> + vq->heads[vq->upend_idx].len = len;
> + ubuf->callback = vhost_zerocopy_callback;
> + ubuf->arg = vq;
> + ubuf->desc = vq->upend_idx;
> + msg.msg_control = ubuf;
> + msg.msg_controllen = sizeof(ubuf);
> + }
> + atomic_inc(&vq->refcnt);
> + vq->upend_idx = (vq->upend_idx + 1) % UIO_MAXIOV;
> + }
> /* TODO: Check specific error and bomb out unless ENOBUFS? */
> err = sock->ops->sendmsg(NULL, sock, &msg, len);
> if (unlikely(err < 0)) {
> @@ -198,12 +233,21 @@ static void handle_tx(struct vhost_net *net)
> if (err != len)
> pr_debug("Truncated TX packet: "
> " len %d != %zd\n", err, len);
> - vhost_add_used_and_signal(&net->dev, vq, head, 0);
> + if (!sock_flag(sock->sk, SOCK_ZEROCOPY))
> + vhost_add_used_and_signal(&net->dev, vq, head, 0);
> total_len += len;
> if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
> vhost_poll_queue(&vq->poll);
> break;
> }
> + /* if upend_idx is full, then wait for free more */
> +/*
> + if (unlikely(vq->upend_idx == vq->done_idx)) {
> + tx_poll_start(net, sock);
> + set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> + break;
> + }
> +*/
What's this BTW?
> }
>
> mutex_unlock(&vq->mutex);
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 7aa4eea..b76e42a 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -174,6 +174,9 @@ static void vhost_vq_reset(struct vhost_dev *dev,
> vq->call_ctx = NULL;
> vq->call = NULL;
> vq->log_ctx = NULL;
> + vq->upend_idx = 0;
> + vq->done_idx = 0;
> + atomic_set(&vq->refcnt, 0);
> }
>
> static int vhost_worker(void *data)
> @@ -232,6 +235,8 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
> GFP_KERNEL);
> dev->vqs[i].heads = kmalloc(sizeof *dev->vqs[i].heads *
> UIO_MAXIOV, GFP_KERNEL);
> + dev->vqs[i].ubuf_info = kmalloc(sizeof *dev->vqs[i].ubuf_info *
> + UIO_MAXIOV, GFP_KERNEL);
>
> if (!dev->vqs[i].indirect || !dev->vqs[i].log ||
> !dev->vqs[i].heads)
> @@ -244,6 +249,7 @@ err_nomem:
> kfree(dev->vqs[i].indirect);
> kfree(dev->vqs[i].log);
> kfree(dev->vqs[i].heads);
> + kfree(dev->vqs[i].ubuf_info);
> }
> return -ENOMEM;
> }
> @@ -385,6 +391,30 @@ long vhost_dev_reset_owner(struct vhost_dev *dev)
> return 0;
> }
>
> +/* In case of DMA done not in order in lower device driver for some reason.
> + * upend_idx is used to track end of used idx, done_idx is used to track head
> + * of used idx. Once lower device DMA done contiguously, we will signal KVM
> + * guest used idx.
> + */
> +void vhost_zerocopy_signal_used(struct vhost_virtqueue *vq, bool shutdown)
> +{
> + int i, j = 0;
> +
> + for (i = vq->done_idx; i != vq->upend_idx; i = ++i % UIO_MAXIOV) {
> + if ((vq->heads[i].len == VHOST_DMA_DONE_LEN) || shutdown) {
> + vq->heads[i].len = VHOST_DMA_CLEAR_LEN;
> + vhost_add_used_and_signal(vq->dev, vq,
> + vq->heads[i].id, 0);
> + ++j;
> + } else
> + break;
> + }
> + if (j) {
> + vq->done_idx = i;
> + atomic_sub(j, &vq->refcnt);
> + }
> +}
> +
> /* Caller should have device mutex */
> void vhost_dev_cleanup(struct vhost_dev *dev)
> {
> @@ -395,6 +425,9 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
> vhost_poll_stop(&dev->vqs[i].poll);
> vhost_poll_flush(&dev->vqs[i].poll);
> }
> + /* Wait for all lower device DMAs done */
> + if (atomic_read(&dev->vqs[i].refcnt))
> + vhost_zerocopy_signal_used(&dev->vqs[i], true);
> if (dev->vqs[i].error_ctx)
> eventfd_ctx_put(dev->vqs[i].error_ctx);
> if (dev->vqs[i].error)
> @@ -603,6 +636,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp)
>
> mutex_lock(&vq->mutex);
>
> + /* clean up lower device outstanding DMAs, before setting ring */
> + if (atomic_read(&vq->refcnt))
> + vhost_zerocopy_signal_used(vq, true);
> +
> switch (ioctl) {
> case VHOST_SET_VRING_NUM:
> /* Resizing ring with an active backend?
> @@ -1416,3 +1453,13 @@ void vhost_disable_notify(struct vhost_virtqueue *vq)
> vq_err(vq, "Failed to enable notification at %p: %d\n",
> &vq->used->flags, r);
> }
> +
> +void vhost_zerocopy_callback(void *arg)
> +{
> + struct ubuf_info *ubuf = (struct ubuf_info *)arg;
> + struct vhost_virtqueue *vq;
> +
> + vq = (struct vhost_virtqueue *)ubuf->arg;
> + /* set len = 1 to mark this desc buffers done DMA */
> + vq->heads[ubuf->desc].len = VHOST_DMA_DONE_LEN;
> +}
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index b3363ae..0b11734 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -13,6 +13,11 @@
> #include <linux/virtio_ring.h>
> #include <asm/atomic.h>
>
> +/* This is for zerocopy, used buffer len is set to 1 when lower device DMA
> + * done */
> +#define VHOST_DMA_DONE_LEN 1
> +#define VHOST_DMA_CLEAR_LEN 0
> +
> struct vhost_device;
>
> struct vhost_work;
> @@ -108,6 +113,14 @@ struct vhost_virtqueue {
> /* Log write descriptors */
> void __user *log_base;
> struct vhost_log *log;
> + /* vhost zerocopy support */
> + atomic_t refcnt; /* num of outstanding zerocopy DMAs */
> + /* last used idx for outstanding DMA zerocopy buffers */
> + int upend_idx;
> + /* first used idx for DMA done zerocopy buffers */
> + int done_idx;
> + /* an array of userspace buffers info */
> + struct ubuf_info *ubuf_info;
> };
>
> struct vhost_dev {
> @@ -154,6 +167,8 @@ bool vhost_enable_notify(struct vhost_virtqueue *);
>
> int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
> unsigned int log_num, u64 len);
> +void vhost_zerocopy_callback(void *arg);
> +void vhost_zerocopy_signal_used(struct vhost_virtqueue *vq, bool shutdown);
>
> #define vq_err(vq, fmt, ...) do { \
> pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
>
^ 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