* [PATCH] b44.c box lockup fix (netconsole): ratelimit NAPI poll error message
From: Andreas Mohr @ 2009-11-25 21:35 UTC (permalink / raw)
To: davem; +Cc: zambrano, dave, mb, netdev, linux-kernel
Hello all,
my OpenWrt MIPSEL ASUS WL-500gP v2 kept locking up during driver
debugging with kobject debugging turned on (when debugging non-working
drivers such as USB, ftdi_sio and usb_audio).
Turns out that it's not very helpful to have a netconsole-deployed
network driver's interrupt handler message spew noise permanently
(see comment in patch).
See
http://bugzilla.kernel.org/show_bug.cgi?id=14691
for background information.
Tested on 2.6.30.9 and working (now normal debug messages manage
to come through, too, yet box still locked up, simply due to excessive
_normal_ log messages such as kobject logging, but that's _expected_
and user-correctable).
checkpatch.pl'd, applies cleanly to -rc8.
Likely -stable candidate material.
r8169 (and perhaps other netconsole-capable drivers?)
might need such a correction, too, if the
if (likely(napi_schedule_prep(&tp->napi)))
__napi_schedule(&tp->napi);
else if (netif_msg_intr(tp)) {
printk(KERN_INFO "%s: interrupt %04x in poll\n",
dev->name, status);
}
is similarly problematic.
BTW: this patch here is to be seen separate from the r8169 interrupt handler
rework as discussed at "r8169: avoid losing MSI interrupts", since even with a
"working" interrupt handler (i.e. one that closes the "new interrupt" race window,
which the one in b44 currently probably doesn't) such error messages
have a fatal feedback loop in the case of netconsole deployment.
Thanks,
Signed-off-by: Andreas Mohr <andi@lisas.de>
--- linux-2.6.30.9/drivers/net/b44.c.orig 2009-11-25 20:49:48.000000000 +0100
+++ linux-2.6.30.9/drivers/net/b44.c 2009-11-25 21:26:34.000000000 +0100
@@ -913,8 +913,18 @@
__b44_disable_ints(bp);
__napi_schedule(&bp->napi);
} else {
- printk(KERN_ERR PFX "%s: Error, poll already scheduled\n",
- dev->name);
+ /* netconsole fix!!:
+ * without ratelimiting, this message would:
+ * immediately find its way out to b44 netconsole ->
+ * new IRQ -> re-encounter failed napi_schedule_prep()
+ * -> error message -> ad nauseam -> box LOCKUP.
+ * See thread "r8169: avoid losing MSI interrupts"
+ * for further inspiration. */
+ if (printk_ratelimit())
+ printk(KERN_ERR PFX
+ "%s: Error, poll already scheduled; "
+ "istat 0x%x, imask 0x%x\n",
+ dev->name, istat, imask);
}
irq_ack:
^ permalink raw reply
* [PATCH] r8169: move PHY regs tables to .rodata
From: Alexey Dobriyan @ 2009-11-25 21:39 UTC (permalink / raw)
To: davem; +Cc: netdev
As side effect, consume less stack.
-rtl8169_get_mac_version [vmlinux]: 432
-rtl8169_init_one [vmlinux]: 376
+rtl8169_init_one [vmlinux]: 136
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
drivers/net/r8169.c | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -756,7 +756,7 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
struct rtl8169_private *tp = netdev_priv(dev);
void __iomem *ioaddr = tp->mmio_addr;
unsigned int i;
- static struct {
+ static const struct {
u32 opt;
u16 reg;
u8 mask;
@@ -1247,7 +1247,7 @@ static void rtl8169_get_mac_version(struct rtl8169_private *tp,
*
* (RTL_R32(TxConfig) & 0x700000) == 0x200000 ? 8101Eb : 8101Ec
*/
- const struct {
+ static const struct {
u32 mask;
u32 val;
int mac_version;
@@ -1318,7 +1318,7 @@ struct phy_reg {
u16 val;
};
-static void rtl_phy_write(void __iomem *ioaddr, struct phy_reg *regs, int len)
+static void rtl_phy_write(void __iomem *ioaddr, const struct phy_reg *regs, int len)
{
while (len-- > 0) {
mdio_write(ioaddr, regs->reg, regs->val);
@@ -1328,7 +1328,7 @@ static void rtl_phy_write(void __iomem *ioaddr, struct phy_reg *regs, int len)
static void rtl8169s_hw_phy_config(void __iomem *ioaddr)
{
- struct {
+ static const struct {
u16 regs[5]; /* Beware of bit-sign propagation */
} phy_magic[5] = { {
{ 0x0000, //w 4 15 12 0
@@ -1380,7 +1380,7 @@ static void rtl8169s_hw_phy_config(void __iomem *ioaddr)
static void rtl8169sb_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0002 },
{ 0x01, 0x90d0 },
{ 0x1f, 0x0000 }
@@ -1391,7 +1391,7 @@ static void rtl8169sb_hw_phy_config(void __iomem *ioaddr)
static void rtl8168bb_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x10, 0xf41b },
{ 0x1f, 0x0000 }
};
@@ -1404,7 +1404,7 @@ static void rtl8168bb_hw_phy_config(void __iomem *ioaddr)
static void rtl8168bef_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0001 },
{ 0x10, 0xf41b },
{ 0x1f, 0x0000 }
@@ -1415,7 +1415,7 @@ static void rtl8168bef_hw_phy_config(void __iomem *ioaddr)
static void rtl8168cp_1_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0000 },
{ 0x1d, 0x0f00 },
{ 0x1f, 0x0002 },
@@ -1428,7 +1428,7 @@ static void rtl8168cp_1_hw_phy_config(void __iomem *ioaddr)
static void rtl8168cp_2_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0001 },
{ 0x1d, 0x3d98 },
{ 0x1f, 0x0000 }
@@ -1443,7 +1443,7 @@ static void rtl8168cp_2_hw_phy_config(void __iomem *ioaddr)
static void rtl8168c_1_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0001 },
{ 0x12, 0x2300 },
{ 0x1f, 0x0002 },
@@ -1472,7 +1472,7 @@ static void rtl8168c_1_hw_phy_config(void __iomem *ioaddr)
static void rtl8168c_2_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0001 },
{ 0x12, 0x2300 },
{ 0x03, 0x802f },
@@ -1500,7 +1500,7 @@ static void rtl8168c_2_hw_phy_config(void __iomem *ioaddr)
static void rtl8168c_3_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0001 },
{ 0x12, 0x2300 },
{ 0x1d, 0x3d98 },
@@ -1527,7 +1527,7 @@ static void rtl8168c_4_hw_phy_config(void __iomem *ioaddr)
static void rtl8168d_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init_0[] = {
+ static const struct phy_reg phy_reg_init_0[] = {
{ 0x1f, 0x0001 },
{ 0x09, 0x2770 },
{ 0x08, 0x04d0 },
@@ -1556,7 +1556,7 @@ static void rtl8168d_hw_phy_config(void __iomem *ioaddr)
rtl_phy_write(ioaddr, phy_reg_init_0, ARRAY_SIZE(phy_reg_init_0));
if (mdio_read(ioaddr, 0x06) == 0xc400) {
- struct phy_reg phy_reg_init_1[] = {
+ static const struct phy_reg phy_reg_init_1[] = {
{ 0x1f, 0x0005 },
{ 0x01, 0x0300 },
{ 0x1f, 0x0000 },
@@ -1597,7 +1597,7 @@ static void rtl8168d_hw_phy_config(void __iomem *ioaddr)
static void rtl8102e_hw_phy_config(void __iomem *ioaddr)
{
- struct phy_reg phy_reg_init[] = {
+ static const struct phy_reg phy_reg_init[] = {
{ 0x1f, 0x0003 },
{ 0x08, 0x441d },
{ 0x01, 0x9100 },
@@ -2370,7 +2370,7 @@ static void rtl_set_rx_max_size(void __iomem *ioaddr, unsigned int rx_buf_sz)
static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
{
- struct {
+ static const struct {
u32 mac_version;
u32 clk;
u32 val;
@@ -2494,7 +2494,7 @@ struct ephy_info {
u16 bits;
};
-static void rtl_ephy_init(void __iomem *ioaddr, struct ephy_info *e, int len)
+static void rtl_ephy_init(void __iomem *ioaddr, const struct ephy_info *e, int len)
{
u16 w;
@@ -2565,7 +2565,7 @@ static void __rtl_hw_start_8168cp(void __iomem *ioaddr, struct pci_dev *pdev)
static void rtl_hw_start_8168cp_1(void __iomem *ioaddr, struct pci_dev *pdev)
{
- static struct ephy_info e_info_8168cp[] = {
+ static const struct ephy_info e_info_8168cp[] = {
{ 0x01, 0, 0x0001 },
{ 0x02, 0x0800, 0x1000 },
{ 0x03, 0, 0x0042 },
@@ -2609,7 +2609,7 @@ static void rtl_hw_start_8168cp_3(void __iomem *ioaddr, struct pci_dev *pdev)
static void rtl_hw_start_8168c_1(void __iomem *ioaddr, struct pci_dev *pdev)
{
- static struct ephy_info e_info_8168c_1[] = {
+ static const struct ephy_info e_info_8168c_1[] = {
{ 0x02, 0x0800, 0x1000 },
{ 0x03, 0, 0x0002 },
{ 0x06, 0x0080, 0x0000 }
@@ -2626,7 +2626,7 @@ static void rtl_hw_start_8168c_1(void __iomem *ioaddr, struct pci_dev *pdev)
static void rtl_hw_start_8168c_2(void __iomem *ioaddr, struct pci_dev *pdev)
{
- static struct ephy_info e_info_8168c_2[] = {
+ static const struct ephy_info e_info_8168c_2[] = {
{ 0x01, 0, 0x0001 },
{ 0x03, 0x0400, 0x0220 }
};
@@ -2767,7 +2767,7 @@ static void rtl_hw_start_8168(struct net_device *dev)
static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev)
{
- static struct ephy_info e_info_8102e_1[] = {
+ static const struct ephy_info e_info_8102e_1[] = {
{ 0x01, 0, 0x6e65 },
{ 0x02, 0, 0x091f },
{ 0x03, 0, 0xc2f9 },
^ permalink raw reply
* Re: [Bugme-new] [Bug 14688] New: alignment of rx_skb in r8169 driver
From: Andrew Morton @ 2009-11-25 21:55 UTC (permalink / raw)
To: meyer; +Cc: bugzilla-daemon, bugme-daemon, Francois Romieu, netdev
In-Reply-To: <bug-14688-10286@http.bugzilla.kernel.org/>
(switched to email. Please respond via emailed reply-to-all, not via the
bugzilla web interface).
On Wed, 25 Nov 2009 15:01:16 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=14688
>
> Summary: alignment of rx_skb in r8169 driver
> Product: Drivers
> Version: 2.5
> Kernel Version: 2.6.29
> Platform: All
> OS/Version: Linux
> Tree: Mainline
> Status: NEW
> Severity: normal
> Priority: P1
> Component: Network
> AssignedTo: drivers_network@kernel-bugs.osdl.org
> ReportedBy: meyer@fsr.tu-darmstadt.de
> Regression: No
>
>
> Created an attachment (id=23933)
> --> (http://bugzilla.kernel.org/attachment.cgi?id=23933)
> patch for rtl8169_alloc_rx_skb
>
> Dear Maintainers,
>
> I think there is a bug in the rtl8169_alloc_rx_skb function of the RealTek
> 8169/8168/8101 ethernet driver in kernel version 2.6.29.6, but also in current
> 2.6.31 versions.
>
> For the case the align argument is different from 0, the skb_reserve call is
> expected to align the data field accordingly by padding. The number of bytes to
> reserve is calculated by the expression
>
> (align - 1) & (unsigned long)skb->data
>
> which is wrong. I would suggest the following correction:
>
> pad = align ? align - ((align - 1) & (unsigned long)skb->data) : NET_IP_ALIGN;
> if (pad == align) pad = 0; // optional
> skb_reserve(skb, pad);
>
> A patch for r8169.c is provided as attachment.
>
Thanks, but..
- please always submit patches via email, not via bugzilla.
Documentation/SubmittingPatches goes into some detail.
- prepare patches as a unified diff, in `patch -p1' form. It should
look like:
--- a/drivers/net/r8169.c~a
+++ a/drivers/net/r8169.c
@@ -207,7 +207,9 @@ enum rtl_registers {
ChipCmd = 0x37,
TxPoll = 0x38,
IntrMask = 0x3c,
+wibble
IntrStatus = 0x3e,
+wobble
TxConfig = 0x40,
RxConfig = 0x44,
RxMissed = 0x4c,
_
- Please cc at least the following on the patch:
Francois Romieu <romieu@fr.zoreil.com>
"David S. Miller" <davem@davemloft.net>
netdev@vger.kernel.org
- Don't forget the changelog and a Singed-off-by:!
^ permalink raw reply
* Re: [rfc 1/3 v2] [E1000-devel] [rfc 1/4] igb: Add igb_cleanup_vf()
From: Simon Horman @ 2009-11-25 22:11 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: e1000-devel, netdev, Arnd Bergmann, Alexander Duyck
In-Reply-To: <9929d2390911242340t2e639719kc5ed80725f74a31d@mail.gmail.com>
On Tue, Nov 24, 2009 at 11:40:36PM -0800, Jeff Kirsher wrote:
> On Tue, Nov 24, 2009 at 22:32, Simon Horman <horms@verge.net.au> wrote:
> > Move virtual finction cleanup code into igb_cleanup_vf() and for the sake
> > of symmetry rename igb_probe_vfs() as igb_init_vf().
> >
> > Although these functions aren't entirely symmetrical it should aid
> > maintenance by making the relationship between initialisation and cleanup
> > more obvious.
> >
> > Note that there appears to be no way for adapter->vfs_allocated_count to be
> > non-zero for the case where CONFIG_PCI_IOV is not set, so reseting this
> > value was moved to inside the relvant #ifdef.
> >
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> >
> > ---
> > Thu, 05 Nov 2009 11:58:48 +1100
> > * Initial post
> >
> > Wed, 25 Nov 2009 15:43:45 +1100
> > * Actually remove adapter->vfs_allocated_count = 0 from outside of
> > igb_cleanup_vf()
> > * Up-port to current net-next
>
> Thanks Simon and congrats on the new addition! I have added this
> three patch series to my tree for review and testing.
Thanks
^ permalink raw reply
* Re: [rfc 1/3 v2] [E1000-devel] [rfc 1/4] igb: Add igb_cleanup_vf()
From: Alexander Duyck @ 2009-11-25 22:27 UTC (permalink / raw)
To: Simon Horman
Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
Arnd Bergmann, Kirsher, Jeffrey T
In-Reply-To: <20091125063530.796967189@vergenet.net>
Simon Horman wrote:
> Move virtual finction cleanup code into igb_cleanup_vf() and for the sake
> of symmetry rename igb_probe_vfs() as igb_init_vf().
>
> Although these functions aren't entirely symmetrical it should aid
> maintenance by making the relationship between initialisation and cleanup
> more obvious.
>
> Note that there appears to be no way for adapter->vfs_allocated_count to be
> non-zero for the case where CONFIG_PCI_IOV is not set, so reseting this
> value was moved to inside the relvant #ifdef.
>
> Signed-off-by: Simon Horman <horms@verge.net.au>
The one thing I noticed with this patch is that it didn't remove the vf
cleanup from igb_remove. You may want to go back and also add the
replacement of that function with igb_cleanup_vf to this patch.
Thanks,
Alex
> ---
> Thu, 05 Nov 2009 11:58:48 +1100
> * Initial post
>
> Wed, 25 Nov 2009 15:43:45 +1100
> * Actually remove adapter->vfs_allocated_count = 0 from outside of
> igb_cleanup_vf()
> * Up-port to current net-next
> Index: net-next-2.6/drivers/net/igb/igb_main.c
> ===================================================================
> --- net-next-2.6.orig/drivers/net/igb/igb_main.c 2009-11-25 16:59:19.000000000 +1100
> +++ net-next-2.6/drivers/net/igb/igb_main.c 2009-11-25 17:05:03.000000000 +1100
> @@ -92,6 +92,7 @@ void igb_update_stats(struct igb_adapter
> static int igb_probe(struct pci_dev *, const struct pci_device_id *);
> static void __devexit igb_remove(struct pci_dev *pdev);
> static int igb_sw_init(struct igb_adapter *);
> +static void igb_cleanup_vf(struct igb_adapter * adapter);
> static int igb_open(struct net_device *);
> static int igb_close(struct net_device *);
> static void igb_configure_tx(struct igb_adapter *);
> @@ -701,22 +702,7 @@ static void igb_set_interrupt_capability
>
> /* If we can't do MSI-X, try MSI */
> msi_only:
> -#ifdef CONFIG_PCI_IOV
> - /* disable SR-IOV for non MSI-X configurations */
> - if (adapter->vf_data) {
> - struct e1000_hw *hw = &adapter->hw;
> - /* disable iov and allow time for transactions to clear */
> - pci_disable_sriov(adapter->pdev);
> - msleep(500);
> -
> - kfree(adapter->vf_data);
> - adapter->vf_data = NULL;
> - wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
> - msleep(100);
> - dev_info(&adapter->pdev->dev, "IOV Disabled\n");
> - }
> -#endif
> - adapter->vfs_allocated_count = 0;
> + igb_cleanup_vf(adapter);
> adapter->rss_queues = 1;
> adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
> adapter->num_rx_queues = 1;
> @@ -1755,7 +1741,7 @@ static void __devexit igb_remove(struct
> }
>
> /**
> - * igb_probe_vfs - Initialize vf data storage and add VFs to pci config space
> + * igb_init_vf - Initialize vf data storage and add VFs to pci config space
> * @adapter: board private structure to initialize
> *
> * This function initializes the vf specific data storage and then attempts to
> @@ -1763,7 +1749,7 @@ static void __devexit igb_remove(struct
> * mor expensive time wise to disable SR-IOV than it is to allocate and free
> * the memory for the VFs.
> **/
> -static void __devinit igb_probe_vfs(struct igb_adapter * adapter)
> +static void __devinit igb_init_vf(struct igb_adapter * adapter)
> {
> #ifdef CONFIG_PCI_IOV
> struct pci_dev *pdev = adapter->pdev;
> @@ -1909,6 +1895,35 @@ static void igb_init_hw_timer(struct igb
> }
>
> /**
> + * igb_cleanup_vf - Clean up vf data and remove vfs from pci config space
> + * @adapter: board private structure to initialize
> + *
> + * This function cleans-up the vf specific data storage and then attempts to
> + * deallocate the VFs.
> + **/
> +static void igb_cleanup_vf(struct igb_adapter * adapter)
> +{
> +#ifdef CONFIG_PCI_IOV
> + struct e1000_hw *hw = &adapter->hw;
> +
> + if (!adapter->vf_data)
> + return;
> +
> + /* disable iov and allow time for transactions to clear */
> + pci_disable_sriov(adapter->pdev);
> + msleep(500);
> +
> + kfree(adapter->vf_data);
> + adapter->vf_data = NULL;
> + adapter->vfs_allocated_count = 0;
> +
> + wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
> + msleep(100);
> + dev_info(&adapter->pdev->dev, "IOV Disabled\n");
> +#endif
> +}
> +
> +/**
> * igb_sw_init - Initialize general software structures (struct igb_adapter)
> * @adapter: board private structure to initialize
> *
> @@ -1955,7 +1970,7 @@ static int __devinit igb_sw_init(struct
> }
>
> igb_init_hw_timer(adapter);
> - igb_probe_vfs(adapter);
> + igb_init_vf(adapter);
>
> /* Explicitly disable IRQ since the NIC can be in any state. */
> igb_irq_disable(adapter);
>
^ permalink raw reply
* Re: [E1000-devel] TCP sockets stalling - help! (long)
From: Ilpo Järvinen @ 2009-11-25 22:29 UTC (permalink / raw)
To: Asdo; +Cc: e1000-devel, Netdev
In-Reply-To: <4B0D5D86.8010509@shiftmail.org>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 6731 bytes --]
On Wed, 25 Nov 2009, Asdo wrote:
> Asdo wrote:
> > Asdo wrote:
> > > Ilpo Järvinen wrote:
> > >
> > > > ...I'd next try strace the sftp server to see what it was doing during
> > > > the stall.
> > > >
> > > Thanks for your help Ilpo
> > >
> > > Isn't the strace equivalent to the stack trace I obtained via cat
> > > /proc/pid/stack reported previously? That was at the time of the stall
> > >
> > > I'm thinking the strace would slow down sftp-server very deeply...
> > >
> >
> > I found out that if I attach the strace I can see at least the last function
> > call.
> > The SFTP it's hanged right now so I did that:
> >
> > root@mystorage:/root# strace -p 11475
> > Process 11475 attached - interrupt to quit
> > select(5, [3], [], NULL, NULL
> >
> > (stuck here forever... doesn't move)
> > (it's strange the first option of select is 5, shouldn't it be 4 from man
> > select? A bug of strace maybe?)
> >
> > root@mystorage:/root# cat /proc/11475/stack
> > [<ffffffff8112e644>] poll_schedule_timeout+0x34/0x50
> > [<ffffffff8112ef4f>] do_select+0x58f/0x6b0
> > [<ffffffff8112f8b5>] core_sys_select+0x185/0x2b0
> > [<ffffffff8112fc32>] sys_select+0x42/0x110
> > [<ffffffff8101225b>] tracesys+0xd9/0xde
> > [<ffffffffffffffff>] 0xffffffffffffffff
> >
> > And this is from cat /proc/net/tcp 2: 0F12A8C0:0016 2512A8C0:0FBD 01
> > 00000000:00000000 02:00009144 00000000 0 0 5326251 2
> > ffff88085408ce00 26 4 1 9 4
> >
> > The select refers to open files so here they are:
> >
> >
> > root@mystorage:/proc/11475/fd# ll
> > total 0
> > lr-x------ 1 ccosentino wetlab 64 2009-11-25 14:43 0 -> pipe:[5326309]
> > l-wx------ 1 ccosentino wetlab 64 2009-11-25 14:43 1 -> pipe:[5326310]
> > l-wx------ 1 ccosentino wetlab 64 2009-11-25 14:43 2 -> pipe:[5326311]
> > lr-x------ 1 ccosentino wetlab 64 2009-11-25 14:43 3 -> pipe:[5326309]
> > l-wx------ 1 ccosentino wetlab 64 2009-11-25 14:43 4 -> pipe:[5326310]
> > l-wx------ 1 ccosentino wetlab 64 2009-11-25 14:43 5 ->
> > /path/to/file_being_saved.filepart
> >
> > I tried to send SIGSTOP and then SIGCONT to see if I could make it make a
> > loop and then reenter into the select. I'm not sure it really did that, what
> > do you think? This is the strace:
> > root@mystorage:/root# strace -p 11475 2>&1 | tee sftpstrace.dmp
> > Process 11475 attached - interrupt to quit
> > select(5, [3], [], NULL, NULL) = ? ERESTARTNOHAND (To be restarted)
> > --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
> > --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
> > select(5, [3], [], NULL, NULL) = ? ERESTARTNOHAND (To be restarted)
> > --- SIGCONT (Continued) @ 0 (0) ---
> > select(5, [3], [], NULL, NULL
> >
> > (hanged again here)
> >
> >
> > Do you think this info is enough or I really have to strace it since the
> > beginning?
> > If it is a race condition it might not happen if the sftp-server is deeply
> > slowed down by the strace.
> > If I had a way to make it continue right now we could get the rest of the
> > strace... But it's not so easy, I tried starting a Samba transfer but it did
> > not unlock the SFTP this time. SIGSTOP + SIGCONT also didn't work.
> >
> > BTW people using the Storage also experienced data loss while pushing files
> > in it: appartently data disappeared from the middle of a file they were
> > saving to the Storage.
> > To me looks like another hint that application-level data which has been
> > received via network by TCP stack is trapped there and not being pushed to
> > the application.
> > Or the data might even be trapped into the anonymous sockets between sshd
> > and sftp-server.
> >
> > Thanks for your help
>
> I thought that it would be more meaningful to try the cat stack, the strace
> and the SIGSTOP SIGCONT tricks on the sshd which actually holds the TCP
> socket, instead of the sftp-server. Here they are, on the sshd:
>
> root@mystorage:/root# strace -p 11449 2>&1 | tee -a sshd1strace1.dmp
> Process 11449 attached - interrupt to quit
> read(5, 0x7fff4e956220, 4) = ? ERESTARTSYS (To be restarted)
> --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
> --- SIGSTOP (Stopped (signal)) @ 0 (0) ---
> read(5, 0x7fff4e956220, 4) = ? ERESTARTSYS (To be restarted)
> --- SIGCONT (Continued) @ 0 (0) ---
> read(5,
>
> (hanged again here after the SIGSTOP + SIGCONT, unfortunately)
>
> root@mystorage:/root# cat /proc/11449/stack
> [<ffffffff814b428a>] unix_stream_data_wait+0xaa/0x110
> [<ffffffff814b50cd>] unix_stream_recvmsg+0x36d/0x570
> [<ffffffff81426399>] sock_aio_read+0x149/0x150
> [<ffffffff8111e232>] do_sync_read+0xf2/0x130
> [<ffffffff8111e8e1>] vfs_read+0x181/0x1a0
> [<ffffffff8111edec>] sys_read+0x4c/0x80
> [<ffffffff8101225b>] tracesys+0xd9/0xde
> [<ffffffffffffffff>] 0xffffffffffffffff
>
> root@mystorage:/proc/11449/fd# ll
> total 0
> lrwx------ 1 root root 64 2009-11-25 14:43 0 -> /dev/null
> lrwx------ 1 root root 64 2009-11-25 14:43 1 -> /dev/null
> lrwx------ 1 root root 64 2009-11-25 14:43 2 -> /dev/null
> lrwx------ 1 root root 64 2009-11-25 14:43 3 -> socket:[5326251]
> lrwx------ 1 root root 64 2009-11-25 14:43 5 -> socket:[5326303]
>
>
> I would like to try to attach a program of mine (a python interactive) to
> "socket:[5326303]" and try to read data from there to see if something comes
> out of the TCP stack, but I don't know where to find the socket:[5326303] on
> the filesystem. Is it mapped to a file anywhere in Linux?
This line still tells that there is nothing to read from the socket:
> > And this is from cat /proc/net/tcp 2: 0F12A8C0:0016 2512A8C0:0FBD 01
> > 00000000:00000000 02:00009144 00000000 0 0 5326251 2
Let me reiterate, the first zeros here are the write side queue, the
latter are for the receive (not including ofo queue but if tcpdump doesn't
show ofo that's not significant detail here).
> > ffff88085408ce00 26 4 1 9 4
To me it seems that this particular problem so far shows very little
problem on TCP side. Ie., TCP just "stalls" because it is not fed with
anything.
What I would want to make absolutely sure, is that sftp-server was waiting
for a pipe which comes from sshd, I don't think we have confirmed that
just yet.
Also, I'd want to get a tcpdump, strace (the latter attach might be ok
but I'm not sure just yet) and /proc/net/tcp from a consistent case rather
than trying to mix multiple captures from different stalls. This is very
important since your captures are already in disagreement on what is
happening.
In addition, I want to see TCP timestamps (probably you need more -vvv to
tcpdump to show them), however, if there are no timestamps in use at all
and 1gpbs speeds, it could potentially explain the missing data already.
--
i.
^ permalink raw reply
* Re: [rfc 2/3 v2] [rfc 3/4] igb: Common error path in igb_init_vfs()
From: Alexander Duyck @ 2009-11-25 22:35 UTC (permalink / raw)
To: Simon Horman
Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
Arnd Bergmann, Kirsher, Jeffrey T
In-Reply-To: <20091125063531.218106764@vergenet.net>
Simon Horman wrote:
> Drop out into an error path on error.
>
> This is a bit superfluous as things stand, though arguably
> it already makes the code cleaner. But it should help things a lot
> if igb_init_vfs() has a several things to unwind on error.
>
> This patch eliminates resetting adapter->vfs_allocated_count to 0
> in the case where CONFIG_PCI_IOV is not set, because in that
> case adapter->vfs_allocated_count can never be non-zero.
>
> Signed-off-by: Simon Horman <horms@verge.net.au>
>
> ---
> Thu, 05 Nov 2009 11:58:50 +1100
> * Initial post
>
> Wed, 25 Nov 2009 16:44:15 +1100
> * Merged with " Initialise adapter->vfs_allocated_count in igb_init_vf()",
> however the initialisation of adapter->vfs_allocated_count is no
> longer moved into igb_init_vf() as doing so results in a panic.
>
> Index: net-next-2.6/drivers/net/igb/igb_main.c
> ===================================================================
> --- net-next-2.6.orig/drivers/net/igb/igb_main.c 2009-11-25 17:05:43.000000000 +1100
> +++ net-next-2.6/drivers/net/igb/igb_main.c 2009-11-25 17:05:44.000000000 +1100
> @@ -1753,38 +1753,37 @@ static void __devinit igb_init_vf(struct
> {
> #ifdef CONFIG_PCI_IOV
> struct pci_dev *pdev = adapter->pdev;
> + unsigned char mac_addr[ETH_ALEN];
> + int i;
>
> if (adapter->vfs_allocated_count > 7)
> adapter->vfs_allocated_count = 7;
>
> - if (adapter->vfs_allocated_count) {
> - adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
> - sizeof(struct vf_data_storage),
> - GFP_KERNEL);
> - /* if allocation failed then we do not support SR-IOV */
> - if (!adapter->vf_data) {
> - adapter->vfs_allocated_count = 0;
> - dev_err(&pdev->dev, "Unable to allocate memory for VF "
> - "Data Storage\n");
> - }
> + adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
> + sizeof(struct vf_data_storage), GFP_KERNEL);
> + /* if allocation failed then we do not support SR-IOV */
> + if (!adapter->vf_data) {
> + dev_err(&pdev->dev, "Unable to allocate memory for VF "
> + "Data Storage\n");
> + goto err_zero;
> }
>
The only issue I see with the changes above is that if SR-IOV is not
enabled via the max_vfs option you will end up returning an error even
though there is nothing wrong. You might want to go and keep the if
statement near the start and do something like:
if (!adapter->vfs_allocated_count)
goto err_zero;
This way you can avoid the false error report.
> - if (pci_enable_sriov(pdev, adapter->vfs_allocated_count)) {
> - kfree(adapter->vf_data);
> - adapter->vf_data = NULL;
> -#endif /* CONFIG_PCI_IOV */
> - adapter->vfs_allocated_count = 0;
> -#ifdef CONFIG_PCI_IOV
> - } else {
> - unsigned char mac_addr[ETH_ALEN];
> - int i;
> - dev_info(&pdev->dev, "%d vfs allocated\n",
> - adapter->vfs_allocated_count);
> - for (i = 0; i < adapter->vfs_allocated_count; i++) {
> - random_ether_addr(mac_addr);
> - igb_set_vf_mac(adapter, i, mac_addr);
> - }
> + if (pci_enable_sriov(pdev, adapter->vfs_allocated_count))
> + goto err_free;
> +
> + dev_info(&pdev->dev, "%d vfs allocated\n",
> + adapter->vfs_allocated_count);
> + for (i = 0; i < adapter->vfs_allocated_count; i++) {
> + random_ether_addr(mac_addr);
> + igb_set_vf_mac(adapter, i, mac_addr);
> }
> +
> + return;
> +err_free:
> + kfree(adapter->vf_data);
> +err_zero:
> + adapter->vf_data = NULL;
> + adapter->vfs_allocated_count = 0;
> #endif /* CONFIG_PCI_IOV */
> }
>
>
My preference here would be to bump the #endif up two lines so that
adapter->vf_data = NULL and adapter->vfs_allocated_count = 0 are ran in
the non-iov case. That way we know that SR-IOV is explicitly disabled.
Thanks,
Alex
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
^ permalink raw reply
* [PATCH net-next-2.6] net: use net_eq to compare nets
From: Octavian Purdila @ 2009-11-25 22:51 UTC (permalink / raw)
To: netdev; +Cc: Julia Lawall
Generated with the following semantic patch
@@
struct net *n1;
struct net *n2;
@@
- n1 == n2
+ net_eq(n1, n2)
@@
struct net *n1;
struct net *n2;
@@
- n1 != n2
+ !net_eq(n1, n2)
applied over {include,net,drivers/net}.
Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
---
drivers/net/hamradio/bpqether.c | 4 ++--
drivers/net/loopback.c | 2 +-
drivers/net/wan/hdlc.c | 4 ++--
net/appletalk/ddp.c | 2 +-
net/atm/svc.c | 2 +-
net/ax25/af_ax25.c | 2 +-
net/can/af_can.c | 2 +-
net/core/dev.c | 4 ++--
net/core/neighbour.c | 2 +-
net/core/net-sysfs.c | 4 ++--
net/core/net_namespace.c | 2 +-
net/core/sysctl_net_core.c | 2 +-
net/dcb/dcbnl.c | 2 +-
net/decnet/af_decnet.c | 2 +-
net/decnet/dn_dev.c | 6 +++---
net/decnet/dn_fib.c | 4 ++--
net/decnet/dn_route.c | 4 ++--
net/decnet/dn_table.c | 2 +-
net/econet/af_econet.c | 2 +-
net/ieee802154/af_ieee802154.c | 2 +-
net/ipv4/devinet.c | 2 +-
net/ipv4/fib_semantics.c | 4 ++--
net/ipv4/inet_connection_sock.c | 4 ++--
net/ipv4/inet_hashtables.c | 3 ++-
net/ipv4/ip_fragment.c | 4 ++--
net/ipv4/ip_input.c | 2 +-
net/ipv4/netfilter/ip_queue.c | 2 +-
net/ipv4/route.c | 4 ++--
net/ipv4/sysctl_net_ipv4.c | 4 ++--
net/ipv6/addrconf.c | 4 ++--
net/ipv6/ip6_flowlabel.c | 9 +++++----
net/ipv6/netfilter/ip6_queue.c | 2 +-
net/ipv6/reassembly.c | 4 ++--
net/ipx/af_ipx.c | 2 +-
net/llc/af_llc.c | 2 +-
net/netfilter/nfnetlink_log.c | 2 +-
net/netlink/af_netlink.c | 2 +-
net/netrom/af_netrom.c | 2 +-
net/packet/af_packet.c | 6 +++---
net/rose/af_rose.c | 2 +-
net/rxrpc/af_rxrpc.c | 2 +-
net/sched/act_api.c | 4 ++--
net/sched/cls_api.c | 4 ++--
net/sched/sch_api.c | 10 +++++-----
net/tipc/socket.c | 2 +-
net/x25/af_x25.c | 2 +-
46 files changed, 74 insertions(+), 72 deletions(-)
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index fe893c9..76abed9 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -186,7 +186,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
struct ethhdr *eth;
struct bpqdev *bpq;
- if (dev_net(dev) != &init_net)
+ if (!net_eq(dev_net(dev), &init_net))
goto drop;
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
@@ -552,7 +552,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
{
struct net_device *dev = (struct net_device *)ptr;
- if (dev_net(dev) != &init_net)
+ if (!net_eq(dev_net(dev), &init_net))
return NOTIFY_DONE;
if (!dev_is_ethdev(dev))
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 1bc654a..c9f6557 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -207,7 +207,7 @@ static __net_init int loopback_net_init(struct net *net)
out_free_netdev:
free_netdev(dev);
out:
- if (net == &init_net)
+ if (net_eq(net, &init_net))
panic("loopback: Failed to register netdevice: %d\n", err);
return err;
}
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index cc07236..9937bba 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -57,7 +57,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
{
struct hdlc_device *hdlc = dev_to_hdlc(dev);
- if (dev_net(dev) != &init_net) {
+ if (!net_eq(dev_net(dev), &init_net)) {
kfree_skb(skb);
return 0;
}
@@ -102,7 +102,7 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
unsigned long flags;
int on;
- if (dev_net(dev) != &init_net)
+ if (!net_eq(dev_net(dev), &init_net))
return NOTIFY_DONE;
if (!(dev->priv_flags & IFF_WAN_HDLC))
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c
index 73ca4d5..9fc4da5 100644
--- a/net/appletalk/ddp.c
+++ b/net/appletalk/ddp.c
@@ -1023,7 +1023,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
struct sock *sk;
int rc = -ESOCKTNOSUPPORT;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
/*
diff --git a/net/atm/svc.c b/net/atm/svc.c
index c739507..66e1d9b 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -655,7 +655,7 @@ static int svc_create(struct net *net, struct socket *sock, int protocol,
{
int error;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
sock->ops = &svc_proto_ops;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index d6ddfa4..5588ba6 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -805,7 +805,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
struct sock *sk;
ax25_cb *ax25;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
switch (sock->type) {
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 833bd83..f306717 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -126,7 +126,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
if (protocol < 0 || protocol >= CAN_NPROTO)
return -EINVAL;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
#ifdef CONFIG_MODULES
diff --git a/net/core/dev.c b/net/core/dev.c
index ccefa24..e65af60 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -985,7 +985,7 @@ rollback:
/* For now only devices in the initial network namespace
* are in sysfs.
*/
- if (net == &init_net) {
+ if (net_eq(net, &init_net)) {
ret = device_rename(&dev->dev, dev->name);
if (ret) {
memcpy(dev->name, oldname, IFNAMSIZ);
@@ -4792,7 +4792,7 @@ static void rollback_registered_many(struct list_head *head)
list_for_each_entry_safe(dev, aux, head, unreg_list) {
int new_net = 1;
list_for_each_entry(fdev, &pernet_list, unreg_list) {
- if (dev_net(dev) == dev_net(fdev)) {
+ if (net_eq(dev_net(dev), dev_net(fdev))) {
new_net = 0;
dev_put(dev);
break;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index e587e68..a08a35b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2092,7 +2092,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
if (h > s_h)
s_idx = 0;
for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) {
- if (dev_net(n->dev) != net)
+ if (!net_eq(dev_net(n->dev), net))
continue;
if (idx < s_idx)
goto next;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 157645c..fbc1c74 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -525,7 +525,7 @@ void netdev_unregister_kobject(struct net_device * net)
kobject_get(&dev->kobj);
- if (dev_net(net) != &init_net)
+ if (!net_eq(dev_net(net), &init_net))
return;
device_del(dev);
@@ -559,7 +559,7 @@ int netdev_register_kobject(struct net_device *net)
#endif
#endif /* CONFIG_SYSFS */
- if (dev_net(net) != &init_net)
+ if (!net_eq(dev_net(net), &init_net))
return 0;
return device_add(dev);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 1c1af27..86ed7f4 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -280,7 +280,7 @@ out_undo:
list_del(&ops->list);
if (ops->exit) {
for_each_net(undo_net) {
- if (undo_net == net)
+ if (net_eq(undo_net, net))
goto undone;
ops->exit(undo_net);
}
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 7db1de0..fcfc545 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -134,7 +134,7 @@ static __net_init int sysctl_core_net_init(struct net *net)
net->core.sysctl_somaxconn = SOMAXCONN;
tbl = netns_core_table;
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);
if (tbl == NULL)
goto err_dup;
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ac1205d..2afd617 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1126,7 +1126,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
u32 pid = skb ? NETLINK_CB(skb).pid : 0;
int ret = -EINVAL;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
ret = nlmsg_parse(nlh, sizeof(*dcb), tb, DCB_ATTR_MAX,
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 9ade3a6..2b494fa 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -680,7 +680,7 @@ static int dn_create(struct net *net, struct socket *sock, int protocol,
{
struct sock *sk;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
switch(sock->type) {
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 6c916e2..f20dec9 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -636,7 +636,7 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct dn_ifaddr *ifa, **ifap;
int err = -EINVAL;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
goto errout;
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
@@ -675,7 +675,7 @@ static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct dn_ifaddr *ifa;
int err;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
@@ -789,7 +789,7 @@ static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
struct dn_dev *dn_db;
struct dn_ifaddr *ifa;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return 0;
skip_ndevs = cb->args[0];
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c
index fd641f6..e9d4870 100644
--- a/net/decnet/dn_fib.c
+++ b/net/decnet/dn_fib.c
@@ -509,7 +509,7 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
struct rtattr **rta = arg;
struct rtmsg *r = NLMSG_DATA(nlh);
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
if (dn_fib_check_attr(r, rta))
@@ -529,7 +529,7 @@ static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
struct rtattr **rta = arg;
struct rtmsg *r = NLMSG_DATA(nlh);
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
if (dn_fib_check_attr(r, rta))
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 860286a..a032840 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1517,7 +1517,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
struct sk_buff *skb;
struct flowi fl;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
memset(&fl, 0, sizeof(fl));
@@ -1602,7 +1602,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
int h, s_h;
int idx, s_idx;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return 0;
if (NLMSG_PAYLOAD(cb->nlh, 0) < sizeof(struct rtmsg))
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index 67054b0..f281e0f 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -471,7 +471,7 @@ int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
struct hlist_node *node;
int dumped = 0;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return 0;
if (NLMSG_PAYLOAD(cb->nlh, 0) >= sizeof(struct rtmsg) &&
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 5966798..29b4931 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -612,7 +612,7 @@ static int econet_create(struct net *net, struct socket *sock, int protocol,
struct econet_sock *eo;
int err;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
/* Econet only provides datagram services. */
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index de6e34d..bad1c49 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -241,7 +241,7 @@ static int ieee802154_create(struct net *net, struct socket *sock,
struct proto *proto;
const struct proto_ops *ops;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
switch (sock->type) {
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7620382..c100709 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1605,7 +1605,7 @@ static __net_init int devinet_init_net(struct net *net)
all = &ipv4_devconf;
dflt = &ipv4_devconf_dflt;
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
all = kmemdup(all, sizeof(ipv4_devconf), GFP_KERNEL);
if (all == NULL)
goto err_alloc_all;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 9b096d6..ed19aa6 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -228,7 +228,7 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi)
head = &fib_info_hash[hash];
hlist_for_each_entry(fi, node, head, fib_hash) {
- if (fi->fib_net != nfi->fib_net)
+ if (!net_eq(fi->fib_net, nfi->fib_net))
continue;
if (fi->fib_nhs != nfi->fib_nhs)
continue;
@@ -1047,7 +1047,7 @@ int fib_sync_down_addr(struct net *net, __be32 local)
return 0;
hlist_for_each_entry(fi, node, head, fib_lhash) {
- if (fi->fib_net != net)
+ if (!net_eq(fi->fib_net, net))
continue;
if (fi->fib_prefsrc == local) {
fi->fib_flags |= RTNH_F_DEAD;
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 26fb50e..9b35c56 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -112,7 +112,7 @@ again:
hashinfo->bhash_size)];
spin_lock(&head->lock);
inet_bind_bucket_for_each(tb, node, &head->chain)
- if (ib_net(tb) == net && tb->port == rover) {
+ if (net_eq(ib_net(tb), net) && tb->port == rover) {
if (tb->fastreuse > 0 &&
sk->sk_reuse &&
sk->sk_state != TCP_LISTEN &&
@@ -158,7 +158,7 @@ have_snum:
hashinfo->bhash_size)];
spin_lock(&head->lock);
inet_bind_bucket_for_each(tb, node, &head->chain)
- if (ib_net(tb) == net && tb->port == snum)
+ if (net_eq(ib_net(tb), net) && tb->port == snum)
goto tb_found;
}
tb = NULL;
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 47ad7aa..94ef51a 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -454,7 +454,8 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
* unique enough.
*/
inet_bind_bucket_for_each(tb, node, &head->chain) {
- if (ib_net(tb) == net && tb->port == port) {
+ if (net_eq(ib_net(tb), net) &&
+ tb->port == port) {
if (tb->fastreuse >= 0)
goto next_port;
WARN_ON(hlist_empty(&tb->owners));
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index b007f8a..1472d8e 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -658,7 +658,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
struct ctl_table_header *hdr;
table = ip4_frags_ns_ctl_table;
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
table = kmemdup(table, sizeof(ip4_frags_ns_ctl_table), GFP_KERNEL);
if (table == NULL)
goto err_alloc;
@@ -676,7 +676,7 @@ static int ip4_frags_ns_ctl_register(struct net *net)
return 0;
err_reg:
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
kfree(table);
err_alloc:
return -ENOMEM;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index fdf51ba..c29de98 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -164,7 +164,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
if (sk && inet_sk(sk)->inet_num == protocol &&
(!sk->sk_bound_dev_if ||
sk->sk_bound_dev_if == dev->ifindex) &&
- sock_net(sk) == dev_net(dev)) {
+ net_eq(sock_net(sk), dev_net(dev))) {
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
read_unlock(&ip_ra_lock);
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index c156db2..884f085 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -500,7 +500,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
if (event == NETLINK_URELEASE &&
n->protocol == NETLINK_FIREWALL && n->pid) {
write_lock_bh(&queue_lock);
- if ((n->net == &init_net) && (n->pid == peer_pid))
+ if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
__ipq_reset();
write_unlock_bh(&queue_lock);
}
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 7547944..aea7bb3 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -703,7 +703,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
{
- return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev);
+ return net_eq(dev_net(rt1->u.dst.dev), dev_net(rt2->u.dst.dev));
}
static inline int rt_is_expired(struct rtable *rth)
@@ -3310,7 +3310,7 @@ static __net_init int sysctl_route_net_init(struct net *net)
struct ctl_table *tbl;
tbl = ipv4_route_flush_table;
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL);
if (tbl == NULL)
goto err_dup;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 2dcf04d..c00323b 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -818,7 +818,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
struct ctl_table *table;
table = ipv4_net_table;
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL);
if (table == NULL)
goto err_alloc;
@@ -849,7 +849,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
return 0;
err_reg:
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
kfree(table);
err_alloc:
return -ENOMEM;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 522bdc7..b1ce8fc 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4498,7 +4498,7 @@ static int addrconf_init_net(struct net *net)
all = &ipv6_devconf;
dflt = &ipv6_devconf_dflt;
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
all = kmemdup(all, sizeof(ipv6_devconf), GFP_KERNEL);
if (all == NULL)
goto err_alloc_all;
@@ -4546,7 +4546,7 @@ static void addrconf_exit_net(struct net *net)
__addrconf_sysctl_unregister(net->ipv6.devconf_dflt);
__addrconf_sysctl_unregister(net->ipv6.devconf_all);
#endif
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
kfree(net->ipv6.devconf_dflt);
kfree(net->ipv6.devconf_all);
}
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 593a67e..6e7bffa 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -67,7 +67,7 @@ static inline struct ip6_flowlabel *__fl_lookup(struct net *net, __be32 label)
struct ip6_flowlabel *fl;
for (fl=fl_ht[FL_HASH(label)]; fl; fl = fl->next) {
- if (fl->label == label && fl->fl_net == net)
+ if (fl->label == label && net_eq(fl->fl_net, net))
return fl;
}
return NULL;
@@ -163,7 +163,8 @@ static void ip6_fl_purge(struct net *net)
struct ip6_flowlabel *fl, **flp;
flp = &fl_ht[i];
while ((fl = *flp) != NULL) {
- if (fl->fl_net == net && atomic_read(&fl->users) == 0) {
+ if (net_eq(fl->fl_net, net) &&
+ atomic_read(&fl->users) == 0) {
*flp = fl->next;
fl_free(fl);
atomic_dec(&fl_size);
@@ -630,7 +631,7 @@ static struct ip6_flowlabel *ip6fl_get_first(struct seq_file *seq)
for (state->bucket = 0; state->bucket <= FL_HASH_MASK; ++state->bucket) {
fl = fl_ht[state->bucket];
- while (fl && fl->fl_net != net)
+ while (fl && !net_eq(fl->fl_net, net))
fl = fl->next;
if (fl)
break;
@@ -645,7 +646,7 @@ static struct ip6_flowlabel *ip6fl_get_next(struct seq_file *seq, struct ip6_flo
fl = fl->next;
try_again:
- while (fl && fl->fl_net != net)
+ while (fl && !net_eq(fl->fl_net, net))
fl = fl->next;
while (!fl) {
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 1cf3f0c..4c7a18a 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -502,7 +502,7 @@ ipq_rcv_nl_event(struct notifier_block *this,
if (event == NETLINK_URELEASE &&
n->protocol == NETLINK_IP6_FW && n->pid) {
write_lock_bh(&queue_lock);
- if ((n->net == &init_net) && (n->pid == peer_pid))
+ if ((net_eq(n->net, &init_net)) && (n->pid == peer_pid))
__ipq_reset();
write_unlock_bh(&queue_lock);
}
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index dce699f..45efc39 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -681,7 +681,7 @@ static int ip6_frags_ns_sysctl_register(struct net *net)
struct ctl_table_header *hdr;
table = ip6_frags_ns_ctl_table;
- if (net != &init_net) {
+ if (!net_eq(net, &init_net)) {
table = kmemdup(table, sizeof(ip6_frags_ns_ctl_table), GFP_KERNEL);
if (table == NULL)
goto err_alloc;
@@ -699,7 +699,7 @@ static int ip6_frags_ns_sysctl_register(struct net *net)
return 0;
err_reg:
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
kfree(table);
err_alloc:
return -ENOMEM;
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c
index 975c5a3..f9759b5 100644
--- a/net/ipx/af_ipx.c
+++ b/net/ipx/af_ipx.c
@@ -1362,7 +1362,7 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol,
int rc = -ESOCKTNOSUPPORT;
struct sock *sk;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
/*
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 5266c28..3a66546 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -158,7 +158,7 @@ static int llc_ui_create(struct net *net, struct socket *sock, int protocol,
if (!capable(CAP_NET_RAW))
return -EPERM;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) {
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index f900dc3..4900548 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -678,7 +678,7 @@ nfulnl_rcv_nl_event(struct notifier_block *this,
struct hlist_head *head = &instance_table[i];
hlist_for_each_entry_safe(inst, tmp, t2, head, hlist) {
- if ((n->net == &init_net) &&
+ if ((net_eq(n->net, &init_net)) &&
(n->pid == inst->peer_pid))
__instance_destroy(inst);
}
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index eff5b0d..a4957bf 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1092,7 +1092,7 @@ static inline int do_one_set_err(struct sock *sk,
if (sk == p->exclude_sk)
goto out;
- if (sock_net(sk) != sock_net(p->exclude_sk))
+ if (!net_eq(sock_net(sk), sock_net(p->exclude_sk)))
goto out;
if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups ||
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 4bdd569..71604c6 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -431,7 +431,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol,
struct sock *sk;
struct nr_sock *nr;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
if (sock->type != SOCK_SEQPACKET || protocol != 0)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c620bd9..940fc20 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -365,7 +365,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev,
if (skb->pkt_type == PACKET_LOOPBACK)
goto out;
- if (dev_net(dev) != sock_net(sk))
+ if (!net_eq(dev_net(dev), sock_net(sk)))
goto out;
skb = skb_share_check(skb, GFP_ATOMIC);
@@ -553,7 +553,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev,
sk = pt->af_packet_priv;
po = pkt_sk(sk);
- if (dev_net(dev) != sock_net(sk))
+ if (!net_eq(dev_net(dev), sock_net(sk)))
goto drop;
skb->dev = dev;
@@ -674,7 +674,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
sk = pt->af_packet_priv;
po = pkt_sk(sk);
- if (dev_net(dev) != sock_net(sk))
+ if (!net_eq(dev_net(dev), sock_net(sk)))
goto drop;
if (dev->header_ops) {
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index 4de4287..8feb9e5 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -518,7 +518,7 @@ static int rose_create(struct net *net, struct socket *sock, int protocol,
struct sock *sk;
struct rose_sock *rose;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
if (sock->type != SOCK_SEQPACKET || protocol != 0)
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index f978d02..287b141 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -616,7 +616,7 @@ static int rxrpc_create(struct net *net, struct socket *sock, int protocol,
_enter("%p,%d", sock, protocol);
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
/* we support transport protocol UDP only */
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ca2e1fd..2a74003 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -969,7 +969,7 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
u32 pid = skb ? NETLINK_CB(skb).pid : 0;
int ret = 0, ovr = 0;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
ret = nlmsg_parse(n, sizeof(struct tcamsg), tca, TCA_ACT_MAX, NULL);
@@ -1052,7 +1052,7 @@ tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb)
struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
struct nlattr *kind = find_dump_kind(cb->nlh);
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return 0;
if (kind == NULL) {
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index c024da7..3725d8f 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -137,7 +137,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
int err;
int tp_created = 0;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
replay:
@@ -418,7 +418,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
const struct Qdisc_class_ops *cops;
struct tcf_dump_args arg;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return 0;
if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 876ba4b..75fd1c6 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -947,7 +947,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
struct Qdisc *p = NULL;
int err;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
@@ -1009,7 +1009,7 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
struct Qdisc *q, *p;
int err;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
replay:
@@ -1274,7 +1274,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
int s_idx, s_q_idx;
struct net_device *dev;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return 0;
s_idx = cb->args[0];
@@ -1334,7 +1334,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
u32 qid = TC_H_MAJ(clid);
int err;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EINVAL;
if ((dev = __dev_get_by_index(&init_net, tcm->tcm_ifindex)) == NULL)
@@ -1576,7 +1576,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
struct net_device *dev;
int t, s_t;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return 0;
if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index d00c211..eca5eb0 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -195,7 +195,7 @@ static int tipc_create(struct net *net, struct socket *sock, int protocol,
/* Validate arguments */
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
if (unlikely(protocol != 0))
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
index ac7dba4..2a3a513 100644
--- a/net/x25/af_x25.c
+++ b/net/x25/af_x25.c
@@ -514,7 +514,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,
struct x25_sock *x25;
int rc = -ESOCKTNOSUPPORT;
- if (net != &init_net)
+ if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;
if (sock->type != SOCK_SEQPACKET || protocol)
--
1.5.6.5
^ permalink raw reply related
* Re: [PATCH] b44.c box lockup fix (netconsole): ratelimit NAPI poll error message
From: David Miller @ 2009-11-25 22:56 UTC (permalink / raw)
To: andi; +Cc: zambrano, dave, mb, netdev, linux-kernel
In-Reply-To: <20091125213546.GA6168@rhlx01.hs-esslingen.de>
From: Andreas Mohr <andi@lisas.de>
Date: Wed, 25 Nov 2009 22:35:46 +0100
> Turns out that it's not very helpful to have a netconsole-deployed
> network driver's interrupt handler message spew noise permanently
> (see comment in patch).
It's not even an illegal state, especially with shared interrupts.
The warning should never be emitted.
^ permalink raw reply
* Re: [PATCH net-next-2.6] net: use net_eq to compare nets
From: David Miller @ 2009-11-25 23:14 UTC (permalink / raw)
To: opurdila; +Cc: netdev, julia
In-Reply-To: <200911260051.17430.opurdila@ixiacom.com>
From: Octavian Purdila <opurdila@ixiacom.com>
Date: Thu, 26 Nov 2009 00:51:17 +0200
> Signed-off-by: Octavian Purdila <opurdila@ixiacom.com>
Applied, thanks.
^ permalink raw reply
* Re: how expensive are mallocs?
From: David Miller @ 2009-11-25 23:18 UTC (permalink / raw)
To: andy.grover; +Cc: netdev
In-Reply-To: <c0a09e5c0911240957x45abfb26k1611e53f435e5179@mail.gmail.com>
From: Andrew Grover <andy.grover@gmail.com>
Date: Tue, 24 Nov 2009 09:57:34 -0800
> How much effort generally makes sense to avoid mallocs? For example,
> rds has a function that does a kmalloc for an array of scatterlist
> entries, which is freed at the bottom of the function. We couldn't
> allocate off the stack in all cases (too big), but we could allocate
> an array of say 8 scatterlists, and use it if that's big enough,
> falling back to kmalloc if it's not.
>
> Is this a good idea?
This is a poor idea, especially if this function executes frequently.
Better to have a per-socket or per-cpu (softirq protected, if
necessary) work area to do such things if you really can't fit it on
the stack.
> Also, RDS has its own per-cpu page remainder allocator (see
> net/rds/page.c) for kernel send buffers. Would cutting this code and
> just using kmalloc be recommended? Doesn't SL?B already do per-cpu
> pools?
>
> Does this stuff even matter enough to rise above the noise in benchmarks?
We already have a per-socket page allocation scheme for sendmsg handling.
In general adding more and more specialized allocators is heavily
discouraged. If the generic kernel facilities don't fit the bill,
fix them.
^ permalink raw reply
* Re: [rfc 1/3 v2] [E1000-devel] [rfc 1/4] igb: Add igb_cleanup_vf()
From: Simon Horman @ 2009-11-25 23:26 UTC (permalink / raw)
To: Alexander Duyck
Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
Arnd Bergmann, Kirsher, Jeffrey T
In-Reply-To: <4B0DAF55.4060400@intel.com>
On Wed, Nov 25, 2009 at 02:27:33PM -0800, Alexander Duyck wrote:
> Simon Horman wrote:
> >Move virtual finction cleanup code into igb_cleanup_vf() and for the sake
> >of symmetry rename igb_probe_vfs() as igb_init_vf().
> >
> >Although these functions aren't entirely symmetrical it should aid
> >maintenance by making the relationship between initialisation and cleanup
> >more obvious.
> >
> >Note that there appears to be no way for adapter->vfs_allocated_count to be
> >non-zero for the case where CONFIG_PCI_IOV is not set, so reseting this
> >value was moved to inside the relvant #ifdef.
> >
> >Signed-off-by: Simon Horman <horms@verge.net.au>
>
> The one thing I noticed with this patch is that it didn't remove the
> vf cleanup from igb_remove. You may want to go back and also add
> the replacement of that function with igb_cleanup_vf to this patch.
Ooops, yes that would be a good idea.
I'll send a revised patch after testing it.
^ permalink raw reply
* Re: [rfc 2/3 v2] [E1000-devel] [rfc 3/4] igb: Common error path in igb_init_vfs()
From: Simon Horman @ 2009-11-25 23:27 UTC (permalink / raw)
To: Alexander Duyck
Cc: e1000-devel@lists.sourceforge.net, netdev@vger.kernel.org,
Arnd Bergmann, Kirsher, Jeffrey T
In-Reply-To: <4B0DB12C.3030709@intel.com>
On Wed, Nov 25, 2009 at 02:35:24PM -0800, Alexander Duyck wrote:
> Simon Horman wrote:
> >Drop out into an error path on error.
> >
> >This is a bit superfluous as things stand, though arguably
> >it already makes the code cleaner. But it should help things a lot
> >if igb_init_vfs() has a several things to unwind on error.
> >
> >This patch eliminates resetting adapter->vfs_allocated_count to 0
> >in the case where CONFIG_PCI_IOV is not set, because in that
> >case adapter->vfs_allocated_count can never be non-zero.
> >
> >Signed-off-by: Simon Horman <horms@verge.net.au>
> >
> >--- Thu, 05 Nov 2009 11:58:50 +1100
> >* Initial post
> >
> >Wed, 25 Nov 2009 16:44:15 +1100
> >* Merged with " Initialise adapter->vfs_allocated_count in igb_init_vf()",
> > however the initialisation of adapter->vfs_allocated_count is no
> > longer moved into igb_init_vf() as doing so results in a panic.
> >
> >Index: net-next-2.6/drivers/net/igb/igb_main.c
> >===================================================================
> >--- net-next-2.6.orig/drivers/net/igb/igb_main.c 2009-11-25 17:05:43.000000000 +1100
> >+++ net-next-2.6/drivers/net/igb/igb_main.c 2009-11-25 17:05:44.000000000 +1100
> >@@ -1753,38 +1753,37 @@ static void __devinit igb_init_vf(struct
> > {
> > #ifdef CONFIG_PCI_IOV
> > struct pci_dev *pdev = adapter->pdev;
> >+ unsigned char mac_addr[ETH_ALEN];
> >+ int i;
> > if (adapter->vfs_allocated_count > 7)
> > adapter->vfs_allocated_count = 7;
> >- if (adapter->vfs_allocated_count) {
> >- adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
> >- sizeof(struct vf_data_storage),
> >- GFP_KERNEL);
> >- /* if allocation failed then we do not support SR-IOV */
> >- if (!adapter->vf_data) {
> >- adapter->vfs_allocated_count = 0;
> >- dev_err(&pdev->dev, "Unable to allocate memory for VF "
> >- "Data Storage\n");
> >- }
> >+ adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
> >+ sizeof(struct vf_data_storage), GFP_KERNEL);
> >+ /* if allocation failed then we do not support SR-IOV */
> >+ if (!adapter->vf_data) {
> >+ dev_err(&pdev->dev, "Unable to allocate memory for VF "
> >+ "Data Storage\n");
> >+ goto err_zero;
> > }
> The only issue I see with the changes above is that if SR-IOV is not
> enabled via the max_vfs option you will end up returning an error
> even though there is nothing wrong. You might want to go and keep
> the if statement near the start and do something like:
> if (!adapter->vfs_allocated_count)
> goto err_zero;
>
> This way you can avoid the false error report.
Good idea, I will add that.
> >- if (pci_enable_sriov(pdev, adapter->vfs_allocated_count)) {
> >- kfree(adapter->vf_data);
> >- adapter->vf_data = NULL;
> >-#endif /* CONFIG_PCI_IOV */
> >- adapter->vfs_allocated_count = 0;
> >-#ifdef CONFIG_PCI_IOV
> >- } else {
> >- unsigned char mac_addr[ETH_ALEN];
> >- int i;
> >- dev_info(&pdev->dev, "%d vfs allocated\n",
> >- adapter->vfs_allocated_count);
> >- for (i = 0; i < adapter->vfs_allocated_count; i++) {
> >- random_ether_addr(mac_addr);
> >- igb_set_vf_mac(adapter, i, mac_addr);
> >- }
> >+ if (pci_enable_sriov(pdev, adapter->vfs_allocated_count))
> >+ goto err_free;
> >+
> >+ dev_info(&pdev->dev, "%d vfs allocated\n",
> >+ adapter->vfs_allocated_count);
> >+ for (i = 0; i < adapter->vfs_allocated_count; i++) {
> >+ random_ether_addr(mac_addr);
> >+ igb_set_vf_mac(adapter, i, mac_addr);
> > }
> >+
> >+ return;
> >+err_free:
> >+ kfree(adapter->vf_data);
> >+err_zero:
> >+ adapter->vf_data = NULL;
> >+ adapter->vfs_allocated_count = 0;
> > #endif /* CONFIG_PCI_IOV */
> > }
> >
>
> My preference here would be to bump the #endif up two lines so that
> adapter->vf_data = NULL and adapter->vfs_allocated_count = 0 are ran
> in the non-iov case. That way we know that SR-IOV is explicitly
> disabled.
I'm not sure that its necessary but it certainly does seem to be
a clean and safe way to handle things. I'll update the patch.
^ permalink raw reply
* Re: [PATCH v3 5/7] via-velocity: Re-enable transmit scatter-gather support
From: David Miller @ 2009-11-25 23:37 UTC (permalink / raw)
To: simon.kagstrom; +Cc: netdev, davej, shemminger, romieu
In-Reply-To: <20091125092213.423d0dd7@marrow.netinsight.se>
From: Simon Kagstrom <simon.kagstrom@netinsight.net>
Date: Wed, 25 Nov 2009 09:22:13 +0100
> The velocity hardware can handle up to 7 memory segments. This can be
> turned on and off via ethtool. The support was removed in commit
>
> 83c98a8cd04dd0f848574370594886ba3bf56750
>
> but is re-enabled and cleaned up here. It's off by default.
>
> Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
> ---
> ChangeLog:
>
> * (David Miller) return NETDEV_TX_OK from the velocity_xmit
> function. I'm still a bit unsure on what to actually return in
> these cases (they are error cases), but other drivers seem to
> return NETDEV_TX_OK, so that's what I went with.
This still isn't right, sorry.
If you return NETDEV_TX_OK you must free the packet up, either
immediately or in response to the TX interrupt which finishes the
sending of the TX packet.
The case where you aren't getting this right:
+ /* If it's still above 6 we can't do anything */
+ if (skb_shinfo(skb)->nr_frags > 6) {
+ dev_err(&vptr->pdev->dev,
+ "via-velocity: more than 6 frags, can't send.\n");
+ return NETDEV_TX_OK;
+ }
is bogus because you just did __skb_linearize() and it returned zero, therefore
it would be illegal to see ->nr_frags with a > 6 value here.
Just remove this check and block of code entirely.
^ permalink raw reply
* Re: [PATCH] net: convert /proc/net/rt_acct to seq_file
From: David Miller @ 2009-11-25 23:40 UTC (permalink / raw)
To: adobriyan; +Cc: netdev
In-Reply-To: <20091125074547.GA3467@x200.malnet.ru>
From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Wed, 25 Nov 2009 10:45:47 +0300
> Rewrite statistics accumulation to be in terms of structure fields,
> not raw u32 additions. Keep them in same order, though.
>
> This is the last user of create_proc_read_entry() in net/,
> please NAK all new ones as well as all new ->write_proc, ->read_proc and
> create_proc_entry() users. Cc me if there are problems. :-)
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Applied, thanks Alexey.
^ permalink raw reply
* Re: [Bugme-new] [Bug 14688] New: alignment of rx_skb in r8169 driver
From: David Miller @ 2009-11-25 23:45 UTC (permalink / raw)
To: akpm; +Cc: meyer, bugzilla-daemon, bugme-daemon, romieu, netdev
In-Reply-To: <20091125135507.2160a534.akpm@linux-foundation.org>
From: Andrew Morton <akpm@linux-foundation.org>
Date: Wed, 25 Nov 2009 13:55:07 -0800
>> (align - 1) & (unsigned long)skb->data
>>
>> which is wrong. I would suggest the following correction:
>>
>> pad = align ? align - ((align - 1) & (unsigned long)skb->data) : NET_IP_ALIGN;
>> if (pad == align) pad = 0; // optional
>> skb_reserve(skb, pad);
>>
>> A patch for r8169.c is provided as attachment.
>>
>
> Thanks, but..
>
> - please always submit patches via email, not via bugzilla.
> Documentation/SubmittingPatches goes into some detail.
>
> - prepare patches as a unified diff, in `patch -p1' form. It should
> look like:
...
> - Please cc at least the following on the patch:
>
> Francois Romieu <romieu@fr.zoreil.com>
> "David S. Miller" <davem@davemloft.net>
> netdev@vger.kernel.org
>
> - Don't forget the changelog and a Singed-off-by:!
> --
> 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
Also a better, more canonical, expression to use to fix this would
be:
align - ((align - 1) & (unsigned long)skb->data)
or similar.
^ permalink raw reply
* Re: [PATCH] xfrm: Add SHA384 and SHA512 HMAC authentication algorithms to XFRM
From: David Miller @ 2009-11-25 23:49 UTC (permalink / raw)
To: herbert; +Cc: martin, linux-crypto, netdev
In-Reply-To: <20091125121140.GB28385@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 25 Nov 2009 20:11:40 +0800
> On Wed, Nov 25, 2009 at 11:58:39AM +0100, Martin Willi wrote:
>> These algorithms use a truncation of 192/256 bits, as specified
>> in RFC4868.
>>
>> Signed-off-by: Martin Willi <martin@strongswan.org>
>
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Applied to net-next-2.6
^ permalink raw reply
* Re: [PATCH 0/3] xfrm: Custom truncation lengths for authentication algorithms
From: David Miller @ 2009-11-25 23:48 UTC (permalink / raw)
To: martin; +Cc: herbert, linux-crypto, netdev
In-Reply-To: <cover.1259142145.git.martin@strongswan.org>
From: Martin Willi <martin@strongswan.org>
Date: Wed, 25 Nov 2009 11:29:50 +0100
> The following patchset adds support for defining truncation lengths
> for authentication algorithms in userspace. The main purpose for this
> is to support SHA256 in IPsec using the standardized 128 bit
> instead of the currently used 96 bit truncation.
>
> Martin Willi (3):
> xfrm: Define new XFRM netlink auth attribute with specified
> truncation bits
> xfrm: Store aalg in xfrm_state with a user specified truncation
> length
> xfrm: Use the user specified truncation length in ESP and AH
All applied to net-next-2.6, thanks!
^ permalink raw reply
* Re: [PATCH] r8169: move PHY regs tables to .rodata
From: David Miller @ 2009-11-25 23:55 UTC (permalink / raw)
To: adobriyan; +Cc: netdev
In-Reply-To: <20091125213933.GA3455@x200.malnet.ru>
From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Thu, 26 Nov 2009 00:39:34 +0300
> As side effect, consume less stack.
>
> -rtl8169_get_mac_version [vmlinux]: 432
> -rtl8169_init_one [vmlinux]: 376
> +rtl8169_init_one [vmlinux]: 136
>
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
There are a lot of differences in the tables in net-next-2.6's copy
of this driver, so I had to munge this a lot and do some things by
hand to apply it properly.
So, applied... but please always submit networking changes against the
proper tree, thanks.
^ permalink raw reply
* [rfc 0/3 v3] igb: bandwidth allocation
From: Simon Horman @ 2009-11-26 0:05 UTC (permalink / raw)
To: e1000-devel, netdev; +Cc: Arnd Bergmann, Jeff Kirsher
this series of patches exposes the bandwidth allocation hardware support of
the Intel 82576. It does so through a rather hackish sysfs entry. That
interface is just intended for testing so that the exposed hardware feature
can be exercised. I would like to find a generic way to expose this feature
to user-space.
v2
* Remove the patch "Initialise adapter->vfs_allocated_count in
igb_init_vf()" as it causes a panic.
v3
* Incorporate several suggestions from Alexander Duyck
as noted in the per-patch changelogs
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
^ permalink raw reply
* [rfc 1/3 v3] [E1000-devel] [rfc 1/4] igb: Add igb_cleanup_vf()
From: Simon Horman @ 2009-11-26 0:05 UTC (permalink / raw)
To: e1000-devel, netdev; +Cc: Arnd Bergmann, Alexander Duyck, Jeff Kirsher
In-Reply-To: <20091126000538.716725330@vergenet.net>
[-- Attachment #1: igb-add-igb_cleanup-vf.patch --]
[-- Type: text/plain, Size: 4635 bytes --]
Move virtual function cleanup code into igb_cleanup_vf() and for the sake
of symmetry rename igb_probe_vfs() as igb_init_vf().
Although these functions aren't entirely symmetrical it should aid
maintenance by making the relationship between initialisation and cleanup
more obvious.
Cc: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
Thu, 05 Nov 2009 11:58:48 +1100
* Initial post
Wed, 25 Nov 2009 15:43:45 +1100
* Actually remove adapter->vfs_allocated_count = 0 from outside of
igb_cleanup_vf()
* Up-port to current net-next
Thu, 26 Nov 2009 10:29:02 +1100
As per suggestion from Alexander Duyck
* Use igb_cleanup_vf() in igb_remove()
Index: net-next-2.6/drivers/net/igb/igb_main.c
===================================================================
--- net-next-2.6.orig/drivers/net/igb/igb_main.c 2009-11-26 10:31:13.000000000 +1100
+++ net-next-2.6/drivers/net/igb/igb_main.c 2009-11-26 10:32:02.000000000 +1100
@@ -92,6 +92,7 @@ void igb_update_stats(struct igb_adapter
static int igb_probe(struct pci_dev *, const struct pci_device_id *);
static void __devexit igb_remove(struct pci_dev *pdev);
static int igb_sw_init(struct igb_adapter *);
+static void igb_cleanup_vf(struct igb_adapter * adapter);
static int igb_open(struct net_device *);
static int igb_close(struct net_device *);
static void igb_configure_tx(struct igb_adapter *);
@@ -701,22 +702,7 @@ static void igb_set_interrupt_capability
/* If we can't do MSI-X, try MSI */
msi_only:
-#ifdef CONFIG_PCI_IOV
- /* disable SR-IOV for non MSI-X configurations */
- if (adapter->vf_data) {
- struct e1000_hw *hw = &adapter->hw;
- /* disable iov and allow time for transactions to clear */
- pci_disable_sriov(adapter->pdev);
- msleep(500);
-
- kfree(adapter->vf_data);
- adapter->vf_data = NULL;
- wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
- msleep(100);
- dev_info(&adapter->pdev->dev, "IOV Disabled\n");
- }
-#endif
- adapter->vfs_allocated_count = 0;
+ igb_cleanup_vf(adapter);
adapter->rss_queues = 1;
adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
adapter->num_rx_queues = 1;
@@ -1725,21 +1711,7 @@ static void __devexit igb_remove(struct
igb_reset_phy(hw);
igb_clear_interrupt_scheme(adapter);
-
-#ifdef CONFIG_PCI_IOV
- /* reclaim resources allocated to VFs */
- if (adapter->vf_data) {
- /* disable iov and allow time for transactions to clear */
- pci_disable_sriov(pdev);
- msleep(500);
-
- kfree(adapter->vf_data);
- adapter->vf_data = NULL;
- wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
- msleep(100);
- dev_info(&pdev->dev, "IOV Disabled\n");
- }
-#endif
+ igb_cleanup_vf(adapter);
iounmap(hw->hw_addr);
if (hw->flash_address)
@@ -1755,7 +1727,7 @@ static void __devexit igb_remove(struct
}
/**
- * igb_probe_vfs - Initialize vf data storage and add VFs to pci config space
+ * igb_init_vf - Initialize vf data storage and add VFs to pci config space
* @adapter: board private structure to initialize
*
* This function initializes the vf specific data storage and then attempts to
@@ -1763,7 +1735,7 @@ static void __devexit igb_remove(struct
* mor expensive time wise to disable SR-IOV than it is to allocate and free
* the memory for the VFs.
**/
-static void __devinit igb_probe_vfs(struct igb_adapter * adapter)
+static void __devinit igb_init_vf(struct igb_adapter * adapter)
{
#ifdef CONFIG_PCI_IOV
struct pci_dev *pdev = adapter->pdev;
@@ -1909,6 +1881,35 @@ static void igb_init_hw_timer(struct igb
}
/**
+ * igb_cleanup_vf - Clean up vf data and remove vfs from pci config space
+ * @adapter: board private structure to initialize
+ *
+ * This function cleans-up the vf specific data storage and then attempts to
+ * deallocate the VFs.
+ **/
+static void igb_cleanup_vf(struct igb_adapter * adapter)
+{
+#ifdef CONFIG_PCI_IOV
+ struct e1000_hw *hw = &adapter->hw;
+
+ if (!adapter->vf_data)
+ return;
+
+ /* disable iov and allow time for transactions to clear */
+ pci_disable_sriov(adapter->pdev);
+ msleep(500);
+
+ kfree(adapter->vf_data);
+ adapter->vf_data = NULL;
+ adapter->vfs_allocated_count = 0;
+
+ wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
+ msleep(100);
+ dev_info(&adapter->pdev->dev, "IOV Disabled\n");
+#endif
+}
+
+/**
* igb_sw_init - Initialize general software structures (struct igb_adapter)
* @adapter: board private structure to initialize
*
@@ -1955,7 +1956,7 @@ static int __devinit igb_sw_init(struct
}
igb_init_hw_timer(adapter);
- igb_probe_vfs(adapter);
+ igb_init_vf(adapter);
/* Explicitly disable IRQ since the NIC can be in any state. */
igb_irq_disable(adapter);
^ permalink raw reply
* [rfc 2/3 v3] [E1000-devel] [rfc 3/4] igb: Common error path in igb_init_vfs()
From: Simon Horman @ 2009-11-26 0:05 UTC (permalink / raw)
To: e1000-devel, netdev; +Cc: Arnd Bergmann, Alexander Duyck, Jeff Kirsher
In-Reply-To: <20091126000538.716725330@vergenet.net>
[-- Attachment #1: igb-common-error-path-in-igb_init_vfs.2.patch --]
[-- Type: text/plain, Size: 3297 bytes --]
Drop out into an error path on error.
This is a bit superfluous as things stand, though arguably
it already makes the code cleaner. But it should help things a lot
if igb_init_vfs() has a several things to unwind on error.
This patch eliminates resetting adapter->vfs_allocated_count to 0
in the case where CONFIG_PCI_IOV is not set, because in that
case adapter->vfs_allocated_count can never be non-zero.
Cc: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
Thu, 05 Nov 2009 11:58:50 +1100
* Initial post
Wed, 25 Nov 2009 16:44:15 +1100
* Merged with " Initialise adapter->vfs_allocated_count in igb_init_vf()",
however the initialisation of adapter->vfs_allocated_count is no
longer moved into igb_init_vf() as doing so results in a panic.
Thu, 26 Nov 2009 10:29:02 +1100
As per suggestions from Alexander Duyck
* Don't try and allocate vf_data if there are no vfs
* Zero out vfs_allocated_count and vf_data in the
non CONFIG_PCI_IOV case, just to be sure.
Index: net-next-2.6/drivers/net/igb/igb_main.c
===================================================================
--- net-next-2.6.orig/drivers/net/igb/igb_main.c 2009-11-26 10:21:58.000000000 +1100
+++ net-next-2.6/drivers/net/igb/igb_main.c 2009-11-26 10:23:50.000000000 +1100
@@ -1753,39 +1753,41 @@ static void __devinit igb_init_vf(struct
{
#ifdef CONFIG_PCI_IOV
struct pci_dev *pdev = adapter->pdev;
+ unsigned char mac_addr[ETH_ALEN];
+ int i;
+
+ if (!adapter->vfs_allocated_count)
+ goto err_zero;
if (adapter->vfs_allocated_count > 7)
adapter->vfs_allocated_count = 7;
- if (adapter->vfs_allocated_count) {
- adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
- sizeof(struct vf_data_storage),
- GFP_KERNEL);
- /* if allocation failed then we do not support SR-IOV */
- if (!adapter->vf_data) {
- adapter->vfs_allocated_count = 0;
- dev_err(&pdev->dev, "Unable to allocate memory for VF "
- "Data Storage\n");
- }
+ adapter->vf_data = kcalloc(adapter->vfs_allocated_count,
+ sizeof(struct vf_data_storage), GFP_KERNEL);
+ /* if allocation failed then we do not support SR-IOV */
+ if (!adapter->vf_data) {
+ dev_err(&pdev->dev, "Unable to allocate memory for VF "
+ "Data Storage\n");
+ goto err_zero;
}
- if (pci_enable_sriov(pdev, adapter->vfs_allocated_count)) {
- kfree(adapter->vf_data);
- adapter->vf_data = NULL;
-#endif /* CONFIG_PCI_IOV */
- adapter->vfs_allocated_count = 0;
-#ifdef CONFIG_PCI_IOV
- } else {
- unsigned char mac_addr[ETH_ALEN];
- int i;
- dev_info(&pdev->dev, "%d vfs allocated\n",
- adapter->vfs_allocated_count);
- for (i = 0; i < adapter->vfs_allocated_count; i++) {
- random_ether_addr(mac_addr);
- igb_set_vf_mac(adapter, i, mac_addr);
- }
+ if (pci_enable_sriov(pdev, adapter->vfs_allocated_count))
+ goto err_free;
+
+ dev_info(&pdev->dev, "%d vfs allocated\n",
+ adapter->vfs_allocated_count);
+ for (i = 0; i < adapter->vfs_allocated_count; i++) {
+ random_ether_addr(mac_addr);
+ igb_set_vf_mac(adapter, i, mac_addr);
}
+
+ return;
+err_free:
+ kfree(adapter->vf_data);
+err_zero:
#endif /* CONFIG_PCI_IOV */
+ adapter->vf_data = NULL;
+ adapter->vfs_allocated_count = 0;
}
^ permalink raw reply
* [rfc 3/3 v3] [E1000-devel] [rfc 4/4] igb: expose 82576 bandiwidth allocation
From: Simon Horman @ 2009-11-26 0:05 UTC (permalink / raw)
To: e1000-devel, netdev; +Cc: Arnd Bergmann, Alexander Duyck, Jeff Kirsher
In-Reply-To: <20091126000538.716725330@vergenet.net>
[-- Attachment #1: igb-expose-82576-bandwidth-allocation-2.patch --]
[-- Type: text/plain, Size: 12316 bytes --]
The 82576 has support for bandwidth allocation to VFs.
Contrary to the documentation in the 82576 datasheet v2.41 this
appears to work as follows:
* The ratio supplied is always proportional to 1Gbit/s,
regardless of if the link speed.
* The ratio supplied is an upper-bound on bandwidth available
to the VF, not a minimun guarantee
This patch exposes bandwidth control to userspace through a simple
per-device (PF) sysfs file, bandwidth_allocation.
* The file contains a whitespace delimited list of values, one per VF.
* The first value corresponds to the first VF and so on.
* Valid values are integers from 0 to 1000
* A value of 0 indicates that bandwidth_allocation is disabled.
* Other values indicate the allocated bandwidth, in 1/1000ths of a gigabit/s
e.g. The following for a PF with 4 VFs allocates ~20Mbits/ to VF 1,
~100Mbit/s to VF 2, and leave the other 2 VFs with no allocation.
echo "20 100 0 0" > /sys/class/net/eth3/device/bandwidth_allocation
This interface is intended to allow testing of the hardware feature.
There are ongoing discussions about how to expose this feature
to user-space in a more generic way.
Cc: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
Thu, 05 Nov 2009 11:58:51 +1100
* Initial post
Wed, 25 Nov 2009 16:58:23 +1100
* Refresh for changes to proceeding patches in series
* Up-port to latest net-next
Index: net-next-2.6/drivers/net/igb/igb_main.c
===================================================================
--- net-next-2.6.orig/drivers/net/igb/igb_main.c 2009-11-26 10:33:01.000000000 +1100
+++ net-next-2.6/drivers/net/igb/igb_main.c 2009-11-26 10:33:01.000000000 +1100
@@ -47,6 +47,9 @@
#ifdef CONFIG_IGB_DCA
#include <linux/dca.h>
#endif
+#ifdef CONFIG_PCI_IOV
+#include <linux/ctype.h>
+#endif
#include "igb.h"
#define DRV_VERSION "2.1.0-k2"
@@ -157,6 +160,15 @@ static unsigned int max_vfs = 0;
module_param(max_vfs, uint, 0);
MODULE_PARM_DESC(max_vfs, "Maximum number of virtual functions to allocate "
"per physical function");
+
+static ssize_t igb_set_bandwidth_allocation(struct device *,
+ struct device_attribute *,
+ const char *, size_t);
+static ssize_t igb_show_bandwidth_allocation(struct device *,
+ struct device_attribute *,
+ char *);
+DEVICE_ATTR(bandwidth_allocation, S_IRUGO | S_IWUSR,
+ igb_show_bandwidth_allocation, igb_set_bandwidth_allocation);
#endif /* CONFIG_PCI_IOV */
static pci_ers_result_t igb_io_error_detected(struct pci_dev *,
@@ -1760,6 +1772,19 @@ static void __devinit igb_init_vf(struct
if (pci_enable_sriov(pdev, adapter->vfs_allocated_count))
goto err_free;
+ if (device_create_file(&pdev->dev, &dev_attr_bandwidth_allocation))
+ goto err_sriov;
+
+ adapter->bandwidth_allocation = kcalloc(adapter->vfs_allocated_count,
+ sizeof(unsigned int),
+ GFP_KERNEL);
+ if (!adapter->bandwidth_allocation)
+ goto err_file;
+ memset(adapter->bandwidth_allocation,
+ adapter->vfs_allocated_count * sizeof(unsigned int), 0);
+
+ spin_lock_init(&adapter->bandwidth_allocation_lock);
+
dev_info(&pdev->dev, "%d vfs allocated\n",
adapter->vfs_allocated_count);
for (i = 0; i < adapter->vfs_allocated_count; i++) {
@@ -1768,6 +1793,10 @@ static void __devinit igb_init_vf(struct
}
return;
+err_file:
+ device_remove_file(&pdev->dev, &dev_attr_bandwidth_allocation);
+err_sriov:
+ pci_disable_sriov(pdev);
err_free:
kfree(adapter->vf_data);
err_zero:
@@ -1892,6 +1921,7 @@ static void igb_init_hw_timer(struct igb
static void igb_cleanup_vf(struct igb_adapter * adapter)
{
#ifdef CONFIG_PCI_IOV
+ struct pci_dev *pdev = adapter->pdev;
struct e1000_hw *hw = &adapter->hw;
if (!adapter->vf_data)
@@ -1908,6 +1938,9 @@ static void igb_cleanup_vf(struct igb_ad
wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
msleep(100);
dev_info(&adapter->pdev->dev, "IOV Disabled\n");
+
+ device_remove_file(&pdev->dev, &dev_attr_bandwidth_allocation);
+ kfree(adapter->bandwidth_allocation);
#endif
}
@@ -2216,6 +2249,123 @@ void igb_configure_tx_ring(struct igb_ad
wr32(E1000_TXDCTL(reg_idx), txdctl);
}
+#ifdef CONFIG_PCI_IOV
+static void igb_disable_bandwidth_allocation_vf(struct e1000_hw *hw, int vf)
+{
+ wr32(E1000_VMBASEL, vf);
+ wr32(E1000_VMBAC, 0);
+}
+
+static void igb_disable_bandwidth_allocation(struct igb_adapter *adapter)
+{
+ struct e1000_hw *hw = &adapter->hw;
+ int i;
+
+ for (i = 0; i < adapter->vfs_allocated_count; i++)
+ igb_disable_bandwidth_allocation_vf(hw, i);
+}
+
+static void igb_enable_bandwidth_allocation_vf(struct e1000_hw *hw, int vf,
+ unsigned int allocation)
+{
+ u32 rq;
+
+ /* Allocation is expressed as 1000ths of link speed [+]
+ *
+ * rq is calcualted as 1 / (allocation / 1000) = 1000 / allocation
+ *
+ * E1000_VMBAC_RF_INT_SHIFT and E1000_VMBAC_RF_MASK are used
+ * to marshal the result into the desired format: 23 bits of
+ * which 14 are to the right of the decimal point.
+ *
+ * [+] According to the the 82576 v2.41 datasheet rq should
+ * be a ratio of the link speed, however, empirically
+ * it appears to always be a ration of to 1Gbit/s,
+ * even when the link is 100Mbit/s.
+ */
+ rq = ((1000 << E1000_VMBAC_RF_INT_SHIFT) / allocation) &
+ E1000_VMBAC_RF_MASK;
+
+ wr32(E1000_VMBASEL, vf);
+ wr32(E1000_VMBAC, rq|E1000_VMBAC_RC_ENA);
+}
+
+static void igb_enable_bandwidth_allocation(struct igb_adapter *adapter)
+{
+ u32 i, reg;
+ struct e1000_hw *hw = &adapter->hw;
+
+ /* Only enable bandwidth_allocation if it has been set
+ * and the link speed is 100Mbit/s or 1Gbit/s */
+ if (!adapter->bandwidth_allocation ||
+ (adapter->link_speed != SPEED_100 &&
+ adapter->link_speed != SPEED_1000)) {
+ igb_disable_bandwidth_allocation(adapter);
+ return;
+ }
+
+ for (i = 0; i < adapter->vfs_allocated_count; i++) {
+ wr32(E1000_VMBASEL, i);
+ if (adapter->bandwidth_allocation[i])
+ igb_enable_bandwidth_allocation_vf(hw, i,
+ adapter->bandwidth_allocation[i]);
+ else
+ igb_disable_bandwidth_allocation_vf(hw, i);
+
+ /* XXX:
+ *
+ * The 82576 datasheet, section 4.5.11.1.5.1 "Configuring Tx
+ * Bandwidth to VMs" states that the desired setting is:
+ * VMBAMMW.MMW_SIZE = 16 * MSS
+ *
+ * But isn't MSS a property of skbs that are using tso
+ * rather than adapters?
+ *
+ * If so, should we use the maximum value here? */
+ /* XXX: Should this go inside or outside the for loop ? */
+ reg = 64 * 16;
+ wr32(E1000_VMBAMMW, reg);
+ }
+}
+#endif
+
+static void igb_check_bandwidth_allocation(struct igb_adapter *adapter)
+{
+#ifdef CONFIG_PCI_IOV
+ u32 vmbacs;
+ struct e1000_hw *hw = &adapter->hw;
+
+ if (!adapter->vf_data)
+ return;
+
+ /* The 82576 datasheet, section 4.5.11.1.5.2 "Link Speed Change
+ * Procedure" describes the sequence below. However the
+ * SPEED_CHG never seems to be set.
+ */
+ vmbacs = rd32(E1000_VMBACS);
+ if (vmbacs & E1000_VMBACS_SPEED_CHG) {
+ /* XXX: Never seem to get here */
+ int err = 0;
+
+ if (vmbacs & E1000_VMBACS_VMBA_SET) {
+ igb_disable_bandwidth_allocation(adapter);
+ err = 1;
+ }
+
+ vmbacs &= ~E1000_VMBACS_SPEED_CHG;
+ wr32(E1000_VMBACS, vmbacs);
+
+ if (err)
+ return;
+ }
+
+ spin_lock(&adapter->bandwidth_allocation_lock);
+ igb_enable_bandwidth_allocation(adapter);
+ spin_unlock(&adapter->bandwidth_allocation_lock);
+#endif
+ return;
+}
+
/**
* igb_configure_tx - Configure transmit Unit after Reset
* @adapter: board private structure
@@ -3100,6 +3250,8 @@ static void igb_watchdog_task(struct wor
break;
}
+ igb_check_bandwidth_allocation(adapter);
+
netif_carrier_on(netdev);
igb_ping_all_vfs(adapter);
@@ -5999,4 +6151,101 @@ static void igb_vmm_control(struct igb_a
}
}
+#ifdef CONFIG_PCI_IOV
+static ssize_t igb_show_bandwidth_allocation(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct net_device *netdev = dev_get_drvdata(dev);
+ struct igb_adapter *adapter = netdev_priv(netdev);
+ int i;
+
+ if (!adapter->vf_data)
+ return -ENOENT;
+
+ *buf = '\0';
+ for (i = 0; i < adapter->vfs_allocated_count; i++) {
+ if (i > 0)
+ strcat(buf, " ");
+ sprintf(buf + strlen(buf), "%i",
+ adapter->bandwidth_allocation[i]);
+ }
+ strcat(buf, "\n");
+
+ return strlen(buf);
+}
+
+static unsigned long igb_strtoul(const char *cp, char **endp, unsigned int base)
+{
+ const char *orig = cp;
+ unsigned long x;
+
+ while (isspace(*cp))
+ cp++;
+
+ x = simple_strtoul(cp, endp, base);
+ if (cp == *endp)
+ *endp = (char *)orig;
+
+ return x;
+}
+
+static ssize_t igb_set_bandwidth_allocation(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct net_device *netdev = dev_get_drvdata(dev);
+ struct igb_adapter *adapter = netdev_priv(netdev);
+ int i;
+ size_t len;
+ ssize_t status = -ENOENT;
+ unsigned int *new, total;
+ unsigned long x;
+ const char *p;
+ char *next_p;
+
+ if (!adapter->vf_data)
+ return -ENOENT;
+
+ len = adapter->vfs_allocated_count * sizeof(unsigned int);
+
+ new = kmalloc(len, GFP_KERNEL);
+ if (!new)
+ return -ENOMEM;
+
+ p = buf;
+ total = 0;
+ for (i = 0; i < adapter->vfs_allocated_count; i++) {
+ x = igb_strtoul(p, &next_p, 10);
+ if (p == next_p) {
+ dev_err(dev, "not enough values\n");
+ goto err;
+ }
+ if (x > 1000) {
+ dev_err(dev, "value is too large\n");
+ goto err;
+ }
+ new[i] = x;
+ total += x;
+ p = next_p;
+ }
+
+ /* Check for trailing rubbish */
+ igb_strtoul(p, &next_p, 10);
+ if (p != next_p) {
+ dev_err(dev, "trailing rubbish\n");
+ goto err;
+ }
+
+ spin_lock(&adapter->bandwidth_allocation_lock);
+ memcpy(adapter->bandwidth_allocation, new, len);
+ igb_enable_bandwidth_allocation(adapter);
+ spin_unlock(&adapter->bandwidth_allocation_lock);
+
+ status = count;
+err:
+ kfree(new);
+ return status;
+}
+#endif /* CONFIG_PCI_IOV */
/* igb_main.c */
Index: net-next-2.6/drivers/net/igb/e1000_regs.h
===================================================================
--- net-next-2.6.orig/drivers/net/igb/e1000_regs.h 2009-11-26 10:32:02.000000000 +1100
+++ net-next-2.6/drivers/net/igb/e1000_regs.h 2009-11-26 10:33:01.000000000 +1100
@@ -311,6 +311,16 @@
#define E1000_VLVF(_n) (0x05D00 + (4 * (_n))) /* VLAN Virtual Machine
* Filter - RW */
+/* Tx Bandwidth Allocation to VM Registers */
+#define E1000_VMBACS 0x03600 /* VM Bandwidth Allocation
+ * Control & Status - RW */
+#define E1000_VMBAMMW 0x03670 /* VM Bandwidth Allocation
+ * Max Memory Window - RW */
+#define E1000_VMBASEL 0x03604 /* VM Bandwidth Allocation
+ * Select - RW */
+#define E1000_VMBAC 0x03608 /* VM Bandwidth Allocation
+ * Config - RW */
+
#define wr32(reg, value) (writel(value, hw->hw_addr + reg))
#define rd32(reg) (readl(hw->hw_addr + reg))
#define wrfl() ((void)rd32(E1000_STATUS))
Index: net-next-2.6/drivers/net/igb/e1000_defines.h
===================================================================
--- net-next-2.6.orig/drivers/net/igb/e1000_defines.h 2009-11-26 10:32:02.000000000 +1100
+++ net-next-2.6/drivers/net/igb/e1000_defines.h 2009-11-26 10:33:01.000000000 +1100
@@ -724,4 +724,13 @@
#define E1000_PCIEMISC_LX_DECISION 0x00000080 /* Lx power decision based
on DMA coal */
+/* VM Bandwidth Allocation Control & Status */
+#define E1000_VMBACS_VMBA_SET 0x00001000
+#define E1000_VMBACS_SPEED_CHG 0x80000000
+
+/* VM Bandwidth Allocation Config */
+#define E1000_VMBAC_RF_INT_SHIFT 14
+#define E1000_VMBAC_RF_MASK ((1<<23)-1) /* RF_DEC and RF_INT */
+#define E1000_VMBAC_RC_ENA 0x80000000
+
#endif
Index: net-next-2.6/drivers/net/igb/igb.h
===================================================================
--- net-next-2.6.orig/drivers/net/igb/igb.h 2009-11-26 10:32:02.000000000 +1100
+++ net-next-2.6/drivers/net/igb/igb.h 2009-11-26 10:33:01.000000000 +1100
@@ -312,6 +312,10 @@ struct igb_adapter {
unsigned int vfs_allocated_count;
struct vf_data_storage *vf_data;
u32 rss_queues;
+#ifdef CONFIG_PCI_IOV
+ unsigned int *bandwidth_allocation;
+ spinlock_t bandwidth_allocation_lock;
+#endif
};
#define IGB_FLAG_HAS_MSI (1 << 0)
^ permalink raw reply
* [PATCH 01/16] sfc: Fix descriptor cache sizes
From: Ben Hutchings @ 2009-11-26 2:08 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
These were accidentally undersized by a factor of 2, which limited
performance.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/sfc/falcon.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 41a321b..7b19686 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -49,11 +49,11 @@ static int disable_dma_stats;
* goes idle.
*/
#define TX_DC_ENTRIES 16
-#define TX_DC_ENTRIES_ORDER 0
+#define TX_DC_ENTRIES_ORDER 1
#define TX_DC_BASE 0x130000
#define RX_DC_ENTRIES 64
-#define RX_DC_ENTRIES_ORDER 2
+#define RX_DC_ENTRIES_ORDER 3
#define RX_DC_BASE 0x100000
static const unsigned int
@@ -2974,14 +2974,14 @@ int falcon_init_nic(struct efx_nic *efx)
efx_writeo(efx, &temp, FR_AZ_SRM_RX_DC_CFG);
/* Set TX descriptor cache size. */
- BUILD_BUG_ON(TX_DC_ENTRIES != (16 << TX_DC_ENTRIES_ORDER));
+ BUILD_BUG_ON(TX_DC_ENTRIES != (8 << TX_DC_ENTRIES_ORDER));
EFX_POPULATE_OWORD_1(temp, FRF_AZ_TX_DC_SIZE, TX_DC_ENTRIES_ORDER);
efx_writeo(efx, &temp, FR_AZ_TX_DC_CFG);
/* Set RX descriptor cache size. Set low watermark to size-8, as
* this allows most efficient prefetching.
*/
- BUILD_BUG_ON(RX_DC_ENTRIES != (16 << RX_DC_ENTRIES_ORDER));
+ BUILD_BUG_ON(RX_DC_ENTRIES != (8 << RX_DC_ENTRIES_ORDER));
EFX_POPULATE_OWORD_1(temp, FRF_AZ_RX_DC_SIZE, RX_DC_ENTRIES_ORDER);
efx_writeo(efx, &temp, FR_AZ_RX_DC_CFG);
EFX_POPULATE_OWORD_1(temp, FRF_AZ_RX_DC_PF_LWM, RX_DC_ENTRIES - 8);
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
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 related
* [PATCH 02/16] sfc: Treat all MAC registers as 128-bit
From: Ben Hutchings @ 2009-11-26 2:08 UTC (permalink / raw)
To: David Miller; +Cc: netdev, linux-net-drivers
Although all the defined fields in these registers are within 32 bits,
they are architecturally defined as 128-bit like most other Falcon
registers. In particular, we must use efx_reado() to ensure proper
locking when reading MD_STAT_REG.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/sfc/falcon.c | 14 +++++++-------
drivers/net/sfc/falcon_xmac.c | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index 7b19686..f97ef3e 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -2042,18 +2042,18 @@ int falcon_dma_stats(struct efx_nic *efx, unsigned int done_offset)
/* Wait for GMII access to complete */
static int falcon_gmii_wait(struct efx_nic *efx)
{
- efx_dword_t md_stat;
+ efx_oword_t md_stat;
int count;
/* wait upto 50ms - taken max from datasheet */
for (count = 0; count < 5000; count++) {
- efx_readd(efx, &md_stat, FR_AB_MD_STAT);
- if (EFX_DWORD_FIELD(md_stat, FRF_AB_MD_BSY) == 0) {
- if (EFX_DWORD_FIELD(md_stat, FRF_AB_MD_LNFL) != 0 ||
- EFX_DWORD_FIELD(md_stat, FRF_AB_MD_BSERR) != 0) {
+ efx_reado(efx, &md_stat, FR_AB_MD_STAT);
+ if (EFX_OWORD_FIELD(md_stat, FRF_AB_MD_BSY) == 0) {
+ if (EFX_OWORD_FIELD(md_stat, FRF_AB_MD_LNFL) != 0 ||
+ EFX_OWORD_FIELD(md_stat, FRF_AB_MD_BSERR) != 0) {
EFX_ERR(efx, "error from GMII access "
- EFX_DWORD_FMT"\n",
- EFX_DWORD_VAL(md_stat));
+ EFX_OWORD_FMT"\n",
+ EFX_OWORD_VAL(md_stat));
return -EIO;
}
return 0;
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c
index 69cb55f..cf24513 100644
--- a/drivers/net/sfc/falcon_xmac.c
+++ b/drivers/net/sfc/falcon_xmac.c
@@ -64,7 +64,7 @@ int falcon_reset_xaui(struct efx_nic *efx)
int count;
/* Start reset sequence */
- EFX_POPULATE_DWORD_1(reg, FRF_AB_XX_RST_XX_EN, 1);
+ EFX_POPULATE_OWORD_1(reg, FRF_AB_XX_RST_XX_EN, 1);
efx_writeo(efx, ®, FR_AB_XX_PWR_RST);
/* Wait up to 10 ms for completion, then reinitialise */
@@ -146,14 +146,14 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
bool rx_fc = !!(efx->link_state.fc & EFX_FC_RX);
/* Configure MAC - cut-thru mode is hard wired on */
- EFX_POPULATE_DWORD_3(reg,
+ EFX_POPULATE_OWORD_3(reg,
FRF_AB_XM_RX_JUMBO_MODE, 1,
FRF_AB_XM_TX_STAT_EN, 1,
FRF_AB_XM_RX_STAT_EN, 1);
efx_writeo(efx, ®, FR_AB_XM_GLB_CFG);
/* Configure TX */
- EFX_POPULATE_DWORD_6(reg,
+ EFX_POPULATE_OWORD_6(reg,
FRF_AB_XM_TXEN, 1,
FRF_AB_XM_TX_PRMBL, 1,
FRF_AB_XM_AUTO_PAD, 1,
@@ -163,7 +163,7 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
efx_writeo(efx, ®, FR_AB_XM_TX_CFG);
/* Configure RX */
- EFX_POPULATE_DWORD_5(reg,
+ EFX_POPULATE_OWORD_5(reg,
FRF_AB_XM_RXEN, 1,
FRF_AB_XM_AUTO_DEPAD, 0,
FRF_AB_XM_ACPT_ALL_MCAST, 1,
@@ -173,14 +173,14 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
/* Set frame length */
max_frame_len = EFX_MAX_FRAME_LEN(efx->net_dev->mtu);
- EFX_POPULATE_DWORD_1(reg, FRF_AB_XM_MAX_RX_FRM_SIZE, max_frame_len);
+ EFX_POPULATE_OWORD_1(reg, FRF_AB_XM_MAX_RX_FRM_SIZE, max_frame_len);
efx_writeo(efx, ®, FR_AB_XM_RX_PARAM);
- EFX_POPULATE_DWORD_2(reg,
+ EFX_POPULATE_OWORD_2(reg,
FRF_AB_XM_MAX_TX_FRM_SIZE, max_frame_len,
FRF_AB_XM_TX_JUMBO_MODE, 1);
efx_writeo(efx, ®, FR_AB_XM_TX_PARAM);
- EFX_POPULATE_DWORD_2(reg,
+ EFX_POPULATE_OWORD_2(reg,
FRF_AB_XM_PAUSE_TIME, 0xfffe, /* MAX PAUSE TIME */
FRF_AB_XM_DIS_FCNTL, !rx_fc);
efx_writeo(efx, ®, FR_AB_XM_FC);
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
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 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