1. 12 1月, 2017 1 次提交
    • A
      wext: handle NULL extra data in iwe_stream_add_point better · 93be2b74
      Arnd Bergmann 提交于
      gcc-7 complains that wl3501_cs passes NULL into a function that
      then uses the argument as the input for memcpy:
      
      drivers/net/wireless/wl3501_cs.c: In function 'wl3501_get_scan':
      include/net/iw_handler.h:559:3: error: argument 2 null where non-null expected [-Werror=nonnull]
         memcpy(stream + point_len, extra, iwe->u.data.length);
      
      This works fine here because iwe->u.data.length is guaranteed to be 0
      and the memcpy doesn't actually have an effect.
      
      Making the length check explicit avoids the warning and should have
      no other effect here.
      
      Also check the pointer itself, since otherwise we get warnings
      elsewhere in the code.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      93be2b74
  2. 09 1月, 2017 1 次提交
  3. 06 1月, 2017 1 次提交
    • R
      cfg80211: support ieee80211-freq-limit DT property · e691ac2f
      Rafał Miłecki 提交于
      This patch adds a helper for reading that new property and applying
      limitations of supported channels specified this way.
      It is used with devices that normally support a wide wireless band but
      in a given config are limited to some part of it (usually due to board
      design). For example a dual-band chipset may be able to support one band
      only because of used antennas.
      It's also common that tri-band routers have separated radios for lower
      and higher part of 5 GHz band and it may be impossible to say which is
      which without a DT info.
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      [add new function to documentation, fix link]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e691ac2f
  4. 05 1月, 2017 1 次提交
  5. 13 12月, 2016 1 次提交
  6. 09 12月, 2016 4 次提交
  7. 07 12月, 2016 10 次提交
  8. 06 12月, 2016 2 次提交
    • E
      net_sched: gen_estimator: complete rewrite of rate estimators · 1c0d32fd
      Eric Dumazet 提交于
      1) Old code was hard to maintain, due to complex lock chains.
         (We probably will be able to remove some kfree_rcu() in callers)
      
      2) Using a single timer to update all estimators does not scale.
      
      3) Code was buggy on 32bit kernel (WRITE_ONCE() on 64bit quantity
         is not supposed to work well)
      
      In this rewrite :
      
      - I removed the RB tree that had to be scanned in
        gen_estimator_active(). qdisc dumps should be much faster.
      
      - Each estimator has its own timer.
      
      - Estimations are maintained in net_rate_estimator structure,
        instead of dirtying the qdisc. Minor, but part of the simplification.
      
      - Reading the estimator uses RCU and a seqcount to provide proper
        support for 32bit kernels.
      
      - We reduce memory need when estimators are not used, since
        we store a pointer, instead of the bytes/packets counters.
      
      - xt_rateest_mt() no longer has to grab a spinlock.
        (In the future, xt_rateest_tg() could be switched to per cpu counters)
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1c0d32fd
    • E
      net: reorganize struct sock for better data locality · 9115e8cd
      Eric Dumazet 提交于
      Group fields used in TX path, and keep some cache lines mostly read
      to permit sharing among cpus.
      
      Gained two 4 bytes holes on 64bit arches.
      
      Added a place holder for tcp tsq_flags, next to sk_wmem_alloc
      to speed up tcp_wfree() in the following patch.
      
      I have not added ____cacheline_aligned_in_smp, this might be done later.
      I prefer doing this once inet and tcp/udp sockets reorg is also done.
      
      Tested with both TCP and UDP.
      
      UDP receiver performance under flood increased by ~20 % :
      Accessing sk_filter/sk_wq/sk_napi_id no longer stalls because sk_drops
      was moved away from a critical cache line, now mostly read and shared.
      
      	/* --- cacheline 4 boundary (256 bytes) --- */
      	unsigned int               sk_napi_id;           /* 0x100   0x4 */
      	int                        sk_rcvbuf;            /* 0x104   0x4 */
      	struct sk_filter *         sk_filter;            /* 0x108   0x8 */
      	union {
      		struct socket_wq * sk_wq;                /*         0x8 */
      		struct socket_wq * sk_wq_raw;            /*         0x8 */
      	};                                               /* 0x110   0x8 */
      	struct xfrm_policy *       sk_policy[2];         /* 0x118  0x10 */
      	struct dst_entry *         sk_rx_dst;            /* 0x128   0x8 */
      	struct dst_entry *         sk_dst_cache;         /* 0x130   0x8 */
      	atomic_t                   sk_omem_alloc;        /* 0x138   0x4 */
      	int                        sk_sndbuf;            /* 0x13c   0x4 */
      	/* --- cacheline 5 boundary (320 bytes) --- */
      	int                        sk_wmem_queued;       /* 0x140   0x4 */
      	atomic_t                   sk_wmem_alloc;        /* 0x144   0x4 */
      	long unsigned int          sk_tsq_flags;         /* 0x148   0x8 */
      	struct sk_buff *           sk_send_head;         /* 0x150   0x8 */
      	struct sk_buff_head        sk_write_queue;       /* 0x158  0x18 */
      	__s32                      sk_peek_off;          /* 0x170   0x4 */
      	int                        sk_write_pending;     /* 0x174   0x4 */
      	long int                   sk_sndtimeo;          /* 0x178   0x8 */
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Tested-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9115e8cd
  9. 05 12月, 2016 11 次提交
  10. 04 12月, 2016 7 次提交
    • E
      ipv6 addrconf: Implemented enhanced DAD (RFC7527) · adc176c5
      Erik Nordmark 提交于
      Implemented RFC7527 Enhanced DAD.
      IPv6 duplicate address detection can fail if there is some temporary
      loopback of Ethernet frames. RFC7527 solves this by including a random
      nonce in the NS messages used for DAD, and if an NS is received with the
      same nonce it is assumed to be a looped back DAD probe and is ignored.
      RFC7527 is enabled by default. Can be disabled by setting both of
      conf/{all,interface}/enhanced_dad to zero.
      Signed-off-by: NErik Nordmark <nordmark@arista.com>
      Signed-off-by: NBob Gilligan <gilligan@arista.com>
      Reviewed-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      adc176c5
    • I
      ipv4: fib: Replay events when registering FIB notifier · c3852ef7
      Ido Schimmel 提交于
      Commit b90eb754 ("fib: introduce FIB notification infrastructure")
      introduced a new notification chain to notify listeners (f.e., switchdev
      drivers) about addition and deletion of routes.
      
      However, upon registration to the chain the FIB tables can already be
      populated, which means potential listeners will have an incomplete view
      of the tables.
      
      Solve that by dumping the FIB tables and replaying the events to the
      passed notification block. The dump itself is done using RCU in order
      not to starve consumers that need RTNL to make progress.
      
      The integrity of the dump is ensured by reading the FIB change sequence
      counter before and after the dump under RTNL. This allows us to avoid
      the problematic situation in which the dumping process sends a ENTRY_ADD
      notification following ENTRY_DEL generated by another process holding
      RTNL.
      
      Callers of the registration function may pass a callback that is
      executed in case the dump was inconsistent with current FIB tables.
      
      The number of retries until a consistent dump is achieved is set to a
      fixed number to prevent callers from looping for long periods of time.
      In case current limit proves to be problematic in the future, it can be
      easily converted to be configurable using a sysctl.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c3852ef7
    • I
      ipv4: fib: Allow for consistent FIB dumping · cacaad11
      Ido Schimmel 提交于
      The next patch will enable listeners of the FIB notification chain to
      request a dump of the FIB tables. However, since RTNL isn't taken during
      the dump, it's possible for the FIB tables to change mid-dump, which
      will result in inconsistency between the listener's table and the
      kernel's.
      
      Allow listeners to know about changes that occurred mid-dump, by adding
      a change sequence counter to each net namespace. The counter is
      incremented just before a notification is sent in the FIB chain.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cacaad11
    • I
      ipv4: fib: Add fib_info_hold() helper · 1c677b3d
      Ido Schimmel 提交于
      As explained in the previous commit, modules are going to need to take a
      reference on fib info and then drop it using fib_info_put().
      
      Add the fib_info_hold() helper to make the code more readable and also
      symmetric with fib_info_put().
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Suggested-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1c677b3d
    • A
      netns: fix net_generic() "id - 1" bloat · 6af2d5ff
      Alexey Dobriyan 提交于
      net_generic() function is both a) inline and b) used ~600 times.
      
      It has the following code inside
      
      		...
      	ptr = ng->ptr[id - 1];
      		...
      
      "id" is never compile time constant so compiler is forced to subtract 1.
      And those decrements or LEA [r32 - 1] instructions add up.
      
      We also start id'ing from 1 to catch bugs where pernet sybsystem id
      is not initialized and 0. This is quite pointless idea (nothing will
      work or immediate interference with first registered subsystem) in
      general but it hints what needs to be done for code size reduction.
      
      Namely, overlaying allocation of pointer array and fixed part of
      structure in the beginning and using usual base-0 addressing.
      
      Ids are just cookies, their exact values do not matter, so lets start
      with 3 on x86_64.
      
      Code size savings (oh boy): -4.2 KB
      
      As usual, ignore the initial compiler stupidity part of the table.
      
      	add/remove: 0/0 grow/shrink: 12/670 up/down: 89/-4297 (-4208)
      	function                                     old     new   delta
      	tipc_nametbl_insert_publ                    1250    1270     +20
      	nlmclnt_lookup_host                          686     703     +17
      	nfsd4_encode_fattr                          5930    5941     +11
      	nfs_get_client                              1050    1061     +11
      	register_pernet_operations                   333     342      +9
      	tcf_mirred_init                              843     849      +6
      	tcf_bpf_init                                1143    1149      +6
      	gss_setup_upcall                             990     994      +4
      	idmap_name_to_id                             432     434      +2
      	ops_init                                     274     275      +1
      	nfsd_inject_forget_client                    259     260      +1
      	nfs4_alloc_client                            612     613      +1
      	tunnel_key_walker                            164     163      -1
      
      		...
      
      	tipc_bcbase_select_primary                   392     360     -32
      	mac80211_hwsim_new_radio                    2808    2767     -41
      	ipip6_tunnel_ioctl                          2228    2186     -42
      	tipc_bcast_rcv                               715     672     -43
      	tipc_link_build_proto_msg                   1140    1089     -51
      	nfsd4_lock                                  3851    3796     -55
      	tipc_mon_rcv                                1012     956     -56
      	Total: Before=156643951, After=156639743, chg -0.00%
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6af2d5ff
    • A
      netns: add dummy struct inside "struct net_generic" · 9bfc7b99
      Alexey Dobriyan 提交于
      This is precursor to fixing "[id - 1]" bloat inside net_generic().
      
      Name "s" is chosen to complement name "u" often used for dummy unions.
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9bfc7b99
    • A
      netlink: 2-clause nla_ok() · 4f7df337
      Alexey Dobriyan 提交于
      nla_ok() consists of 3 clauses:
      
      	1) int rem >= (int)sizeof(struct nlattr)
      
      	2) u16 nla_len >= sizeof(struct nlattr)
      
      	3) u16 nla_len <= int rem
      
      The statement is that clause (1) is redundant.
      
      What it does is ensuring that "rem" is a positive number,
      so that in clause (3) positive number will be compared to positive number
      with no problems.
      
      However, "u16" fully fits into "int" and integers do not change value
      when upcasting even to signed type. Negative integers will be rejected
      by clause (3) just fine. Small positive integers will be rejected
      by transitivity of comparison operator.
      
      NOTE: all of the above DOES NOT apply to nlmsg_ok() where ->nlmsg_len is
      u32(!), so 3 clauses AND A CAST TO INT are necessary.
      
      Obligatory space savings report: -1.6 KB
      
      	$ ./scripts/bloat-o-meter ../vmlinux-000* ../vmlinux-001*
      	add/remove: 0/0 grow/shrink: 3/63 up/down: 35/-1692 (-1657)
      	function                                     old     new   delta
      	validate_scan_freqs                          142     155     +13
      	tcf_em_tree_validate                         867     879     +12
      	dcbnl_ieee_del                               328     338     +10
      	netlbl_cipsov4_add_common.isra               218     215      -3
      		...
      	ovs_nla_put_actions                          888     806     -82
      	netlbl_cipsov4_add_std                      1648    1566     -82
      	nl80211_parse_sched_scan                    2889    2780    -109
      	ip_tun_from_nlattr                          3086    2945    -141
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4f7df337
  11. 03 12月, 2016 1 次提交