30 Sep, 2010

1 commit

  • uml_net_set_mac() was broken and luckily it was never used, before.
    What it was trying to do is spin_lock before memcopy the mac address.
    Linus attempted to fix it in assumption that someone decided the
    lock was needed. But since it was never ever used at all, and was
    just dead code, I think we can assume that it is not needed, after
    all.

    On the other hand patch [f25c80a4] was trying to use eth_mac_addr()
    in eth_configure(), *which was the real fallout*. Because of state
    checks done inside eth_mac_addr() the address was never set. I have
    not reintroduced the memcpy wrapper, but I've put a comment for future
    cats.

    The code now is back to exactly as it was before [f25c80a4]. With
    the cleanup applied. If the spin_lock is indeed needed then a contender
    should supply a test case that fails, then fix it with the proper
    locking, as a separate unrelated patch.

    CC: Julia Lawall
    CC: David S. Miller
    CC: Andrew Morton
    CC: Al Viro
    Tested-by: Boaz Harrosh
    Signed-off-by: Boaz Harrosh
    Signed-off-by: David S. Miller

    Boaz Harrosh
     

22 Jul, 2010

1 commit

  • There are two initializations of ndo_set_mac_address, one to a local
    function that is not used otherwise and one to a function that is defined
    elsewhere.

    The semantic match that finds this problem is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @r@
    identifier I, s, fld;
    position p0,p;
    expression E;
    @@

    struct I s =@p0 { ... .fld@p = E, ...};

    @s@
    identifier I, s, r.fld;
    position r.p0,p;
    expression E;
    @@

    struct I s =@p0 { ... .fld@p = E, ...};

    @script:python@
    p0 << r.p0;
    fld << r.fld;
    ps << s.p;
    pr << r.p;
    @@

    if int(ps[0].line)

    akpm:

    - Use the standard eth_mac_addr() in uml_net_set_mac()

    - Remove unneeded and racy local set_ether_mac()

    - Remove duplicated (and incorrect)
    uml_netdev_ops.ndo_set_mac_address initializer.

    Fixes 8bb95b39a16ed55226810596f92216c53329d2fe ("uml: convert network
    device to netdevice ops").

    [akpm@linux-foundation.org: rework as above]
    Signed-off-by: Julia Lawall
    Cc: Stephen Hemminger
    Cc: "David S. Miller"
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    Julia Lawall
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

21 Sep, 2009

1 commit


02 Sep, 2009

1 commit


06 Jul, 2009

1 commit


16 Jun, 2009

1 commit

  • In the near future, the driver core is going to not allow direct access
    to the driver_data pointer in struct device. Instead, the functions
    dev_get_drvdata() and dev_set_drvdata() should be used. These functions
    have been around since the beginning, so are backwards compatible with
    all older kernel versions.

    Cc: user-mode-linux-devel@lists.sourceforge.net
    Cc: Jeff Dike
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

03 Apr, 2009

1 commit

  • Fix the following compile error:

    arch/um/drivers/net_kern.c: In function 'uml_inetaddr_event':
    arch/um/drivers/net_kern.c:760: error: 'struct net_device' has no member named 'open'

    This was introduced by commit 8bb95b39, "uml: convert network device
    to netdevice ops".

    Signed-off-by: Miklos Szeredi
    Cc: Stephen Hemminger
    Cc: David S. Miller
    Cc: Jeff Dike
    Reviewed-by: WANG Cong
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

27 Mar, 2009

2 commits


05 Dec, 2008

1 commit


28 Oct, 2008

1 commit

  • A number of places still use %02x:...:%02x because it's
    in debug statements or for no real reason. Make a few
    of them use %pM.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

28 Apr, 2008

1 commit


26 Mar, 2008

1 commit

  • IFF_ALLMULTI is an indication from the network stack to the driver
    to disable multicast filters, drivers should never set it directly.

    Since the UML networking device doesn't have any filtering capabilites,
    it doesn't the set_multicast_list function at all, it is kept so userspace
    can still issue SIOCADDMULTI/SIOCDELMULTI ioctls however.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

06 Feb, 2008

2 commits

  • Downgrade one of the MAC validity checks. If it's one that could be possibly
    assigned to a physical NIC, then nothing will break. So, emit a warning in
    this case, but keep the requested MAC.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Add some more commentary about various pieces of global data not needing
    locking.

    Also got rid of unmap_physmem since that is no longer used.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

11 Dec, 2007

1 commit

  • Recently, Wang Chen submitted a patch
    (d30f53aeb31d453a5230f526bea592af07944564) to move a call to netif_rx(skb)
    after a subsequent reference to skb, because netif_rx may call kfree_skb on
    its argument. The same problem occurs in some other drivers as well.

    This was found using the following semantic match.
    (http://www.emn.fr/x-info/coccinelle/)

    //
    @@
    expression skb, e,e1;
    @@

    (
    netif_rx(skb);
    |
    netif_rx_ni(skb);
    )
    ... when != skb = e
    (
    skb = e1
    |
    * skb
    )
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: David S. Miller

    Julia Lawall
     

15 Nov, 2007

1 commit


17 Oct, 2007

3 commits

  • Handle memory allocation failures when reading packets.

    We have to read something from the host, even if we can't allocate any
    memory. If we don't, the host side of the device may fill up and stop
    delivering interrupts because no new packets can be queued.

    A single sk_buff is allocated whenever an MTU is seen which is larger
    than any seen earlier. This is used to read packets if there is a
    memory allocation failure.

    The large MTU check is done from eth_configure, which is called when a
    interface is added to the system.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • A bunch of MTU-related cleanups in the network code.

    First, there is the addition of the notion of a maximally-sized packet, which
    is the MTU plus headers. This is used to size the skb that will receive a
    packet. This allows ether_adjust_skb to go away, as it was used to resize the
    skb after it was allocated.

    Since the skb passed into the low-level read routine is no longer resized, and
    possibly reallocated, there, they (and the write routines) don't need to get
    an sk_buff **. They just need the sk_buff * now. The callers of
    ether_adjust_skb still need to do the skb_put, so that's now inlined.

    The MAX_PACKET definitions in most of the drivers are gone.

    The set_mtu methods were all the same and did nothing, so they can be
    removed.

    The ethertap driver had a typo which doubled the size of the packet rather
    than adding two bytes to it. It also wasn't defining its setup_size, causing
    a zero-byte kmalloc and crash when the invalid pointer returned from kmalloc
    was dereferenced.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Style and other non-functional changes in the UML networking code, including
    include tidying
    style violations
    copyright updates
    printks getting severities
    userspace code calling libc directly rather than using the os_*
    wrappers

    There's also a exit path cleanup in the pcap driver.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

25 Jul, 2007

1 commit

  • 2.6.23-rc1 turned up another batch of references from non-__init code to
    __init code. In most cases, these were missing __init annotations. In one
    case (os_drop_memory), the annotation was present but wrong.

    init_maps is __init, but for some reason was being very careful about the
    mechanism by which it allocated memory, checking whether it was OK to use
    kmalloc (at this point in the boot, it definitely isn't) and using either
    alloc_bootmem_low_pages or kmalloc/vmalloc. So, the kmalloc/vmalloc code is
    removed.

    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

09 May, 2007

1 commit

  • Some network device cleanup.

    When setup_etheraddr found a globally valid MAC being assigned to an
    interface, it went ahead and used it rather than assigning a random MAC like
    the other cases do. This isn't really an error like the others, but it seems
    consistent to make it behave the same.

    We were getting some duplicate kfree() in the error case in eth_configure
    because platform_device_unregister frees buffers that the error cases
    following tried to free again.

    The pcap initialization routine wasn't doing the proper printk of its
    information, causing a printk of the first part of that line to be
    unterminated by a newline.

    The pcap code had a bunch of style violations, which are now fixed.

    pcap_setup wasn't returning false when it detected an unrecognized
    option.

    The printks in pcap_user all got UM_KERN_BLAH prepended to their
    format strings.

    pcap_remove now checks for a non-NULL pcap structure before it calls
    pcap_close.

    Signed-off-by: Jeff Dike
    Acked-by: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

08 May, 2007

6 commits

  • Define release methods for the ubd and net drivers. They contain as much of
    the remove methods as make sense. All error checking must have already been
    done as well as anything else that might be holding a reference on the device
    kobject.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • To look at users I did:
    $ find arch/um/ include/asm-um -name '*.[ch]'|xargs grep -r 'net_kern\.h'
    +-l|xargs grep '\'

    Most users just cast user to the appropriate pointer, the remaining ones are
    fixed here. In net_kern.c, I'm almost sure that save trick is not needed
    anymore, but I've not verified it.

    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     
  • Avoid using the temporary buffer introduced by previous patch to hold the
    device name.

    Btw, avoid leaking device on an error path. Other error paths may need
    cleanup.

    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     
  • Improve checking and diagnostics for broadcast and multicast Ethernet MAC
    addresses, and distinguish between those cases in output; also make sure the
    device is assigned a MAC address valid only locally to avoid collisions.

    Signed-off-by: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Jeff Dike
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Paolo 'Blaisorblade' Giarrusso
     
  • user_util.h isn't needed any more, so delete it and remove all includes of it.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • This fixes a number of problems associated with network interface hotplug.

    The userspace initialization function can fail in some cases, but the
    failure was never passed back to eth_configure, which proceeded with the
    configuration. This results in a zombie device that is present, but can't
    work. This is fixed by allowing the initialization routines to return an
    error, which is checked, and the configuration aborted on failure.

    eth_configure failed to check for many failures. Even when it did check,
    it didn't undo whatever initializations has already happened, so a present,
    but partially initialized and non-working device could result. It now
    checks everything that can fail, and bails out, undoing whatever had been
    done.

    The return value of eth_configure was always ignored, so it is now just
    void.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Cc: Jeff Garzik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

26 Apr, 2007

1 commit

  • For the common, open coded 'skb->mac.raw = skb->data' operation, so that we can
    later turn skb->mac.raw into a offset, reducing the size of struct sk_buff in
    64bit land while possibly keeping it as a pointer on 32bit.

    This one touches just the most simple case, next will handle the slightly more
    "complex" cases.

    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: David S. Miller

    Arnaldo Carvalho de Melo
     

12 Feb, 2007

5 commits

  • Add some missing locking to walks of the transports and opened lists.

    Delete some dead code.

    Comment the lack of some locking.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Locking fixes. Locking was totally lacking for the mconsole_devices, which
    got a spin lock, and the unplugged pages data, which got a mutex.

    The locking of the mconsole console output code was confused. Now, the
    console_lock (renamed to client_lock) protects the clients list.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • Some whitespace and coding style cleanups in the network driver code.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Acked-by: Jeff Garzik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • The registration of host network transports needed some locking. The
    transport list itself is locked, but calls to the registration routines are
    not. This is compensated for by checking that a transport structure is not
    yet on any list.

    I also took the opportunity to const all fields in the transport structure
    except the list, which obviously can be modified.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • I noticed that errors happening while hotplugging devices from the host were
    never returned back to the mconsole client. In some cases, success was
    returned instead of even an information-free error.

    This patch cleans that up by having the low-level configuration code pass back
    an error string along with an error code. At the top level, which knows
    whether it is early boot time or responding to an mconsole request, the string
    is printk'd or returned to the mconsole client.

    There are also whitespace and trivial code cleanups in the surrounding code.

    Signed-off-by: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     

14 Dec, 2006

1 commit


13 Dec, 2006

1 commit


06 Dec, 2006

1 commit


09 Oct, 2006

1 commit


04 Oct, 2006

1 commit