aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/relay.c (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2019-05-05openvswitch: check for null pointer return from nla_nest_start_noflagColin Ian King1-0/+4
The call to nla_nest_start_noflag can return null in the unlikely event that nla_put returns -EMSGSIZE. Check for this condition to avoid a null pointer dereference on pointer nla_reply. Addresses-Coverity: ("Dereference null return value") Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-05ipv4: Move exception bucket to nh_commonDavid Ahern3-31/+24
Similar to the cached routes, make IPv4 exceptions accessible when using an IPv6 nexthop struct with IPv4 routes. Simplify the exception functions by passing in fib_nh_common since that is all it needs, and then cleanup the call sites that have extraneous fib_nh conversions. As with the cached routes this is a change in location only, from fib_nh up to fib_nh_common; no functional change intended. 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-05-05ipv4: Pass fib_nh_common to rt_cache_routeDavid Ahern1-10/+10
Now that the cached routes are in fib_nh_common, pass it to rt_cache_route and simplify its callers. For rt_set_nexthop, the tclassid becomes the last user of fib_nh so move the container_of under the #ifdef CONFIG_IP_ROUTE_CLASSID. 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-05-05ipv4: Move cached routes to fib_nh_commonDavid Ahern3-28/+32
While the cached routes, nh_pcpu_rth_output and nh_rth_input, are IPv4 specific, a later patch wants to make them accessible for IPv6 nexthops with IPv4 routes using a fib6_nh. Move the cached routes from fib_nh to fib_nh_common and update references. Initialization of the cached entries is moved to fib_nh_common_init, and free is moved to fib_nh_common_release. Change in location only, from fib_nh up to fib_nh_common; no functional change intended. 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-05-04net: openvswitch: return an error instead of doing BUG_ON()Eelco Chaudron1-2/+5
For all other error cases in queue_userspace_packet() the error is returned, so it makes sense to do the same for these two error cases. Reported-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04r8169: remove rtl_write_exgmac_batchHeiner Kallweit1-22/+4
rtl_write_exgmac_batch is used in only one place, so we can remove it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04netlink: add validation of NLA_F_NESTED flagMichal Kubecek2-1/+25
Add new validation flag NL_VALIDATE_NESTED which adds three consistency checks of NLA_F_NESTED_FLAG: - the flag is set on attributes with NLA_NESTED{,_ARRAY} policy - the flag is not set on attributes with other policies except NLA_UNSPEC - the flag is set on attribute passed to nla_parse_nested() Signed-off-by: Michal Kubecek <mkubecek@suse.cz> v2: change error messages to mention NLA_F_NESTED explicitly Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04netlink: set bad attribute also on maxtype checkMichal Kubecek1-1/+2
The check that attribute type is within 0...maxtype range in __nla_validate_parse() sets only error message but not bad_attr in extack. Set also bad_attr to tell userspace which attribute failed validation. Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04genetlink: do not validate dump requests if there is no policyMichal Kubecek1-10/+14
Unlike do requests, dump genetlink requests now perform strict validation by default even if the genetlink family does not set policy and maxtype because it does validation and parsing on its own (e.g. because it wants to allow different message format for different commands). While the null policy will be ignored, maxtype (which would be zero) is still checked so that any attribute will fail validation. The solution is to only call __nla_validate() from genl_family_rcv_msg() if family->maxtype is set. Fixes: ef6243acb478 ("genetlink: optionally validate strictly/dumps") Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04mlxsw: spectrum: split base on local_ports_in_{1x, 2x} resourcesShalom Toledo1-11/+35
When splitting a port, different local ports need to be mapped on different systems. For example: SN3700 (local_ports_in_2x=2): * Without split: front panel 1 --> local port 1 front panel 2 --> local port 5 * Split to 2: front panel 1s0 --> local port 1 front panel 1s1 --> local port 3 front panel 2 --> local port 5 SN3800 (local_ports_in_2x=1): * Without split: front panel 1 --> local port 1 front panel 2 --> local port 3 * Split to 2: front panel 1s0 --> local port 1 front panel 1s1 --> local port 2 front panel 2 --> local port 3 The local_ports_in_{1x, 2x} resources provide the offsets from the base local ports according to which the new local ports can be calculated. Signed-off-by: Shalom Toledo <shalomt@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04mlxsw: resources: Add local_ports_in_{1x, 2x}Shalom Toledo1-0/+4
Since the number of local ports in 4x changed between SPC and SPC-2, firmware expose new resources that the driver can query. Signed-off-by: Shalom Toledo <shalomt@mellanox.com> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04mlxsw: Bump firmware version to 13.2000.1122Ido Schimmel1-2/+2
The new version supports two features that are required by upcoming changes in the driver: * Querying of new resources allowing port split into two ports on Spectrum-2 systems * Querying of number of gearboxes on supported systems such as SN3800 Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04tipc: fix missing Name entries due to half-failoverTuong Lien3-7/+84
TIPC link can temporarily fall into "half-establish" that only one of the link endpoints is ESTABLISHED and starts to send traffic, PROTOCOL messages, whereas the other link endpoint is not up (e.g. immediately when the endpoint receives ACTIVATE_MSG, the network interface goes down...). This is a normal situation and will be settled because the link endpoint will be eventually brought down after the link tolerance time. However, the situation will become worse when the second link is established before the first link endpoint goes down, For example: 1. Both links <1A-2A>, <1B-2B> down 2. Link endpoint 2A up, but 1A still down (e.g. due to network disturbance, wrong session, etc.) 3. Link <1B-2B> up 4. Link endpoint 2A down (e.g. due to link tolerance timeout) 5. Node B starts failover onto link <1B-2B> ==> Node A does never start link failover. When the "half-failover" situation happens, two consequences have been observed: a) Peer link/node gets stuck in FAILINGOVER state; b) Traffic or user messages that peer node is trying to failover onto the second link can be partially or completely dropped by this node. The consequence a) was actually solved by commit c140eb166d68 ("tipc: fix failover problem"), but that commit didn't cover the b). It's due to the fact that the tunnel link endpoint has never been prepared for a failover, so the 'l->drop_point' (and the other data...) is not set correctly. When a TUNNEL_MSG from peer node arrives on the link, depending on the inner message's seqno and the current 'l->drop_point' value, the message can be dropped (- treated as a duplicate message) or processed. At this early stage, the traffic messages from peer are likely to be NAME_DISTRIBUTORs, this means some name table entries will be missed on the node forever! The commit resolves the issue by starting the FAILOVER process on this node as well. Another benefit from this solution is that we ensure the link will not be re-established until the failover ends. Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04net: phy: improve resuming from hibernationHeiner Kallweit2-14/+2
I got an interesting report [0] that after resuming from hibernation the link has 100Mbps instead of 1Gbps. Reason is that another OS has been used whilst Linux was hibernated. And this OS speeds down the link due to WoL. Therefore, when resuming, we shouldn't expect that what the PHY advertises is what it did when hibernating. Easiest way to do this is removing state PHY_RESUMING. Instead always go via PHY_UP that configures PHY advertisement. [0] https://bugzilla.kernel.org/show_bug.cgi?id=202851 Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04net: phy: improve pause handlingHeiner Kallweit4-9/+32
When probing the phy device we set sym and asym pause in the "supported" bitmap (unless the PHY tells us otherwise). However we don't know yet whether the MAC supports pause. Simply copying phy->supported to phy->advertising will trigger advertising pause, and that's not what we want. Therefore add phy_advertise_supported() that copies all modes but doesn't touch the pause bits. In phy_support_(a)sym_pause we shouldn't set any bits in the supported bitmap because we may set a bit the PHY intentionally disabled. Effective pause support should be the AND-combined PHY and MAC pause capabilities. If the MAC supports everything, then it's only relevant what the PHY supports. If MAC supports sym pause only, then we have to clear the asym bit in phydev->supported. Copy the pause flags only and don't touch the modes, because a driver may have intentionally removed a mode from phydev->advertising. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04net: sched: cls_u32: use struct_size() helperGustavo A. R. Silva1-1/+1
Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace code of the following form: sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key) with: struct_size(s, keys, s->nkeys) 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-05-04net: add a generic tracepoint for TX queue timeoutCong Wang2-0/+25
Although devlink health report does a nice job on reporting TX timeout and other NIC errors, unfortunately it requires drivers to support it but currently only mlx5 has implemented it. Before other drivers could catch up, it is useful to have a generic tracepoint to monitor this kind of TX timeout. We have been suffering TX timeout with different drivers, we plan to start to monitor it with rasdaemon which just needs a new tracepoint. Sample output: ksoftirqd/1-16 [001] ..s2 144.043173: net_dev_xmit_timeout: dev=ens3 driver=e1000 queue=0 Cc: Eran Ben Elisha <eranbe@mellanox.com> Cc: Jiri Pirko <jiri@mellanox.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04wimax/i2400m: use struct_size() helperGustavo A. R. Silva1-2/+1
Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace code of the following form: sizeof(*tx_msg) + le16_to_cpu(tx_msg->num_pls) * sizeof(tx_msg->pld[0]); with: struct_size(tx_msg, pld, le16_to_cpu(tx_msg->num_pls)); 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-05-04net: hns3: add support for FEC encoding controlJian Shen5-1/+213
This patch adds support for FEC encoding control, user can change FEC mode by command ethtool --set-fec, and get FEC mode by command ethtool --show-fec. The fec capability is changed follow the port speed. If autoneg on, the user configure fec mode will be overwritten by autoneg result. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04net: hns3: add autoneg and change speed support for fibre portJian Shen3-11/+163
Previously, our driver only supports phydev to autoneg or change port speed. This patch adds support for fibre port, driver gets media speed capability and autoneg capability from firmware. If the media supports multiple speeds, user can change port speed with command "ethtool -s <devname> speed xxxx autoneg off duplex full". If autoneg on, the user configuration may be overwritten by the autoneg result. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-04net: hns3: add support for multiple media typeJian Shen8-63/+246
Previously, we can only identify copper and fiber type, the supported link modes of port information are always showing SR type. This patch adds support for multiple media types, include SR, LR CR, KR. Driver needs to query the media type from firmware periodicly, and updates the port information. The new port information looks like this: Settings for eth0: Supported ports: [ FIBRE ] Supported link modes: 25000baseCR/Full 25000baseSR/Full 1000baseX/Full 10000baseCR/Full 10000baseSR/Full 10000baseLR/Full Supported pause frame use: Symmetric Supports auto-negotiation: No Supported FEC modes: None BaseR Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 10000Mb/s Duplex: Full Port: FIBRE PHYAD: 0 Transceiver: internal Auto-negotiation: off Current message level: 0x00000036 (54) probe link ifdown ifup Link detected: yes In order to be compatible with old firmware which only support sfp speed, we remained using the same query command, and kept the former logic. Signed-off-by: Jian Shen <shenjian15@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-03usbnet: ipheth: Remove unnecessary NULL pointer checkGuenter Roeck1-2/+0
ipheth_carrier_set() is called from two locations. In ipheth_carrier_check_work(), its parameter 'dev' is set with container_of(work, ...) and can not be NULL. In ipheth_open(), dev is extracted from netdev_priv(net) and dereferenced before the call to ipheth_carrier_set(). The NULL pointer check of dev in ipheth_carrier_set() is therefore unnecessary and can be removed. Cc: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-03net: dsa: mv88e6xxx: Pass interrupt number in platform dataAndrew Lunn2-4/+10
Allow an interrupt number to be passed in the platform data. The driver will then use it if not zero, otherwise it will poll for interrupts. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-03net: dsa :mv88e6xxx: Disable unused portsAndrew Lunn1-1/+11
If the NO_CPU strap is set, the switch starts in 'dumb hub' mode, with all ports enable. Ports which are then actively used are reconfigured as required when the driver starts. However unused ports are left alone. Change this to disable them, and turn off any SERDES interface. This could save some power and so reduce the temperature a bit. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-03net: dsa: mv88e6xxx: Set STP disable state in port_disableAndrew Lunn1-0/+3
When requested to disable a port, set the port STP state to disabled. This fully disables the port and should save some power. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-05-03i40e: Introduce recovery mode supportAlice Michael3-31/+294
This patch introduces "recovery mode" to the i40e driver. It is part of a new Any2Any idea of upgrading the firmware. In this approach, it is required for the driver to have support for "transition firmware", that is used for migrating from structured to flat firmware image. In this new, very basic mode, i40e driver must be able to handle particular IOCTL calls from the NVM Update Tool and run a small set of AQ commands. These additional AQ commands are part of the interface used by the NVMUpdate tool. The NVMUpdate tool contains all of the necessary logic to reference these new AQ commands. The end user experience remains the same, they are using the NVMUpdate tool to update the NVM contents. Signed-off-by: Alice Michael <alice.michael@intel.com> Signed-off-by: Piotr Marczak <piotr.marczak@intel.com> Tested-by: Don Buchholz <donald.buchholz@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: print PCI vendor and device ID during probeStefan Assmann1-3/+4
Printing each devices PCI vendor and device ID has the advantage of easily revealing what hardware we're dealing with exactly. It's no longer necessary to match the PCI bus information to the lspci output. Helps with bug reports where no lspci output is available. Output before i40e 0000:08:00.0: fw 6.1.49420 api 1.7 nvm 6.80 0x80003c64 1.2007.0 and after i40e 0000:08:00.0: fw 6.1.49420 api 1.7 nvm 6.80 0x80003c64 1.2007.0 [8086:1572] [8086:0004] Signed-off-by: Stefan Assmann <sassmann@kpanic.de> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: fix misleading message about promisc setting on un-trusted VFHarshitha Ramamurthy1-12/+16
A refactor of the i40e_vc_config_promiscuous_mode_msg function moved the check for un-trusted VF into another function. We have to lie to an un-trusted VF that its request to set promiscuous mode is successful even when it is not because we don't want the VF to find out its trust status this way. With the refactor, we were running into a case where even though we were not setting promiscuous mode for an un-trusted VF, we still printed a misleading message that it was successful. This patch fixes that by ensuring that a success message is printed on the host side only when the promiscuous mode change has been successful. Signed-off-by: Harshitha Ramamurthy <harshitha.ramamurthy@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: update version numberAlice Michael1-1/+1
Just bumping the version number appropriately. Signed-off-by: Alice Michael <alice.michael@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: remove out-of-range comparisons in i40e_validate_cloud_filterJacob Keller1-2/+2
The function i40e_validate_cloud_filter checks that the destination and source port numbers are valid by attempting to ensure that the number is non-zero and no larger than 0xFFFF. However, the types for the dst_port and src_port variable are __be16 which by definition cannot be larger than 0xFFFF Since these values cannot be larger than 2 bytes, the check to see if they exceed 0xFFFF is meaningless. One might consider these checks as some sort of defensive coding, in case the type was later changed. However, these checks also byte-swap the value before comparison using be16_to_cpu, which will truncate the values to 16bits anyways. Additionally, changing the type would require updating the opcodes to support new data layout of these virtchnl commands. Remove the check to silence the -Wtype-limits warning that was added to GCC 8. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: Further implementation of LLDPAleksandr Loktionov8-13/+93
This code implements driver code changes necessary for LLDP Agent support. Modified i40e_aq_start_lldp() and i40e_aq_stop_lldp() adding false parameter whether LLDP state should be persistent across power cycles. Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: Report advertised link modes on 40GBase_LR4, CR4 and fibreAdam Ludkiewicz1-1/+9
Add assignments for advertising 40GBase_LR4, 40GBase_CR4 and fibre Signed-off-by: Adam Ludkiewicz <adam.ludkiewicz@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: ShadowRAM checksum calculation changeMaciej Paczkowski1-4/+25
Due to changes in FW the SW is required to perform double SR dump in some cases. Implementation adds two new steps to update nvm checksum function: * recalculate checksum and check if checksum in NVM is correct * if checksum in NVM is not correct then update it again Signed-off-by: Maciej Paczkowski <maciej.paczkowski@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: remove error msg when vf with port vlan tries to remove vlan 0Aleksandr Loktionov1-1/+2
VF's attempt to delete vlan 0 when a port vlan is configured is harmless in this case pf driver just does nothing. If vf will try to remove other vlans when a port vlan is configured it will still produce error as before. Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: change behavior on PF in response to MDD eventCarolyn Wyborny1-10/+2
TX MDD events reported on the PF are the result of the PF misconfiguring a descriptor and not because of "bad actions" by anything else. No need to reset now because if it results in a Tx hang, the Tx hang check will take care of it. Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
2019-05-03i40e: Fix for allowing too many MDD events on VFCarolyn Wyborny1-5/+3
This patch changes the driver behavior when detecting a VF MDD event. It now disables the VF after one event, which indicates a hw detected problem in the VF. Before this change, the PF would allow a couple of events before doing the reset. Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>