13 Feb, 2008

1 commit


01 Feb, 2008

1 commit

  • Reuse the existing logic for multicast list synchronization for the
    unicast address list. The core of dev_mc_sync/unsync are split out as
    __dev_addr_sync/unsync and moved from dev_mcast.c to dev.c. These are
    then used to implement dev_unicast_sync/unsync as well.

    I'm working on cleaning up Intel's FCoE stack, which generates new MAC
    addresses from the fibre channel device id assigned by the fabric as
    per the current draft specification in T11. When using such a
    protocol in a VLAN environment it would be nice to not always be
    forced into promiscuous mode, assuming the underlying Ethernet driver
    supports multiple unicast addresses as well.

    Signed-off-by: Chris Leech
    Signed-off-by: Patrick McHardy

    Chris Leech
     

09 Jan, 2008

2 commits

  • Create a bit to signal that a napi_disable() is in progress.

    This sets up infrastructure such that net_rx_action() can generically
    break out of the ->poll() loop on a NAPI context that has a pending
    napi_disable() yet is being bombed with packets (and thus would
    otherwise poll endlessly and not allow the napi_disable() to finish).

    Now, what napi_disable() does is first set the NAPI_STATE_DISABLE bit
    (to indicate that a disable is pending), then it polls for the
    NAPI_STATE_SCHED bit, and once the NAPI_STATE_SCHED bit is acquired
    the NAPI_STATE_DISABLE bit is cleared. Here, the test_and_set_bit()
    provides the necessary memory barrier between the various bitops.

    napi_schedule_prep() now tests for a pending disable as it's first
    action and won't try to obtain the NAPI_STATE_SCHED bit if a disable
    is pending.

    As a result, we can remove the netif_running() check in
    netif_rx_schedule_prep() because the NAPI disable pending state serves
    this purpose. And, it does so in a NAPI centric manner which is what
    we really want.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • It is pointless, because everything that can make a device go away
    will do a napi_disable() first.

    The main impetus behind this is that now we can legally do a NAPI
    completion in generic code like net_rx_action() which a following
    changeset needs to do. net_rx_action() can only perform actions
    in NAPI centric ways, because there may be a one to many mapping
    between NAPI contexts and network devices (SKY2 is one example).

    We also want to get rid of this because it's an extra atomic in the
    NAPI paths, and also because it is one of the last instances where the
    NAPI interfaces care about net devices.

    The one remaining netdev detail the NAPI stuff cares about is the
    netif_running() check which will be killed off in a subsequent
    changeset.

    Signed-off-by: David S. Miller

    David S. Miller
     

01 Nov, 2007

1 commit

  • Documentation updates for network interfaces.

    1. Add doc for netif_napi_add
    2. Remove doc for unused returns from netif_rx
    3. Add doc for netif_receive_skb

    [ Incorporated minor mods from Randy Dunlap -DaveM ]

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Stephen Hemminger
     

26 Oct, 2007

1 commit


24 Oct, 2007

2 commits


22 Oct, 2007

1 commit


19 Oct, 2007

1 commit

  • * 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6:
    pcnet32: remove private net_device_stats structure
    vortex_up should initialize "err"
    pcnet32: remove compile warnings in non-napi mode
    pcnet32: fix non-napi packet reception
    fix EMAC driver for proper napi_synchronize API
    sky2: shutdown cleanup
    napi_synchronize: waiting for NAPI
    forcedeth msi bugfix
    gianfar: fix obviously wrong #ifdef CONFIG_GFAR_NAPI placement
    fs_enet: Update for API changes
    gianfar: remove orphan struct.
    forcedeth: fix rx-work condition in nv_rx_process_optimized() too

    Linus Torvalds
     

18 Oct, 2007

2 commits


14 Oct, 2007

1 commit

  • Fix networking code kernel-doc for newly added parameters.

    Warning(linux-2.6.23-git2//net/core/sock.c:879): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:570): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:594): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:617): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:641): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:667): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:722): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:959): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:1195): No description found for parameter 'dev'
    Warning(linux-2.6.23-git2//net/core/dev.c:2105): No description found for parameter 'n'
    Warning(linux-2.6.23-git2//net/core/dev.c:3272): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//net/core/dev.c:3445): No description found for parameter 'net'
    Warning(linux-2.6.23-git2//include/linux/netdevice.h:1301): No description found for parameter 'cpu'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     

11 Oct, 2007

17 commits

  • Trivial fix: Swap comments for dev_put() and dev_hold() to get them
    at the right place.
    Typo introduced by 4fa57c9ea9f36f9ca852f3a88ca5d2f1aebbc960.

    Signed-of-by: Benjamin Thery
    Signed-off-by: David S. Miller

    Benjamin Thery
     
  • Commit da3dedd9 ("[NET]: Make NAPI polling independent of struct
    net_device objects.") changed the interface to NAPI polling. Fix up
    the ibm_emac driver so that it works with this new interface. This is
    actually a nice cleanup because ibm_emac is one of the drivers that
    wants to have multiple NAPI structures for a single net_device.

    Tested with the internal MAC of a PowerPC 440SPe SoC with an AMCC
    'Yucca' evaluation board.

    Signed-off-by: Roland Dreier
    Signed-off-by: Jeff Garzik

    Roland Dreier
     
  • Since hardware header operations are part of the protocol class
    not the device instance, make them into a separate object and
    save memory.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Stephen Hemminger
     
  • Wrap the hard_header_parse function to simplify next step of
    header_ops conversion.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Stephen Hemminger
     
  • Add inline for common usage of hardware header creation, and
    fix bug in IPV6 mcast where the assumption about negative return is
    an errno. Negative return from hard_header means not enough space
    was available,(ie -N bytes).

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Stephen Hemminger
     
  • This patch makes loopback_dev per network namespace. Adding
    code to create a different loopback device for each network
    namespace and adding the code to free a loopback device
    when a network namespace exits.

    This patch modifies all users the loopback_dev so they
    access it as init_net.loopback_dev, keeping all of the
    code compiling and working. A later pass will be needed to
    update the users to use something other than the initial network
    namespace.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • Am Freitag, 21. September 2007 schrieb Herbert Xu:
    > Please don't use LLTX in new drivers. We're trying to get rid
    > of it since it's
    >
    > 1) unnecessary;
    > 2) causes problems with AF_PACKET seeing things twice.

    I suggest to document that LLTX is deprecated.

    Signed-off-by: Christian Borntraeger
    Acked-by: Herbert Xu
    Signed-off-by: David S. Miller

    Christian Borntraeger
     
  • This patch replaces all occurences to the static variable
    loopback_dev to a pointer loopback_dev. That provides the
    mindless, trivial, uninteressting change part for the dynamic
    allocation for the loopback.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Daniel Lezcano
    Acked-By: Kirill Korotaev
    Acked-by: Benjamin Thery
    Signed-off-by: David S. Miller

    Daniel Lezcano
     
  • This replaces the void * parameter with a struct net_device * which
    is what is actually required.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • HARD_TX_LOCK micro is a nice aggregation that could be used
    in other spots. move it to netdevice.h
    Also makes sure the previously superflous cpu arguement is used.
    Thanks to DaveM for the suggestions.

    Signed-off-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Jamal Hadi Salim
     
  • It's been a useless no-op for long enough in 2.6 so I figured it's time to
    remove it. The number of people that could object because they're
    maintaining unified 2.4 and 2.6 drivers is probably rather small.

    [ Handled drivers added by netdev tree and some missed IRDA cases... -DaveM ]

    Signed-off-by: Ralf Baechle
    Signed-off-by: Jeff Garzik
    Signed-off-by: David S. Miller

    Ralf Baechle
     
  • The macro definition is bad. When calling next_net_device with
    parameter name "dev", the resulting code is:
    struct net_device *dev = dev and that leads to an unexpected
    behavior. Especially when llc_core is compiled in, the kernel panics
    at boot time.
    The patchset change macro definition with static inline functions as
    they were defined before.

    Signed-off-by: Benjamin Thery
    Signed-off-by: Daniel Lezcano
    Signed-off-by: David S. Miller

    Daniel Lezcano
     
  • This patch introduces NETIF_F_NETNS_LOCAL a flag to indicate
    a network device is local to a single network namespace and
    should never be moved. Useful for pseudo devices that we
    need an instance in each network namespace (like the loopback
    device) and for any device we find that cannot handle multiple
    network namespaces so we may trap them in the initial network
    namespace.

    This patch introduces the function dev_change_net_namespace
    a function used to move a network device from one network
    namespace to another. To the network device nothing
    special appears to happen, to the components of the network
    stack it appears as if the network device was unregistered
    in the network namespace it is in, and a new device
    was registered in the network namespace the device
    was moved to.

    This patch sets up a namespace device destructor that
    upon the exit of a network namespace moves all of the
    movable network devices to the initial network namespace
    so they are not lost.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • This patch makes most of the generic device layer network
    namespace safe. This patch makes dev_base_head a
    network namespace variable, and then it picks up
    a few associated variables. The functions:
    dev_getbyhwaddr
    dev_getfirsthwbytype
    dev_get_by_flags
    dev_get_by_name
    __dev_get_by_name
    dev_get_by_index
    __dev_get_by_index
    dev_ioctl
    dev_ethtool
    dev_load
    wireless_process_ioctl

    were modified to take a network namespace argument, and
    deal with it.

    vlan_ioctl_set and brioctl_set were modified so their
    hooks will receive a network namespace argument.

    So basically anthing in the core of the network stack that was
    affected to by the change of dev_base was modified to handle
    multiple network namespaces. The rest of the network stack was
    simply modified to explicitly use &init_net the initial network
    namespace. This can be fixed when those components of the network
    stack are modified to handle multiple network namespaces.

    For now the ifindex generator is left global.

    Fundametally ifindex numbers are per namespace, or else
    we will have corner case problems with migration when
    we get that far.

    At the same time there are assumptions in the network stack
    that the ifindex of a network device won't change. Making
    the ifindex number global seems a good compromise until
    the network stack can cope with ifindex changes when
    you change namespaces, and the like.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • Please note that network devices do not increase the count
    count on the network namespace. The are inside the network
    namespace and so the network namespace tag is in the nature
    of a back pointer and so getting and putting the network namespace
    is unnecessary.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • Signed-off-by: Jeff Garzik
    Signed-off-by: David S. Miller

    Jeff Garzik
     
  • Several devices have multiple independant RX queues per net
    device, and some have a single interrupt doorbell for several
    queues.

    In either case, it's easier to support layouts like that if the
    structure representing the poll is independant from the net
    device itself.

    The signature of the ->poll() call back goes from:

    int foo_poll(struct net_device *dev, int *budget)

    to

    int foo_poll(struct napi_struct *napi, int budget)

    The caller is returned the number of RX packets processed (or
    the number of "NAPI credits" consumed if you want to get
    abstract). The callee no longer messes around bumping
    dev->quota, *budget, etc. because that is all handled in the
    caller upon return.

    The napi_struct is to be embedded in the device driver private data
    structures.

    Furthermore, it is the driver's responsibility to disable all NAPI
    instances in it's ->stop() device close handler. Since the
    napi_struct is privatized into the driver's private data structures,
    only the driver knows how to get at all of the napi_struct instances
    it may have per-device.

    With lots of help and suggestions from Rusty Russell, Roland Dreier,
    Michael Chan, Jeff Garzik, and Jamal Hadi Salim.

    Bug fixes from Thomas Graf, Roland Dreier, Peter Zijlstra,
    Joseph Fannin, Scott Wood, Hans J. Koch, and Michael Chan.

    [ Ported to current tree and all drivers converted. Integrated
    Stephen's follow-on kerneldoc additions, and restored poll_list
    handling to the old style to fix mutual exclusion issues. -DaveM ]

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Stephen Hemminger
     

14 Aug, 2007

1 commit

  • http://bugzilla.kernel.org/show_bug.cgi?id=8797 shows that the
    bonding driver may produce bogus combinations of the checksum
    flags and SG/TSO.

    For example, if you bond devices with NETIF_F_HW_CSUM and
    NETIF_F_IP_CSUM you'll end up with a bonding device that
    has neither flag set. If both have TSO then this produces
    an illegal combination.

    The bridge device on the other hand has the correct code to
    deal with this.

    In fact, the same code can be used for both. So this patch
    moves that logic into net/core/dev.c and uses it for both
    bonding and bridging.

    In the process I've made small adjustments such as only
    setting GSO_ROBUST if at least one constituent device
    supports it.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

21 Jul, 2007

1 commit


18 Jul, 2007

1 commit

  • Because this function is only called by unregister_netdevice,
    this moving could make this non-global function static,
    and also remove its declaration in netdevice.h;

    Any further, function __dev_addr_discard is also just called by
    dev_mc_discard and dev_unicast_discard, keeping this two functions
    both in one c file could make __dev_addr_discard also static
    and remove its declaration in netdevice.h;

    Futhermore, the sequential call to dev_unicast_discard and then
    dev_mc_discard in unregister_netdevice have a similar mechanism that:
    (netif_tx_lock_bh / __dev_addr_discard / netif_tx_unlock_bh),
    they should merged into one to eliminate duplicates in acquiring and
    releasing the dev->_xmit_lock, this would be done in my following patch.

    Signed-off-by: Denis Cheng
    Signed-off-by: David S. Miller

    Denis Cheng
     

17 Jul, 2007

1 commit

  • This reverts commit 29578624e354f56143d92510fff33a8b2aaa2c03.

    Ingo Molnar reports complete breakage with his e1000 card (no
    networking, card reports transmit timeouts), and bisected it down to
    this commit. Let's figure out what went wrong, but not keep breaking
    machines until we do.

    Cc: Ingo Molnar
    Cc: Olaf Kirch
    Cc: David Miller
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

15 Jul, 2007

3 commits

  • Add macvlan driver, which allows to create virtual ethernet devices
    based on MAC address.

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

    Patrick McHardy
     
  • The method drivers currently use to synchronize multicast lists is not
    very pretty:

    - walk the multicast list
    - search each entry on a copy of the previous list
    - if new add to lower device
    - walk the copy of the previous list
    - search each entry on the current list
    - if removed delete from lower device
    - copy entire list

    This patch adds a new field to struct dev_addr_list to store the
    synchronization state and adds two helper functions for synchronization
    and cleanup.

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

    Patrick McHardy
     
  • Currently the set_multicast_list (and set_rx_mode) callbacks are
    responsible for configuring the device according to the IFF_PROMISC,
    IFF_MULTICAST and IFF_ALLMULTI flags and the mc_list (and uc_list in
    case of set_rx_mode).

    These callbacks can be invoked from BH context without the rtnl_mutex
    by dev_mc_add/dev_mc_delete, which makes reading the device flags and
    promiscous/allmulti count racy. For real hardware drivers that just
    commit all changes to the hardware this is not a real problem since
    the stack guarantees to call them for every change, so at least the
    final call will not race and commit the correct configuration to the
    hardware.

    For software devices that want to synchronize promiscous and multicast
    state to an underlying device however this can cause corruption of the
    underlying device's flags or promisc/allmulti counts.

    When the software device is concurrently put in promiscous or allmulti
    mode while set_multicast_list is invoked from bottem half context, the
    device might synchronize the change to the underlying device without
    holding the rtnl_mutex, which races with concurrent changes to the
    underlying device.

    Add a dev->change_rx_flags hook that is invoked when any of the flags
    that affect rx filtering change (under the rtnl_mutex), which allows
    drivers to perform synchronization immediately and only synchronize
    the address lists in set_multicast_list/set_rx_mode.

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

    Patrick McHardy
     

12 Jul, 2007

1 commit


11 Jul, 2007

2 commits