14 Sep, 2014

1 commit

  • Make cls_tcindex RCU safe.

    This patch addds a new RCU routine rcu_dereference_bh_rtnl() to check
    caller either holds the rcu read lock or RTNL. This is needed to
    handle the case where tcindex_lookup() is being called in both cases.

    Signed-off-by: John Fastabend
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    John Fastabend
     

11 Jul, 2014

1 commit


16 May, 2014

1 commit

  • From: Cong Wang

    commit 50624c934db18ab90 (net: Delay default_device_exit_batch until no
    devices are unregistering) introduced rtnl_lock_unregistering() for
    default_device_exit_batch(). Same race could happen we when rmmod a driver
    which calls rtnl_link_unregister() as we call dev->destructor without rtnl
    lock.

    For long term, I think we should clean up the mess of netdev_run_todo()
    and net namespce exit code.

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

    Cong Wang
     

18 Dec, 2013

1 commit

  • It is useful to be able to walk all upper devices when bringing
    a device online where the RTNL lock is held. In this case it
    is safe to walk the all_adj_list because the RTNL lock is used
    to protect the write side as well.

    This patch adds a check to see if the rtnl lock is held before
    throwing a warning in netdev_all_upper_get_next_dev_rcu().

    Also because we now have a call site for lockdep_rtnl_is_held()
    outside COFIG_LOCK_PROVING an inline definition returning 1 is
    needed. Similar to the rcu_read_lock_is_held().

    Fixes: 2a47fa45d4df ("ixgbe: enable l2 forwarding acceleration for macvlans")
    CC: Veaceslav Falico
    Reported-by: Yuanhan Liu
    Signed-off-by: John Fastabend
    Tested-by: Phil Schmitt
    Signed-off-by: Jeff Kirsher

    John Fastabend
     

26 Oct, 2013

1 commit

  • commit 991fb3f74c "dev: always advertise rx_flags changes via netlink"
    introduced rtnl notification from __dev_set_promiscuity(),
    which can be called in atomic context.

    Steps to reproduce:
    ip tuntap add dev tap1 mode tap
    ifconfig tap1 up
    tcpdump -nei tap1 &
    ip tuntap del dev tap1 mode tap

    [ 271.627994] device tap1 left promiscuous mode
    [ 271.639897] BUG: sleeping function called from invalid context at mm/slub.c:940
    [ 271.664491] in_atomic(): 1, irqs_disabled(): 0, pid: 3394, name: ip
    [ 271.677525] INFO: lockdep is turned off.
    [ 271.690503] CPU: 0 PID: 3394 Comm: ip Tainted: G W 3.12.0-rc3+ #73
    [ 271.703996] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
    [ 271.731254] ffffffff81a58506 ffff8807f0d57a58 ffffffff817544e5 ffff88082fa0f428
    [ 271.760261] ffff8808071f5f40 ffff8807f0d57a88 ffffffff8108bad1 ffffffff81110ff8
    [ 271.790683] 0000000000000010 00000000000000d0 00000000000000d0 ffff8807f0d57af8
    [ 271.822332] Call Trace:
    [ 271.838234] [] dump_stack+0x55/0x76
    [ 271.854446] [] __might_sleep+0x181/0x240
    [ 271.870836] [] ? rcu_irq_exit+0x68/0xb0
    [ 271.887076] [] kmem_cache_alloc_node+0x4e/0x2a0
    [ 271.903368] [] ? vprintk_emit+0x1dc/0x5a0
    [ 271.919716] [] ? __alloc_skb+0x57/0x2a0
    [ 271.936088] [] ? vprintk_emit+0x1e0/0x5a0
    [ 271.952504] [] __alloc_skb+0x57/0x2a0
    [ 271.968902] [] rtmsg_ifinfo+0x52/0x100
    [ 271.985302] [] __dev_notify_flags+0xad/0xc0
    [ 272.001642] [] __dev_set_promiscuity+0x8c/0x1c0
    [ 272.017917] [] ? packet_notifier+0x5/0x380
    [ 272.033961] [] dev_set_promiscuity+0x29/0x50
    [ 272.049855] [] packet_dev_mc+0x87/0xc0
    [ 272.065494] [] packet_notifier+0x1b2/0x380
    [ 272.080915] [] ? packet_notifier+0x5/0x380
    [ 272.096009] [] notifier_call_chain+0x66/0x150
    [ 272.110803] [] __raw_notifier_call_chain+0xe/0x10
    [ 272.125468] [] raw_notifier_call_chain+0x16/0x20
    [ 272.139984] [] call_netdevice_notifiers_info+0x40/0x70
    [ 272.154523] [] call_netdevice_notifiers+0x16/0x20
    [ 272.168552] [] rollback_registered_many+0x145/0x240
    [ 272.182263] [] rollback_registered+0x31/0x40
    [ 272.195369] [] unregister_netdevice_queue+0x58/0x90
    [ 272.208230] [] __tun_detach+0x140/0x340
    [ 272.220686] [] tun_chr_close+0x36/0x60

    Signed-off-by: Alexei Starovoitov
    Acked-by: Nicolas Dichtel
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     

08 Mar, 2013

1 commit

  • If the driver does not support the ndo_op use the generic
    handler for it. This should work in the majority of cases.
    Eventually the fdb_dflt_add call gets translated into a
    __dev_set_rx_mode() call which should handle hardware
    support for filtering via the IFF_UNICAST_FLT flag.

    Namely IFF_UNICAST_FLT indicates if the hardware can do
    unicast address filtering. If no support is available
    the device is put into promisc mode.

    Signed-off-by: Vlad Yasevich
    Signed-off-by: John Fastabend
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

01 Nov, 2012

1 commit

  • This adds support for the net device ops to manage the embedded
    hardware bridge on ixgbe devices. With this patch the bridge
    mode can be toggled between VEB and VEPA to support stacking
    macvlan devices or using the embedded switch without any SW
    component in 802.1Qbg/br environments.

    Additionally, this adds source address pruning to the ixgbevf
    driver to prune any frames sent back from a reflective relay on
    the switch. This is required because the existing hardware does
    not support this. Without it frames get pushed into the stack
    with its own src mac which is invalid per 802.1Qbg VEPA
    definition.

    Signed-off-by: John Fastabend
    Signed-off-by: David S. Miller

    John Fastabend
     

13 Oct, 2012

1 commit


11 Jul, 2012

1 commit


28 Jun, 2012

1 commit


16 Apr, 2012

1 commit

  • This adds two new flags NTF_MASTER and NTF_SELF that can
    now be used to specify where PF_BRIDGE netlink commands should
    be sent. NTF_MASTER sends the commands to the 'dev->master'
    device for parsing. Typically this will be the linux net/bridge,
    or open-vswitch devices. Also without any flags set the command
    will be handled by the master device as well so that current user
    space tools continue to work as expected.

    The NTF_SELF flag will push the PF_BRIDGE commands to the
    device. In the basic example below the commands are then parsed
    and programmed in the embedded bridge.

    Note if both NTF_SELF and NTF_MASTER bits are set then the
    command will be sent to both 'dev->master' and 'dev' this allows
    user space to easily keep the embedded bridge and software bridge
    in sync.

    There is a slight complication in the case with both flags set
    when an error occurs. To resolve this the rtnl handler clears
    the NTF_ flag in the netlink ack to indicate which sets completed
    successfully. The add/del handlers will abort as soon as any
    error occurs.

    To support this new net device ops were added to call into
    the device and the existing bridging code was refactored
    to use these. There should be no required changes in user space
    to support the current bridge behavior.

    A basic setup with a SR-IOV enabled NIC looks like this,

    veth0 veth2
    | |
    ------------
    | bridge0 |
    Signed-off-by: David S. Miller

    John Fastabend
     

22 Feb, 2012

1 commit

  • Implement a new netlink attribute type IFLA_EXT_MASK. The mask
    is a 32 bit value that can be used to indicate to the kernel that
    certain extended ifinfo values are requested by the user application.
    At this time the only mask value defined is RTEXT_FILTER_VF to
    indicate that the user wants the ifinfo dump to send information
    about the VFs belonging to the interface.

    This patch fixes a bug in which certain applications do not have
    large enough buffers to accommodate the extra information returned
    by the kernel with large numbers of SR-IOV virtual functions.
    Those applications will not send the new netlink attribute with
    the interface info dump request netlink messages so they will
    not get unexpectedly large request buffers returned by the kernel.

    Modifies the rtnl_calcit function to traverse the list of net
    devices and compute the minimum buffer size that can hold the
    info dumps of all matching devices based upon the filter passed
    in via the new netlink attribute filter mask. If no filter
    mask is sent then the buffer allocation defaults to NLMSG_GOODSIZE.

    With this change it is possible to add yet to be defined netlink
    attributes to the dump request which should make it fairly extensible
    in the future.

    Signed-off-by: Greg Rose
    Signed-off-by: David S. Miller

    Greg Rose
     

26 Jul, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    fs: Merge split strings
    treewide: fix potentially dangerous trailing ';' in #defined values/expressions
    uwb: Fix misspelling of neighbourhood in comment
    net, netfilter: Remove redundant goto in ebt_ulog_packet
    trivial: don't touch files that are removed in the staging tree
    lib/vsprintf: replace link to Draft by final RFC number
    doc: Kconfig: `to be' -> `be'
    doc: Kconfig: Typo: square -> squared
    doc: Konfig: Documentation/power/{pm => apm-acpi}.txt
    drivers/net: static should be at beginning of declaration
    drivers/media: static should be at beginning of declaration
    drivers/i2c: static should be at beginning of declaration
    XTENSA: static should be at beginning of declaration
    SH: static should be at beginning of declaration
    MIPS: static should be at beginning of declaration
    ARM: static should be at beginning of declaration
    rcu: treewide: Do not use rcu_read_lock_held when calling rcu_dereference_check
    Update my e-mail address
    PCIe ASPM: forcedly -> forcibly
    gma500: push through device driver tree
    ...

    Fix up trivial conflicts:
    - arch/arm/mach-ep93xx/dma-m2p.c (deleted)
    - drivers/gpio/gpio-ep93xx.c (renamed and context nearby)
    - drivers/net/r8169.c (just context changes)

    Linus Torvalds
     

09 Jul, 2011

1 commit


22 Jun, 2011

1 commit

  • Now that dcbnl is being used in many cases by more
    than a single agent it is beneficial to be notified
    when some entity either driver or user space has
    changed the DCB attributes.

    Today applications either end up polling the interface
    or relying on a user space database to maintain the DCB
    state and post events. Polling is a poor solution for
    obvious reasons. And relying on a user space database
    has its own downside. Namely it has created strange
    boot dependencies requiring the database be populated
    before any applications dependent on DCB attributes
    starts or the application goes into a polling loop.
    Populating the database requires negotiating link
    setting with the peer and can take anywhere from less
    than a second up to a few seconds depending on the switch
    implementation.

    Perhaps more importantly if another application or an
    embedded agent sets a DCB link attribute the database
    has no way of knowing other than polling the kernel.
    This prevents applications from responding quickly to
    changes in link events which at least in the FCoE case
    and probably any other protocols expecting a lossless
    link may result in IO errors.

    By adding a multicast group for DCB we have clean way
    to disseminate kernel DCB link attributes up to user
    space. Avoiding the need for user space to maintain
    a coherant database and disperse events that potentially
    do not reflect the current link state.

    Signed-off-by: John Fastabend
    Signed-off-by: David S. Miller

    John Fastabend
     

16 Nov, 2010

1 commit

  • The commit below added a new helper dev_ingress_queue to cleanly obtain the
    ingress queue pointer. This necessitated including 'linux/netdevice.h':

    commit 24824a09e35402b8d58dcc5be803a5ad3937bdba
    Author: Eric Dumazet
    Date: Sat Oct 2 06:11:55 2010 +0000

    net: dynamic ingress_queue allocation

    However this include triggers issues for applications in userspace
    which use the rtnetlink interfaces. Commonly this requires they include
    'net/if.h' and 'linux/rtnetlink.h' leading to a compiler error as below:

    In file included from /usr/include/linux/netdevice.h:28:0,
    from /usr/include/linux/rtnetlink.h:9,
    from t.c:2:
    /usr/include/linux/if.h:135:8: error: redefinition of ‘struct ifmap’
    /usr/include/net/if.h:112:8: note: originally defined here
    /usr/include/linux/if.h:169:8: error: redefinition of ‘struct ifreq’
    /usr/include/net/if.h:127:8: note: originally defined here
    /usr/include/linux/if.h:218:8: error: redefinition of ‘struct ifconf’
    /usr/include/net/if.h:177:8: note: originally defined here

    The new helper is only defined for the kernel and protected by __KERNEL__
    therefore we can simply pull the include down into the same protected
    section.

    Signed-off-by: Andy Whitcroft
    Signed-off-by: David S. Miller

    Andy Whitcroft
     

05 Oct, 2010

2 commits

  • rtnl_dereference() is used in contexts where RTNL is held, to fetch an
    RCU protected pointer.

    Updates to this pointer are prevented by RTNL, so we dont need
    smp_read_barrier_depends() and the ACCESS_ONCE() provided in
    rcu_dereference_check().

    rtnl_dereference() is mainly a macro to document the locking invariant.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    David S. Miller
     
  • ingress being not used very much, and net_device->ingress_queue being
    quite a big object (128 or 256 bytes), use a dynamic allocation if
    needed (tc qdisc add dev eth0 ingress ...)

    dev_ingress_queue(dev) helper should be used only with RTNL taken.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

16 Sep, 2010

1 commit


09 Sep, 2010

1 commit

  • We use rcu_dereference_check(p, rcu_read_lock_held() ||
    lockdep_rtnl_is_held()) several times in network stack.

    More usages to come too, so its time to create a helper.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

23 Jul, 2010

1 commit

  • Add a new rt attribute, RTA_MARK, and use it in
    rt_fill_info()/inet_rtm_getroute() to support following commands :

    ip route get 192.168.20.110 mark NUMBER
    ip route get 192.168.20.108 from 192.168.20.110 iif eth1 mark NUMBER
    ip route list cache [192.168.20.110] mark NUMBER

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

11 May, 2010

1 commit

  • This patch adds support for multiple independant multicast routing instances,
    named "tables".

    Userspace multicast routing daemons can bind to a specific table instance by
    issuing a setsockopt call using a new option MRT6_TABLE. The table number is
    stored in the raw socket data and affects all following ip6mr setsockopt(),
    getsockopt() and ioctl() calls. By default, a single table (RT6_TABLE_DFLT)
    is created with a default routing rule pointing to it. Newly created pim6reg
    devices have the table number appended ("pim6regX"), with the exception of
    devices created in the default table, which are named just "pim6reg" for
    compatibility reasons.

    Packets are directed to a specific table instance using routing rules,
    similar to how regular routing rules work. Currently iif, oif and mark
    are supported as keys, source and destination addresses could be supported
    additionally.

    Example usage:

    - bind pimd/xorp/... to a specific table:

    uint32_t table = 123;
    setsockopt(fd, SOL_IPV6, MRT6_TABLE, &table, sizeof(table));

    - create routing rules directing packets to the new table:

    # ip -6 mrule add iif eth0 lookup 123
    # ip -6 mrule add oif eth0 lookup 123

    Signed-off-by: Patrick McHardy

    Patrick McHardy
     

26 Apr, 2010

1 commit

  • Decouple rtnetlink address families from real address families in socket.h to
    be able to add rtnetlink interfaces to code that is not a real address family
    without increasing AF_MAX/NPROTO.

    This will be used to add support for multicast route dumping from all tables
    as the proc interface can't be extended to support anything but the main table
    without breaking compatibility.

    This partialy undoes the patch to introduce independant families for routing
    rules and converts ipmr routing rules to a new rtnetlink family. Similar to
    that patch, values up to 127 are reserved for real address families, values
    above that may be used arbitrarily.

    Signed-off-by: Patrick McHardy

    Patrick McHardy
     

01 Mar, 2010

1 commit


25 Feb, 2010

1 commit

  • Update rcu_dereference() primitives to use new lockdep-based
    checking. The rcu_dereference() in __in6_dev_get() may be
    protected either by rcu_read_lock() or RTNL, per Eric Dumazet.
    The rcu_dereference() in __sk_free() is protected by the fact
    that it is never reached if an update could change it. Check
    for this by using rcu_dereference_check() to verify that the
    struct sock's ->sk_wmem_alloc counter is zero.

    Acked-by: Eric Dumazet
    Acked-by: David S. Miller
    Signed-off-by: Paul E. McKenney
    Cc: laijs@cn.fujitsu.com
    Cc: dipankar@in.ibm.com
    Cc: mathieu.desnoyers@polymtl.ca
    Cc: josh@joshtriplett.org
    Cc: dvhltc@us.ibm.com
    Cc: niv@us.ibm.com
    Cc: peterz@infradead.org
    Cc: rostedt@goodmis.org
    Cc: Valdis.Kletnieks@vt.edu
    Cc: dhowells@redhat.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Paul E. McKenney
     

24 Dec, 2009

1 commit

  • Add rtnetlink init_rcvwnd to set the TCP initial receive window size
    advertised by passive and active TCP connections.
    The current Linux TCP implementation limits the advertised TCP initial
    receive window to the one prescribed by slow start. For short lived
    TCP connections used for transaction type of traffic (i.e. http
    requests), bounding the advertised TCP initial receive window results
    in increased latency to complete the transaction.
    Support for setting initial congestion window is already supported
    using rtnetlink init_cwnd, but the feature is useless without the
    ability to set a larger TCP initial receive window.
    The rtnetlink init_rcvwnd allows increasing the TCP initial receive
    window, allowing TCP connection to advertise larger TCP receive window
    than the ones bounded by slow start.

    Signed-off-by: Laurent Chavey
    Signed-off-by: David S. Miller

    laurent chavey
     

16 Dec, 2009

1 commit

  • It creates a regression, triggering badness for SYN_RECV
    sockets, for example:

    [19148.022102] Badness at net/ipv4/inet_connection_sock.c:293
    [19148.022570] NIP: c02a0914 LR: c02a0904 CTR: 00000000
    [19148.023035] REGS: eeecbd30 TRAP: 0700 Not tainted (2.6.32)
    [19148.023496] MSR: 00029032 CR: 24002442 XER: 00000000
    [19148.024012] TASK = eee9a820[1756] 'privoxy' THREAD: eeeca000

    This is likely caused by the change in the 'estab' parameter
    passed to tcp_parse_options() when invoked by the functions
    in net/ipv4/tcp_minisocks.c

    But even if that is fixed, the ->conn_request() changes made in
    this patch series is fundamentally wrong. They try to use the
    listening socket's 'dst' to probe the route settings. The
    listening socket doesn't even have a route, and you can't
    get the right route (the child request one) until much later
    after we setup all of the state, and it must be done by hand.

    This stuff really isn't ready, so the best thing to do is a
    full revert. This reverts the following commits:

    f55017a93f1a74d50244b1254b9a2bd7ac9bbf7d
    022c3f7d82f0f1c68018696f2f027b87b9bb45c2
    1aba721eba1d84a2defce45b950272cee1e6c72a
    cda42ebd67ee5fdf09d7057b5a4584d36fe8a335
    345cda2fd695534be5a4494f1b59da9daed33663
    dc343475ed062e13fc260acccaab91d7d80fd5b2
    05eaade2782fb0c90d3034fd7a7d5a16266182bb
    6a2a2d6bf8581216e08be15fcb563cfd6c430e1e

    Signed-off-by: David S. Miller

    David S. Miller
     

05 Nov, 2009

1 commit

  • This cleanup patch puts struct/union/enum opening braces,
    in first line to ease grep games.

    struct something
    {

    becomes :

    struct something {

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

29 Oct, 2009

4 commits


09 Sep, 2009

1 commit

  • Fix apparent thinko related to RTM_DELADDRLABEL, introduced by commit
    2a8cc6c89039e0530a3335954253b76ed0f9339a ("[IPV6] ADDRCONF: Support
    RFC3484 configurable address selection policy table.").

    Signed-off-by: Tushar Gohad
    Signed-off-by: David S. Miller

    Tushar Gohad
     

20 Mar, 2009

1 commit

  • To improve manageability, it would be good to be able to disambiguate routes
    added by administrator from those added by DHCP client. The only necessary
    kernel change is to add value to rtnetlink include file so iproute2 utility
    can use it.

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

    Stephen Hemminger
     

25 Feb, 2009

1 commit

  • This patch changes the return value of nlmsg_notify() as follows:

    If NETLINK_BROADCAST_ERROR is set by any of the listeners and
    an error in the delivery happened, return the broadcast error;
    else if there are no listeners apart from the socket that
    requested a change with the echo flag, return the result of the
    unicast notification. Thus, with this patch, the unicast
    notification is handled in the same way of a broadcast listener
    that has set the NETLINK_BROADCAST_ERROR socket flag.

    This patch is useful in case that the caller of nlmsg_notify()
    wants to know the result of the delivery of a netlink notification
    (including the broadcast delivery) and take any action in case
    that the delivery failed. For example, ctnetlink can drop packets
    if the event delivery failed to provide reliable logging and
    state-synchronization at the cost of dropping packets.

    This patch also modifies the rtnetlink code to ignore the return
    value of rtnl_notify() in all callers. The function rtnl_notify()
    (before this patch) returned the error of the unicast notification
    which makes rtnl_set_sk_err() reports errors to all listeners. This
    is not of any help since the origin of the change (the socket that
    requested the echoing) notices the ENOBUFS error if the notification
    fails and should resync itself.

    Signed-off-by: Pablo Neira Ayuso
    Acked-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Pablo Neira Ayuso
     

31 Jan, 2009

1 commit


21 Nov, 2008

1 commit

  • This adds support for Data Center Bridging (DCB) features in the ixgbe
    driver and adds an rtnetlink interface for configuring DCB to the
    kernel. The DCB feature support included are Priority Grouping (PG) -
    which allows bandwidth guarantees to be allocated to groups to traffic
    based on the 802.1q priority, and Priority Based Flow Control (PFC) -
    which introduces a new MAC control PAUSE frame which works at
    granularity of the 802.1p priority instead of the link (IEEE 802.3x).

    Signed-off-by: Alexander Duyck
    Signed-off-by: Jeff Kirsher
    Signed-off-by: Peter P Waskiewicz Jr
    Signed-off-by: David S. Miller

    Alexander Duyck