30 Jun, 2016

1 commit

  • This patch adds support for the IFLA_STATS_LINK_XSTATS_SLAVE attribute
    which allows to export per-slave statistics if the master device supports
    the linkxstats callback. The attribute is passed down to the linkxstats
    callback and it is up to the callback user to use it (an example has been
    added to the only current user - the bridge). This allows us to query only
    specific slaves of master devices like bridge ports and export only what
    we're interested in instead of having to dump all ports and searching only
    for a single one. This will be used to export per-port IGMP/MLD stats and
    also per-port vlan stats in the future, possibly other statistics as well.

    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

03 May, 2016

1 commit

  • Add callbacks to calculate the size and fill link extended statistics
    which can be split into multiple messages and are dumped via the new
    rtnl stats API (RTM_GETSTATS) with the IFLA_STATS_LINK_XSTATS attribute.
    Also add that attribute to the idx mask check since it is expected to
    be able to save state and resume dumping (e.g. future bridge per-vlan
    stats will be dumped via this attribute and callbacks).
    Each link type should nest its private attributes under the per-link type
    attribute. This allows to have any number of separated private attributes
    and to avoid one call to get the dev link type.

    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: David S. Miller

    Nikolay Aleksandrov
     

22 Oct, 2015

1 commit

  • if_nlmsg_size() overestimates the minimum allocation size of netlink
    dump request (when called from rtnl_calcit()) or the size of the
    message (when called from rtnl_getlink()). This is because
    ext_filter_mask is not supported by rtnl_link_get_af_size() and
    rtnl_link_get_size().

    The over-estimation is significant when at least one netdev has many
    VLANs configured (8 bytes for each configured VLAN).

    This patch-set "rightsizes" the protocol specific attribute size
    calculation by propagating ext_filter_mask to rtnl_link_get_af_size()
    and adding this a argument to get_link_af_size op in rtnl_af_ops.

    Bridge module already used filtering aware sizing for notifications.
    br_get_link_af_size_filtered() is consistent with the modified
    get_link_af_size op so it replaces br_get_link_af_size() in br_af_ops.
    br_get_link_af_size() becomes unused and thus removed.

    Signed-off-by: Ronen Arad
    Acked-by: Sridhar Samudrala
    Signed-off-by: David S. Miller

    Arad, Ronen
     

16 Sep, 2015

1 commit

  • Many commonly used functions like getifaddrs() invoke RTM_GETLINK
    to dump the interface information, and do not need the
    the AF_INET6 statististics that are always returned by default
    from rtnl_fill_ifinfo().

    Computing the statistics can be an expensive operation that impacts
    scaling, so it is desirable to avoid this if the information is
    not needed.

    This patch adds a the RTEXT_FILTER_SKIP_STATS extended info flag that
    can be passed with netlink_request() to avoid statistics computation
    for the ifinfo path.

    Signed-off-by: Sowmini Varadhan
    Signed-off-by: David S. Miller

    Sowmini Varadhan
     

22 Jul, 2015

1 commit

  • This gets rid of all OVS specific VXLAN code in the receive and
    transmit path by using a VXLAN net_device to represent the vport.
    Only a small shim layer remains which takes care of handling the
    VXLAN specific OVS Netlink configuration.

    Unexports vxlan_sock_add(), vxlan_sock_release(), vxlan_xmit_skb()
    since they are no longer needed.

    Signed-off-by: Thomas Graf
    Signed-off-by: Pravin B Shelar
    Signed-off-by: David S. Miller

    Thomas Graf
     

11 Apr, 2015

1 commit


20 Jan, 2015

1 commit

  • This patch adds a new attribute (IFLA_LINK_NETNSID) which contains the 'link'
    netns id when this netns is different from the netns where the interface
    stands (for example for x-net interfaces like ip tunnels).
    With this attribute, it's possible to interpret correctly all advertised
    information (like IFLA_LINK, etc.).

    Signed-off-by: Nicolas Dichtel
    Signed-off-by: David S. Miller

    Nicolas Dichtel
     

16 Jul, 2014

1 commit


19 Feb, 2014

1 commit


23 Jan, 2014

1 commit

  • Recent patch
    bonding: add netlink attributes to slave link dev (1d3ee88ae0d6)

    Introduced yet another device specific way to access slave information
    over rtnetlink. There is one already there for bridge.

    This patch introduces generic way to do this, for getting and setting
    info as well by extending link_ops. Later on, this new interface will
    be used for bridge ports as well.

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

02 Jan, 2014

1 commit


23 Sep, 2013

1 commit

  • There are a mix of function prototypes with and without extern
    in the kernel sources. Standardize on not using extern for
    function prototypes.

    Function prototypes don't need to be written with extern.
    extern is assumed by the compiler. Its use is as unnecessary as
    using auto to declare automatic/local variables in a block.

    Signed-off-by: Joe Perches
    Signed-off-by: David S. Miller

    Joe Perches
     

22 Mar, 2013

1 commit


01 Dec, 2012

1 commit

  • This patch removes an unused parameter (src_net) from rtnl_create_link()
    method and from the method single invocation, in veth.
    This parameter was used in the past when calling
    ops->get_tx_queues(src_net, tb) in rtnl_create_link().
    The get_tx_queues() member of rtnl_link_ops was replaced by two methods,
    get_num_tx_queues() and get_num_rx_queues(), which do not get any
    parameter. This was done in commit d40156aa5ecbd51fed932ed4813df82b56e5ff4d by
    Jiri Pirko ("rtnl: allow to specify different num for rx and tx queue count").

    Signed-off-by: Rami Rosen
    Signed-off-by: David S. Miller

    Rami Rosen
     

21 Jul, 2012

1 commit


14 Apr, 2012

3 commits


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
     

10 Jun, 2011

1 commit

  • The message size allocated for rtnl ifinfo dumps was limited to
    a single page. This is not enough for additional interface info
    available with devices that support SR-IOV and caused a bug in
    which VF info would not be displayed if more than approximately
    40 VFs were created per interface.

    Implement a new function pointer for the rtnl_register service that will
    calculate the amount of data required for the ifinfo dump and allocate
    enough data to satisfy the request.

    Signed-off-by: Greg Rose
    Signed-off-by: Jeff Kirsher

    Greg Rose
     

28 Nov, 2010

1 commit

  • As David pointed out correctly, updates to af-specific attributes
    are currently not atomic. If multiple changes are requested and
    one of them fails, previous updates may have been applied already
    leaving the link behind in a undefined state.

    This patch splits the function parse_link_af() into two functions
    validate_link_af() and set_link_at(). validate_link_af() is placed
    to validate_linkmsg() check for errors as early as possible before
    any changes to the link have been made. set_link_af() is called to
    commit the changes later.

    This method is not fail proof, while it is currently sufficient
    to make set_link_af() inerrable and thus 100% atomic, the
    validation function method will not be able to detect all error
    scenarios in the future, there will likely always be errors
    depending on states which are f.e. not protected by rtnl_mutex
    and thus may change between validation and setting.

    Also, instead of silently ignoring unknown address families and
    config blocks for address families which did not register a set
    function the errors EAFNOSUPPORT respectively EOPNOSUPPORT are
    returned to avoid comitting 4 out of 5 update requests without
    notifying the user.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     

18 Nov, 2010

1 commit

  • Each net_device contains address family specific data such as
    per device settings and statistics. We already expose this data
    via procfs/sysfs and partially netlink.

    The netlink method requires the requester to send one RTM_GETLINK
    request for each address family it wishes to receive data of
    and then merge this data itself.

    This patch implements a new API which combines all address family
    specific link data in a new netlink attribute IFLA_AF_SPEC.
    IFLA_AF_SPEC contains a sequence of nested attributes, one for each
    address family which in turn defines the structure of its own
    attribute. Example:

    [IFLA_AF_SPEC] = {
    [AF_INET] = {
    [IFLA_INET_CONF] = ...,
    },
    [AF_INET6] = {
    [IFLA_INET6_FLAGS] = ...,
    [IFLA_INET6_CONF] = ...,
    }
    }

    The API also allows for address families to implement a function
    which parses the IFLA_AF_SPEC attribute sent by userspace to
    implement address family specific link options.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     

21 Oct, 2010

1 commit


27 Feb, 2010

1 commit

  • commit e8469ed959c373c2ff9e6f488aa5a14971aebe1f
    Author: Patrick McHardy
    Date: Tue Feb 23 20:41:30 2010 +0100

    Support specifying the initial device flags when creating a device though
    rtnl_link. Devices allocated by rtnl_create_link() are marked as INITIALIZING
    in order to surpress netlink registration notifications. To complete setup,
    rtnl_configure_link() must be called, which performs the device flag changes
    and invokes the deferred notifiers if everything went well.

    Two examples:

    # add macvlan to eth0
    #
    $ ip link add link eth0 up allmulticast on type macvlan

    [LINK]11: macvlan0@eth0: mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 26:f8:84:02:f9:2a brd ff:ff:ff:ff:ff:ff
    [ROUTE]ff00::/8 dev macvlan0 table local metric 256 mtu 1500 advmss 1440 hoplimit 0
    [ROUTE]fe80::/64 dev macvlan0 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit 0
    [LINK]11: macvlan0@eth0: mtu 1500
    link/ether 26:f8:84:02:f9:2a
    [ADDR]11: macvlan0 inet6 fe80::24f8:84ff:fe02:f92a/64 scope link
    valid_lft forever preferred_lft forever
    [ROUTE]local fe80::24f8:84ff:fe02:f92a via :: dev lo table local proto none metric 0 mtu 16436 advmss 16376 hoplimit 0
    [ROUTE]default via fe80::215:e9ff:fef0:10f8 dev macvlan0 proto kernel metric 1024 mtu 1500 advmss 1440 hoplimit 0
    [NEIGH]fe80::215:e9ff:fef0:10f8 dev macvlan0 lladdr 00:15:e9:f0:10:f8 router STALE
    [ROUTE]2001:6f8:974::/64 dev macvlan0 proto kernel metric 256 expires 0sec mtu 1500 advmss 1440 hoplimit 0
    [PREFIX]prefix 2001:6f8:974::/64 dev macvlan0 onlink autoconf valid 14400 preferred 131084
    [ADDR]11: macvlan0 inet6 2001:6f8:974:0:24f8:84ff:fe02:f92a/64 scope global dynamic
    valid_lft 86399sec preferred_lft 14399sec

    # add VLAN to eth1, eth1 is down
    #
    $ ip link add link eth1 up type vlan id 1000
    RTNETLINK answers: Network is down

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

    Patrick McHardy
     

08 Nov, 2009

1 commit

  • There is no good reason to not support userspace specifying the
    network namespace during device creation, and it makes it easier
    to create a network device and pass it to a child network namespace
    with a well known name.

    We have to be careful to ensure that the target network namespace
    for the new device exists through the life of the call. To keep
    that logic clear I have factored out the network namespace grabbing
    logic into rtnl_link_get_net.

    In addtion we need to continue to pass the source network namespace
    to the rtnl_link_ops.newlink method so that we can find the base
    device source network namespace.

    Signed-off-by: Eric W. Biederman
    Acked-by: Eric Dumazet

    Eric W. Biederman
     

28 Oct, 2009

1 commit


11 Sep, 2009

1 commit


03 Sep, 2009

1 commit

  • vlan devices are currently not multi-queue capable.

    We can do that with a new rtnl_link_ops method,
    get_tx_queues(), called from rtnl_create_link()

    This new method gets num_tx_queues/real_num_tx_queues
    from real device.

    register_vlan_device() is also handled.

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

    Eric Dumazet
     

25 Aug, 2009

1 commit


16 Apr, 2008

1 commit


11 Oct, 2007

2 commits

  • 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
     
  • This routine gets the parsed rtnl attributes and creates a new
    link with generic info (IFLA_LINKINFO policy). Its intention
    is to help the drivers, that need to create several links at
    once (like VETH).

    This is nothing but a copy-paste-ed part of rtnl_newlink() function
    that is responsible for creation of new device.

    Signed-off-by: Pavel Emelianov
    Acked-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Pavel Emelianov
     

11 Jul, 2007

1 commit


26 Apr, 2007

3 commits

  • - make the following needlessly global variables static:
    - core/rtnetlink.c: struct rtnl_msg_handlers[]
    - netfilter/nf_conntrack_proto.c: struct nf_ct_protos[]
    - make the following needlessly global functions static:
    - core/rtnetlink.c: rtnl_dump_all()
    - netlink/af_netlink.c: netlink_queue_skip()

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: David S. Miller

    Adrian Bunk
     
  • Implements a unified, protocol independant rules dumping function
    which is capable of both, dumping a specific protocol family or
    all of them. This speeds up dumping as less lookups are required.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • This patch adds a new interface to register rtnetlink message
    handlers replacing the exported rtnl_links[] array which
    required many message handlers to be exported unnecessarly.

    Signed-off-by: Thomas Graf
    Signed-off-by: David S. Miller

    Thomas Graf