aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-04-01drivers: net: aurora: use netdev_xmit_more helperFlorian Westphal2-5/+5
This is the last driver using always-0 skb->xmit_more. Switch it to netdev_xmit_more and remove the now unused xmit_more flag from sk_buff. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01drivers: net: sfc: use netdev_xmit_more helperFlorian Westphal2-9/+7
skb->xmit_more hint is now always 0, this switches the sfc driver to use the netdev_xmit_more helper instead. Cc: Solarflare linux maintainers <linux-net-drivers@solarflare.com> Cc: Edward Cree <ecree@solarflare.com> Cc: Bert Kenward <bkenward@solarflare.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01drivers: mellanox: use netdev_xmit_more() helperFlorian Westphal4-12/+12
skb->xmit_more hint is now always 0. This switches the mellanox drivers to the netdev_xmit_more() helper. Cc: Saeed Mahameed <saeedm@mellanox.com> Cc: Leon Romanovsky <leon@kernel.org> Cc: Boris Pismenny <borisp@mellanox.com> Cc: Ilya Lesokhin <ilyal@mellanox.com> Cc: Eran Ben Elisha <eranbe@mellanox.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: move skb->xmit_more hint to softnet dataFlorian Westphal29-32/+35
There are two reasons for this. First, the xmit_more flag conceptually doesn't fit into the skb, as xmit_more is not a property related to the skb. Its only a hint to the driver that the stack is about to transmit another packet immediately. Second, it was only done this way to not have to pass another argument to ndo_start_xmit(). We can place xmit_more in the softnet data, next to the device recursion. The recursion counter is already written to on each transmit. The "more" indicator is placed right next to it. Drivers can use the netdev_xmit_more() helper instead of skb->xmit_more to check the "more packets coming" hint. skb->xmit_more is retained (but always 0) to not cause build breakage. This change takes care of the simple s/skb->xmit_more/netdev_xmit_more()/ conversions. Remaining drivers are converted in the next patches. Suggested-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: place xmit recursion in softnet dataFlorian Westphal3-18/+38
This fills a hole in softnet data, so no change in structure size. Also prepares for xmit_more placement in the same spot; skb->xmit_more will be removed in followup patch. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: phy: aquantia: add SGMII statisticsHeiner Kallweit1-2/+112
The AQR107 family has SGMII statistics counters. Let's expose them to ethtool. To interpret the counters correctly one has to be aware that rx on SGMII side is tx on ethernet side. The counters are populated by the chip in 100Mbps/1Gbps mode only. v2: - add constant AQR107_SGMII_STAT_SZ - add struct aqr107_priv to be prepared for more private data fields - let aqr107_get_stat() return U64_MAX in case of an error Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: use rcu_dereference_protected to fetch sk_dst_cache in sk_destructXin Long2-2/+2
As Eric noticed, in .sk_destruct, sk->sk_dst_cache update is prevented, and no barrier is needed for this. So change to use rcu_dereference_protected() instead of rcu_dereference_check() to fetch sk_dst_cache in there. v1->v2: - no change, repost after net-next is open. Reported-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: phy: improve genphy_read_statusHeiner Kallweit1-15/+8
This patch improves few aspects of genphy_read_status(): - Don't initialize lpagb, it's not needed. - Move initializing phydev->speed et al before the if clause. - In auto-neg case, skip populating lp_advertising if we don't have a link. This avoids quite some unnecessary MDIO reads in case of phylib polling mode. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01Merge branch 'nfp-flower-improvement-and-SFF-module-EEPROM'David S. Miller4-77/+323
Jakub Kicinski says: ==================== nfp: flower improvement and SFF module EEPROM The first patch in this series from Pieter improves the handling of mangle actions in TC flower offload. These used to be sent down to the driver in groups, but after Pablo N's patches they are split out causing suboptimal expression. The ramaining two patches from Dirk add support for reading SFF module EEPROM data. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01nfp: implement ethtool get module EEPROMDirk van der Merwe1-0/+131
Now that the NSP provides the ability to read from the SFF modules' EEPROM, we can use this interface to implement the ethtool callback. If the NSP only provides partial data, we log the event from within the driver but pass a success code to ethtool to prevent it from discarding the partial data. Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01nfp: nsp: implement read SFF module EEPROMDirk van der Merwe2-0/+70
The NSP now provides the ability to read from the SFF module EEPROM. Note that even if an error occurs, the NSP may still provide some of the data. Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01nfp: flower: reduce action list size by coalescing mangle actionsPieter Jansen van Vuuren1-77/+122
With the introduction of flow_action_for_each pedit actions are no longer grouped together, instead pedit actions are broken out per 32 byte word. This results in an inefficient use of the action list that is pushed to hardware where each 32 byte word becomes its own action. Therefore we combine groups of 32 byte word before sending the action list to hardware. Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: phy: aquantia: add suspend / resume callbacks for AQR107 familyHeiner Kallweit1-0/+16
Add suspend / resume callbacks for AQR107 family. Suspend powers down the complete chip except MDIO and internal CPU. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: ethernet: ti: davinci_mdio: switch to readl/writel()Grygorii Strashko1-11/+11
Switch to readl/writel() APIs, because this is recommended API and the MDIO block is reused on Keystone 2 SoCs where LE/BE modes are supported. Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01Merge branch 'cxgb3-undefined-behaviour-and-use-struct_size'David S. Miller2-3/+3
Gustavo A. R. Silva says: ==================== cxgb3/l2t: Fix undefined behaviour and use struct_size() helper This patchset aims to fix an undefined behaviour when using a zero-sized array and, add the use of the struct_size() helper in kvzalloc(). You might consider the first patch in this series for stable. More details in the commit logs. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01cxgb3/l2t: Use struct_size() in kvzalloc()Gustavo A. R. Silva1-2/+2
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; struct boo entry[]; }; size = sizeof(struct foo) + count * sizeof(struct boo); instance = kvzalloc(size, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kvzalloc(struct_size(instance, entry, count), GFP_KERNEL); Notice that, in this case, variable size is not necessary, hence it is removed. This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01cxgb3/l2t: Fix undefined behaviourGustavo A. R. Silva1-1/+1
The use of zero-sized array causes undefined behaviour when it is not the last member in a structure. As it happens to be in this case. Also, the current code makes use of a language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as this one is a flexible array member, introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last. Which is beneficial to cultivate a high-quality code. Fixes: e48f129c2f20 ("[SCSI] cxgb3i: convert cdev->l2opt to use rcu to prevent NULL dereference") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01net: dsa: read mac address from DT for slave deviceXiaofei Shen3-1/+6
Before creating a slave netdevice, get the mac address from DTS and apply in case it is valid. Signed-off-by: Xiaofei Shen <xiaofeis@codeaurora.org> Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-04-01tcp: fix tcp_inet6_sk() for 32bit kernelsEric Dumazet1-2/+3
It turns out that struct ipv6_pinfo is not located as we think. inet6_sk_generic() and tcp_inet6_sk() disagree on 32bit kernels by 4-bytes, because struct tcp_sock has 8-bytes alignment, but ipv6_pinfo size is not a multiple of 8. sizeof(struct ipv6_pinfo): 116 (not padded to 8) I actually first coded tcp_inet6_sk() as this patch does, but thought that "container_of(tcp_sk(sk), struct tcp6_sock, tcp)" was cleaner. As Julian told me : Nobody should use tcp6_sock.inet6 directly, it should be accessed via tcp_inet6_sk() or inet6_sk(). This happened when we added the first u64 field in struct tcp_sock. Fixes: 93a77c11ae79 ("tcp: add tcp_inet6_sk() helper") Signed-off-by: Eric Dumazet <edumazet@google.com> Bisected-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-31r8169: use netif_receive_skb_list batchingHeiner Kallweit1-1/+4
Use netif_receive_skb_list() instead of napi_gro_receive() to benefit from batched skb processing. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-31Merge branch 'mlxsw-spectrum_acl-Get-rid-of-failed_rollback-mechanism'David S. Miller2-21/+17
Ido Schimmel says: ==================== mlxsw: spectrum_acl: Get rid of failed_rollback mechanism Jiri says: Currently if vregion rehash fails, it rolls back to the original ERP set. However, in case of unlikely rollback fail, the vregion is in a zombie state and never gets rehashed again. With the recent changes, it is possible to try to continue the rollback. Do it from the last failed ventry. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-31mlxsw: spectrum_acl: Rename rehash_dis traceJiri Pirko2-3/+3
The name of the trace is no longer correct, since there is no disable of rehash done. So name it "rehash_rollback_failed". Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-31mlxsw: spectrum_acl: Remove failed_rollback dead endJiri Pirko1-10/+10
Currently if a rollback ends with error, the vregion is in a zombie state until end of the existence. Instead of that, rather try to continue where rollback ended later on (after rehash interval). Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-31mlxsw: spectrum_acl: Move rehash_dis trace call and err msg to vregion_migrate()Jiri Pirko1-6/+5
Move the call of rehash_dis trace and the error message to vregion_migrate() next to the failed_rollback flag set. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-31mlxsw: spectrum_acl: Remove redundant failed_rollback from migrate_start()Jiri Pirko1-4/+1
The flag is set by the caller mlxsw_sp_acl_tcam_vregion_migrate() anyway, so don't set it here. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29net: bridge: use netif_is_bridge_port()Julian Wiedmann4-9/+7
Replace the br_port_exists() macro with its twin from netdevice.h CC: Roopa Prabhu <roopa@cumulusnetworks.com> CC: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29team: use netif_is_team_port()Julian Wiedmann1-4/+2
Replace the team_port_exists() macro with its twin from netdevice.h CC: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29cxgb4/cxgb4vf: Display advertised FEC in ethtoolVishal Kulkarni5-65/+95
This patch advertises Forward Error Correction in ethtool Signed-off-by: Casey Leedom <leedom@chelsio.com> Signed-off-by: Vishal Kulkarni <vishal@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29cxgb4: Update 1.23.3.0 as the latest firmware supported.Vishal Kulkarni1-6/+6
Change t4fw_version.h to update latest firmware version number to 1.23.3.0. Signed-off-by: Vishal Kulkarni <vishal@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29openvswitch: Make metadata_dst tunnel work in IP_TUNNEL_INFO_BRIDGE modewenxu2-10/+37
There is currently no support for the multicast/broadcast aspects of VXLAN in ovs. In the datapath flow the tun_dst must specific. But in the IP_TUNNEL_INFO_BRIDGE mode the tun_dst can not be specific. And the packet can forward through the fdb table of vxlan devcice. In this mode the broadcast/multicast packet can be sent through the following ways in ovs. ovs-vsctl add-port br0 vxlan -- set in vxlan type=vxlan \ options:key=1000 options:remote_ip=flow ovs-ofctl add-flow br0 in_port=LOCAL,dl_dst=ff:ff:ff:ff:ff:ff, \ action=output:vxlan bridge fdb append ff:ff:ff:ff:ff:ff dev vxlan_sys_4789 dst 172.168.0.1 \ src_vni 1000 vni 1000 self bridge fdb append ff:ff:ff:ff:ff:ff dev vxlan_sys_4789 dst 172.168.0.2 \ src_vni 1000 vni 1000 self Signed-off-by: wenxu <wenxu@ucloud.cn> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29tcp: cleanup sk_tx_skb_cache before reuseEric Dumazet1-0/+2
TCP stack relies on the fact that a freshly allocated skb has skb->cb[] and skb_shinfo(skb)->tx_flags cleared. When recycling tx skb, we must ensure these fields are cleared. Fixes: 472c2e07eef0 ("tcp: add one skb cache for tx") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Soheil Hassas Yeganeh <soheil@google.com> Cc: Willem de Bruijn <willemb@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29MAINTAINERS: Fix mellanox Innova IPsecBoris Pismenny1-9/+0
The Innova IPsec driver is part of all Innova drivers, and its maintainenece is covered by an existing entry in this file. Signed-off-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29selftests: tc-testing: Add pedit testsDmytro Linkin1-0/+903
Add 36 pedit action tests to check pedit options described in tc-pedit(8) man page. Test cases can be specified by categories: actions, pedit, raw_op, layered_op. RAW_OP cases check offset option for u8, u16 and u32 offset size. LAYERED_OP cases check fields option for eth, ip, ip6, tcp and udp headers. Include following tests: 377e - Add pedit action with RAW_OP offset u32 a0ca - Add pedit action with RAW_OP offset u32 (INVALID) dd8a - Add pedit action with RAW_OP offset u16 u16 53db - Add pedit action with RAW_OP offset u16 (INVALID) 5c7e - Add pedit action with RAW_OP offset u8 add value 2893 - Add pedit action with RAW_OP offset u8 quad 3a07 - Add pedit action with RAW_OP offset u8-u16-u8 ab0f - Add pedit action with RAW_OP offset u16-u8-u8 9d12 - Add pedit action with RAW_OP offset u32 set u16 clear u8 invert ebfa - Add pedit action with RAW_OP offset overflow u32 (INVALID) f512 - Add pedit action with RAW_OP offset u16 at offmask shift set c2cb - Add pedit action with RAW_OP offset u32 retain value 86d4 - Add pedit action with LAYERED_OP eth set src & dst c715 - Add pedit action with LAYERED_OP eth set src (INVALID) ba22 - Add pedit action with LAYERED_OP eth type set/clear sequence 5810 - Add pedit action with LAYERED_OP ip set src & dst 1092 - Add pedit action with LAYERED_OP ip set ihl & dsfield 02d8 - Add pedit action with LAYERED_OP ip set ttl & protocol 3e2d - Add pedit action with LAYERED_OP ip set ttl (INVALID) 31ae - Add pedit action with LAYERED_OP ip ttl clear/set 486f - Add pedit action with LAYERED_OP ip set duplicate fields e790 - Add pedit action with LAYERED_OP ip set ce, df, mf, firstfrag, nofrag fields 6829 - Add pedit action with LAYERED_OP beyond ip set dport & sport afd8 - Add pedit action with LAYERED_OP beyond ip set icmp_type & icmp_code 3143 - Add pedit action with LAYERED_OP beyond ip set dport (INVALID) fc1f - Add pedit action with LAYERED_OP ip6 set src & dst 6d34 - Add pedit action with LAYERED_OP ip6 dst retain value (INVALID) 6f5e - Add pedit action with LAYERED_OP ip6 flow_lbl 6795 - Add pedit action with LAYERED_OP ip6 set payload_len, nexthdr, hoplimit 1442 - Add pedit action with LAYERED_OP tcp set dport & sport b7ac - Add pedit action with LAYERED_OP tcp sport set (INVALID) cfcc - Add pedit action with LAYERED_OP tcp flags set 3bc4 - Add pedit action with LAYERED_OP tcp set dport, sport & flags fields f1c8 - Add pedit action with LAYERED_OP udp set dport & sport d784 - Add pedit action with mixed RAW/LAYERED_OP #1 70ca - Add pedit action with mixed RAW/LAYERED_OP #2 Signed-off-by: Dmytro Linkin <dmitrolin@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv6: Move ipv6 stubs to a separate header fileDavid Ahern15-52/+76
The number of stubs is growing and has nothing to do with addrconf. Move the definition of the stubs to a separate header file and update users. In the move, drop the vxlan specific comment before ipv6_stub. Code move only; no functional change intended. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29Merge branch 'net-Move-fib_nh-and-fib6_nh-to-a-common-struct'David S. Miller19-569/+676
David Ahern says: ==================== net: Move fib_nh and fib6_nh to a common struct First set of three with the end goal of enabling IPv6 gateways with IPv4 routes. This set refactors ipv4 and ipv6 code to create init and release helpers for each protocol and moving common elements to a fib_nh_common struct. v3 - split the reject setting into 2 with helper to the checks. This avoids changing cfg->fc_flags in fib6_nh_init v2 - addressed Ido's comments: cleanup on failure path in nh_init helpers, ordering in fib6_nh_release, and removal of RTF_GATEWAY from fib6_info uses in mlxsw ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29net: Use common nexthop init and release helpersDavid Ahern3-37/+48
With fib_nh_common in place, move common initialization and release code into helpers used by both ipv4 and ipv6. For the moment, the init is just the lwt encap and the release is both the netdev reference and the the lwt state reference. More will be added later. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29net: Add fib_nh_common and update fib_nh and fib6_nhDavid Ahern4-19/+42
Add fib_nh_common struct with common nexthop attributes. Convert fib_nh and fib6_nh to use it. Use macros to move existing fib_nh_* references to the new nh_common.nhc_*. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv6: Rename fib6_nh entriesDavid Ahern9-127/+138
Rename fib6_nh entries that will be moved to a fib_nh_common struct. Specifically, the device, gateway, flags, and lwtstate are common with all nexthop definitions. In some places new temporary variables are declared or local variables renamed to maintain line lengths. Rename only; no functional change intended. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv4: Rename fib_nh entriesDavid Ahern10-174/+178
Rename fib_nh entries that will be moved to a fib_nh_common struct. Specifically, the device, oif, gateway, flags, scope, lwtstate, nh_weight and nh_upper_bound are common with all nexthop definitions. In the process shorten fib_nh_lwtstate to fib_nh_lws to avoid really long lines. Rename only; no functional change intended. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv6: Change rt6_add_nexthop and rt6_nexthop_info to take fib6_nhDavid Ahern1-19/+20
rt6_add_nexthop and rt6_nexthop_info only need the fib6_info for the gateway flag and the nexthop weight, and the presence of a gateway is now per-nexthop. Update the signatures to take a fib6_nh and nexthop weight and better align with the ipv4 versions. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv6: Refactor fib6_ignore_linkdownDavid Ahern2-18/+11
fib6_ignore_linkdown takes a fib6_info but only looks at the net_device and its IPv6 config. Change it to take a net_device over a fib6_info as its input argument. In addition, move it to a header file to make the check inline and usable later with IPv4 code without going through the ipv6 stub, and rename to ip6_ignore_linkdown since it is only checking the setting based on the ipv6 struct on a device. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv6: Move gateway checks to a fib6_nh settingDavid Ahern7-30/+41
The gateway setting is not per fib6_info entry but per-fib6_nh. Add a new fib_nh_has_gw flag to fib6_nh and convert references to RTF_GATEWAY to the new flag. For IPv6 address the flag is cheaper than checking that nh_gw is non-0 like IPv4 does. While this increases fib6_nh by 8-bytes, the effective allocation size of a fib6_info is unchanged. The 8 bytes is recovered later with a fib_nh_common change. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv6: Create cleanup helper for fib6_nhDavid Ahern3-4/+10
Move the fib6_nh cleanup code to a new helper, fib6_nh_release. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv6: Create init helper for fib6_nhDavid Ahern2-108/+145
Similar to IPv4, consolidate the fib6_nh initialization into a helper. As a new standalone function, add a cleanup path to put lwtstate on error. To avoid modifying fib6_config flags, move the reject check to a helper that is invoked once by fib6_nh_init to reset the device and then again in ip6_route_info_create to set the fib6_flags. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv4: Create cleanup helper for fib_nhDavid Ahern2-12/+18
Move the fib_nh cleanup code from free_fib_info_rcu into a new helper, fib_nh_release. Move classid accounting into fib_nh_release which is called per fib_nh to make accounting symmetrical with fib_nh_init. Export the helper to allow for use with nexthop objects in the future. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv4: Create init helper for fib_nhDavid Ahern2-89/+95
Consolidate the fib_nh initialization which is duplicated between fib_create_info for single path and fib_get_nhs for multipath. Export the helper to allow for use with nexthop objects in the future. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv4: Move IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN to helperDavid Ahern3-27/+22
in_dev lookup followed by IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN check is called in several places, some with the rcu lock and others with the rtnl held. Move the check to a helper similar to what IPv6 has. Since the helper can be invoked from either context use rcu_dereference_rtnl to dereference ip_ptr. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-29ipv4: Define fib_get_nhs when CONFIG_IP_ROUTE_MULTIPATH is disabledDavid Ahern1-6/+9
Define fib_get_nhs to return EINVAL when CONFIG_IP_ROUTE_MULTIPATH is not enabled and remove the ifdef check for CONFIG_IP_ROUTE_MULTIPATH in fib_create_info. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-28Merge branch 'selftests-forwarding-Add-new-test-cases'David S. Miller10-108/+872
Ido Schimmel says: ==================== selftests: forwarding: Add new test cases This patchset mainly adds new forwarding test cases and performs small changes in existing infrastructure. Patches #1-#3 add new test cases for multicast RPF check, PCP and VLAN matching using flower and tc VLAN modify action. The rest of the patches are from Petr who says: In patches #4 and #5, devlink_lib.sh is fixed to first not cause double inclusion of lib.sh, and then to deduce the device name in a simpler way. In patch #6, helpers for dealing with shared buffer configuration are added to devlink_lib.sh. In patch #7, MC-awareness test is fixed to configure shared buffers explicitly. In patch #8, several helpers are extracted from the MC-awareness test and put into a new mlxsw-specific library, qos_lib.sh. In patch #9, a new test is added which checks configuration of strictly-prioritized streams. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2019-03-28selftests: mlxsw: Add a new test for strict priorityPetr Machata1-0/+311
Test that when strict priority is configured on a system, the higher-priority traffic does actually win all the available bandwidth. The test uses a similar approach to qos_mc_aware.sh to run and account the traffic. Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>