summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* net: amd8111e: remove redundant assignment to 'tx_index'Colin Ian King2018-03-051-1/+1
| | | | | | | | | | | | | The variable tx_index is being initialized with a value that is never read and re-assigned a little later, hence the initialization is redundant and can be removed. Cleans up clang warning: drivers/net/ethernet/amd/amd8111e.c:652:6: warning: Value stored to 'tx_index' during its initialization is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* r8169: switch to device-managed functions in probe (part 2)Andy Shevchenko2018-03-051-12/+4Star
| | | | | | | | | | | | This is a follow up to the commit 4c45d24a759d ("r8169: switch to device-managed functions in probe") to move towards managed resources even more. Cc: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* r8169: Dereference MMIO address immediately before useAndy Shevchenko2018-03-051-530/+335Star
| | | | | | | | | | | | | | | | There is no need to dereference struct rtl8169_private to get mmio_addr in almost every function in the driver. Replace it by using pointer to struct rtl8169_private directly. No functional change intended. Next step might be a conversion of RTL_Wxx() / RTL_Rxx() macros to inline functions for sake of type checking. Cc: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: phy: Fix spelling mistake: "advertisment"-> "advertisement"Colin Ian King2018-03-056-15/+15
| | | | | | | Trivial fix to spelling mistake in comments and error message text. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* cxgb4vf: Forcefully link up virtual interfacesArjun Vynipadath2018-03-051-3/+11
| | | | | | | | | | | | The Virtual Interfaces are connected to an internal switch on the chip which allows VIs attached to the same port to talk to each other even when the port link is down. As a result, we generally want to always report a VI's link as being "up". Based on the original work by: Casey Leedom <leedom@chelsio.com> Signed-off-by: Arjun Vynipadath <arjun@chelsio.com> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'dsa-serdes-stats'David S. Miller2018-03-0414-47/+200
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Andrew Lunn says: ==================== Export SERDES stats via ethtool -S The mv88e6352 family has a SERDES interface which can be used for example to connect to SFF/SFP modules. This interface has a couple of statistics counters. Add support for including these counters in the output of ethtool -S. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: dsa: mv88e6xxx: Get mv88e6352 SERDES statisticsAndrew Lunn2018-03-044-4/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for reading the SERDES statistics of the mv88e8352, using the standard ethtool -S option. The SERDES interface can be mapped to either port 4 or 5, so only return statistics on those ports, if the SERDES interface is in use. The counters are reset on read, so need to be accumulated. Add a per port structure to hold the stats counters. The 6352 only has a single SERDES interface and so only one port will using the newly added array. However the 6390 family has as many SERDES interfaces as ports, each with statistics counters. Also, PTP has a number of counters per port which will also need accumulating. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: dsa: mv88e6xxx: Add helper to determining if port has SERDESAndrew Lunn2018-03-041-5/+17
| | | | | | | | | | | | | | | | | | Refactor the existing code. This helper will be used for SERDES statistics. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: dsa: mv88e6xxx: Allow the SERDES interfaces to have statisticsAndrew Lunn2018-03-042-27/+62
| | | | | | | | | | | | | | | | | | | | | | When gettting the number of statistics, the strings and the actual statistics, call the SERDES ops if implemented. This means the stats code needs to return the number of strings/stats they have placed into the data, so that the SERDES strings/stats can follow on. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: dsa: mv88e6xxx: Hold mutex while doing stats operationsAndrew Lunn2018-03-041-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | Until now, there has been no need to hold the reg mutex while getting the count of statistics, or the strings, because the hardware was not accessed. When adding support for SERDES statistics, it is necessary to access the hardware, to determine if a port is using the SERDES interface. So add mutex lock/unlocks. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * dsa: Pass the port to get_sset_count()Andrew Lunn2018-03-0411-12/+12
|/ | | | | | | | | | | By passing the port, we allow different ports to have different statistics. This is useful since some ports have SERDES interfaces with their own statistic counters. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* tools: tc-testing: Add notap optionBrenda J. Butler2018-03-041-11/+23
| | | | | | | | Add a command line arg to suppress tap output. Handy in case all the tap output is being supplied by the plugins. Signed-off-by: Brenda J. Butler <bjb@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'net-ipv6-Add-support-for-path-selection-using-hash-of-5-tuple'David S. Miller2018-03-0430-131/+260
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | David Ahern says: ==================== net/ipv6: Add support for path selection using hash of 5-tuple Hardware supports multipath selection using the standard L4 5-tuple instead of just L3 and the flow label. In addition, some network operators prefer IPv6 path selection to use the 5-tuple. To that end, add support to IPv6 for multipath hash policy similar to bf4e0a3db97eb ("net: ipv4: add support for ECMP hash policy choice"). The default is still L3 which covers source and destination addresses along with flow label and IPv6 protocol. This gives users a choice in hash algorithms if they believe L3 only and the IPv6 flow label are not sufficient for their use case. A separate sysctl is added for IPv6, allowing IPv4 and IPv6 to use different algorithms if desired. The first 3 patches modify the IPv4 variant so that at the end of the patch set the ipv4 and ipv6 implementations are direct parallels. Patch 4 refactors the existing rt6_multipath_hash in preparation for adding the policy option. Patch 5 renames the existing netevent to have IPv4 in the name so ipv4 changes can be distinguished from IPv6 if the netevent handler cares. Patch 6 adds the skb as an argument through the FIB lookup functions to the multipath selection. Needed for the forwarding case. Patch 7 adds the L4 hash support. Patch 8 adds the hook for the netevent to the spectrum driver to update the ASIC. Patch 9 removes no longer used code. Patch 10 adds a testcase for IPv6 multipath with L4 hash. v3 - comments from Ido: - removed fib_info arg in patch 1; left by mistake on rebase to net-next - removed __get_hash_from_flowi4 declaration - line wrap change to spectrum_router.c to maintain 80 chars v2 - rebased to top of tree - added refactor of fib_multipath_hash following recent change - plumb skb through lookup functions to multipath selection - fix sysctl setting; was missing the data set in ipv6_sysctl_net_init - added test case RFC to v1: - rebase to top of net-next - fix addr_type in hash_keys and removed flow label as noticed by Ido - added a comment to cover letter about choice in algorithms based on use case per Or's comments ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * selftests: forwarding: Add multipath test for L4 hashingDavid Ahern2018-03-041-0/+44
| | | | | | | | | | | | | | | | | | | | Add IPv6 multipath test using L4 hashing. Created with inputs from Ido Schimmel. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Tested-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: Remove unused get_hash_from_flow functionsDavid Ahern2018-03-042-32/+0Star
| | | | | | | | | | | | | | | | | | | | __get_hash_from_flowi6 is still used for flowlabels, but the IPv4 variant and the wrappers to both are not used. Remove them. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * mlxsw: spectrum_router: Add support for ipv6 hash policy updateDavid Ahern2018-03-041-1/+14
| | | | | | | | | | | | | | | | | | | | | | Similar to 28678f07f127d ("mlxsw: spectrum_router: Update multipath hash parameters upon netevents") for IPv4, make sure the kernel and asic are using the same hash algorithm for path selection. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Tested-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net/ipv6: Add support for path selection using hash of 5-tupleDavid Ahern2018-03-047-19/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some operators prefer IPv6 path selection to use a standard 5-tuple hash rather than just an L3 hash with the flow the label. To that end add support to IPv6 for multipath hash policy similar to bf4e0a3db97eb ("net: ipv4: add support for ECMP hash policy choice"). The default is still L3 which covers source and destination addresses along with flow label and IPv6 protocol. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Tested-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net/ipv6: Pass skb to route lookupDavid Ahern2018-03-0418-54/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | IPv6 does path selection for multipath routes deep in the lookup functions. The next patch adds L4 hash option and needs the skb for the forward path. To get the skb to the relevant FIB lookup functions it needs to go through the fib rules layer, so add a lookup_data argument to the fib_lookup_arg struct. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: Rename NETEVENT_MULTIPATH_HASH_UPDATEDavid Ahern2018-03-043-3/+3
| | | | | | | | | | | | | | | | | | | | | | Rename NETEVENT_MULTIPATH_HASH_UPDATE to NETEVENT_IPV4_MPATH_HASH_UPDATE to denote it relates to a change in the IPv4 hash policy. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net/ipv6: Make rt6_multipath_hash similar to fib_multipath_hashDavid Ahern2018-03-041-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Make rt6_multipath_hash more of a direct parallel to fib_multipath_hash and reduce stack and overhead in the process: get_hash_from_flowi6 is just a wrapper around __get_hash_from_flowi6 with another stack allocation for flow_keys. Move setting the addresses, protocol and label into rt6_multipath_hash and allow it to make the call to flow_hash_from_keys. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net/ipv4: Simplify fib_multipath_hash with optional flow keysDavid Ahern2018-03-041-14/+10Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of commit e37b1e978bec5 ("ipv6: route: dissect flow in input path if fib rules need it") fib_multipath_hash takes an optional flow keys. If non-NULL it means the skb has already been dissected. If not set, then fib_multipath_hash needs to call skb_flow_dissect_flow_keys. Simplify the logic by setting flkeys to the local stack variable keys. Simplifies fib_multipath_hash by only have 1 set of instructions setting hash_keys. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net: Align ip_multipath_l3_keys and ip6_multipath_l3_keysDavid Ahern2018-03-042-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | Symmetry is good and allows easy comparison that ipv4 and ipv6 are doing the same thing. To that end, change ip_multipath_l3_keys to set addresses at the end after the icmp compares, and move the initialization of ipv6 flow keys to rt6_multipath_hash. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * net/ipv4: Pass net to fib_multipath_hash instead of fib_infoDavid Ahern2018-03-043-5/+4Star
|/ | | | | | | | | | | fib_multipath_hash only needs net struct to check a sysctl. Make it clear by passing net instead of fib_info. In the end this allows alignment between the ipv4 and ipv6 versions. Signed-off-by: David Ahern <dsahern@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'sctp-clean-up-sctp_sendmsg'David S. Miller2018-03-041-364/+274Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Xin Long says: ==================== sctp: clean up sctp_sendmsg This cleanup mostly does three things: - extract some codes into functions to make sendmsg more readable. - tidy up some codes to avoid the unnecessary checks. - adjust some logic so that it will be easier to add the send flags and cmsgs features that I will post after this. To make it easy to review and to check if the code is compatible with before, this patchset is to do it step by step in 9 patches. NOTE: There will be a conflict when merging Commit 2277c7cd75e3 ("sctp: Add LSM hooks") from selinux tree, the solution is to: 1. remove all the lines in [B]: <<<<<<< HEAD [A] ======= [B] >>>>>>> 2277c7c... sctp: Add LSM hooks 2. and apply the following diff-output: diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 980621e..d6803c8 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -1686,6 +1686,7 @@ static int sctp_sendmsg_new_asoc(struct sock *sk, __u16 sflags, struct net *net = sock_net(sk); struct sctp_association *asoc; enum sctp_scope scope; + struct sctp_af *af; int err = -EINVAL; *tp = NULL; @@ -1711,6 +1712,22 @@ static int sctp_sendmsg_new_asoc(struct sock *sk, __u16 sflags, scope = sctp_scope(daddr); + /* Label connection socket for first association 1-to-many + * style for client sequence socket()->sendmsg(). This + * needs to be done before sctp_assoc_add_peer() as that will + * set up the initial packet that needs to account for any + * security ip options (CIPSO/CALIPSO) added to the packet. + */ + af = sctp_get_af_specific(daddr->sa.sa_family); + if (!af) + return -EINVAL; + + err = security_sctp_bind_connect(sk, SCTP_SENDMSG_CONNECT, + (struct sockaddr *)daddr, + af->sockaddr_len); + if (err < 0) + return err; + asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); if (!asoc) return -ENOMEM; ==================== Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: adjust some codes in a better order in sctp_sendmsgXin Long2018-03-041-18/+18
| | | | | | | | | | | | | | | | sctp_sendmsg_new_asoc and SCTP_ADDR_OVER check is only necessary when daddr is set, so move them up to if (daddr) statement. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: improve some variables in sctp_sendmsgXin Long2018-03-041-15/+14Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch mostly is to: - rename sinfo_flags as sflags, to make the indents look better, and also keep consistent with other sctp_sendmsg_xx functions. - replace new_asoc with bool new, no need to define a pointer here, as if new_asoc is set, it must be asoc. - rename the 'out_nounlock:' as 'out', shorter and nicer. - remove associd, only one place is using it now, just use sinfo->sinfo_assoc_id directly. - remove 'cmsgs' initialization in sctp_sendmsg, as it will be done in sctp_sendmsg_parse. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: remove the unnecessary transport looking up from sctp_sendmsgXin Long2018-03-041-18/+6Star
| | | | | | | | | | | | | | | | | | | | | | | | | | Now sctp_assoc_lookup_paddr can only be called only if daddr has been set. But if daddr has been set, sctp_endpoint_lookup_assoc would be done, where it could already have the transport. So this unnecessary transport looking up should be removed, but only reset transport as NULL when SCTP_ADDR_OVER is not set for UDP type socket. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: factor out sctp_sendmsg_update_sinfo from sctp_sendmsgXin Long2018-03-041-9/+17
| | | | | | | | | | | | | | | | This patch is to move the codes for trying to get sinfo from asoc into sctp_sendmsg_update_sinfo. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: factor out sctp_sendmsg_parse from sctp_sendmsgXin Long2018-03-041-103/+69Star
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch is to move the codes for parsing msghdr and checking sk into sctp_sendmsg_parse. Note that different from before, 'sinfo' in sctp_sendmsg won't be NULL any more. It gets the value either from cmsgs->srinfo, cmsgs->sinfo or asoc. With it, the 'sinfo' and 'fill_sinfo_ttl' check can be removed from sctp_sendmsg. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: factor out sctp_sendmsg_get_daddr from sctp_sendmsgXin Long2018-03-041-24/+34
| | | | | | | | | | | | | | | | | | | | | | This patch is to move the codes for trying to get daddr from msg->msg_name into sctp_sendmsg_get_daddr. Note that after adding 'daddr', 'to' and 'msg_name' can be deleted. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: factor out sctp_sendmsg_check_sflags from sctp_sendmsgXin Long2018-03-041-36/+36
| | | | | | | | | | | | | | | | This patch is to move the codes for checking sinfo_flags on one asoc after this asoc has been found into sctp_sendmsg_check_sflags. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: factor out sctp_sendmsg_new_asoc from sctp_sendmsgXin Long2018-03-041-115/+86Star
| | | | | | | | | | | | | | | | This patch is to move the codes for creating a new asoc if no asoc was found into sctp_sendmsg_new_asoc. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
| * sctp: factor out sctp_sendmsg_to_asoc from sctp_sendmsgXin Long2018-03-041-131/+99Star
|/ | | | | | | | | | | | This patch is to move the codes for checking and sending on one asoc after this asoc has been found or created into sctp_sendmsg_to_asoc. Note that 'err != -ESRCH' check is for the case that asoc is freed when waiting for tx buffer in sctp_sendmsg_to_asoc. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-nextDavid S. Miller2018-03-0322-374/+1259
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Daniel Borkmann says: ==================== pull-request: bpf-next 2018-03-03 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) Extend bpftool to build up CFG information of eBPF programs and add an option to dump this in DOT format such that this can later be used with DOT graphic tools (xdot, graphviz, etc) to visualize it. Part of the analysis performed is sub-program detection and basic-block partitioning, from Jiong. 2) Multiple enhancements for bpftool's batch mode, more specifically the parser now understands comments (#), continuation lines (\), and arguments enclosed between quotes. Also, allow to read from stdin via '-' as input file, all from Quentin. 3) Improve BPF kselftests by i) unifying the rlimit handling into a helper that is then used by all tests, and ii) add support for testing tail calls to test_verifier plus add tests covering all corner cases. The latter is especially useful for testing JITs, from Daniel. 4) Remove x64 JIT's bpf_flush_icache() since flush_icache_range() is a noop on x64, from Daniel. 5) Fix one more occasion in BPF samples where we do not detach the BPF program from the cgroup after completion, from Prashant. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
| * Merge branch 'bpf-bpftool-batch-improvements'Daniel Borkmann2018-03-021-15/+89
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Quentin Monnet says: ==================== Several enhancements for bpftool batch mode are introduced in this series. More specifically, input files for batch mode gain support for: * comments (starting with '#'), * continuation lines (after a line ending with '\'), * arguments enclosed between quotes. Also, make bpftool able to read from standard input when "-" is provided as input file name. ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
| | * tools: bpftool: add support for quotations in batch filesQuentin Monnet2018-03-021-14/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve argument parsing from batch input files in order to support arguments enclosed between single (') or double quotes ("). For example, this command can now be parsed in batch mode: bpftool prog dump xlated id 1337 file "/tmp/my file with spaces" The function responsible for parsing command arguments is copied from its counterpart in lib/utils.c in iproute2 package. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
| | * tools: bpftool: read from stdin when batch file name is "-"Quentin Monnet2018-03-021-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make bpftool read its command list from standard input when the name if the input file is a single dash. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
| | * tools: bpftool: support continuation lines in batch filesQuentin Monnet2018-03-021-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for continuation lines, such as in the following example: prog show prog dump xlated \ id 1337 opcodes This patch is based after the code for support for continuation lines from file lib/utils.c from package iproute2. "Lines" in error messages are renamed as "commands", as we count the number of commands (but we ignore empty lines, comments, and do not add continuation lines to the count). Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
| | * tools: bpftool: support comments in batch filesQuentin Monnet2018-03-021-0/+5
| |/ | | | | | | | | | | | | | | | | | | Replace '#' by '\0' in commands read from batch files in order to avoid processing the remaining part of the line, thus allowing users to use comments in the files. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
| * Merge branch 'bpftool-visualization'Alexei Starovoitov2018-03-027-285/+1010
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jakub Kicinski says: ==================== Jiong says: This patch set is an application of CFG information on eBPF program visualization. It presents some initial code for building CFG information from eBPF instruction sequences. After we get eBPF program bytecode, we do sub-program detection and basic-block partition. These information then are visualized into DOT graph. The user could use any DOT graphic tools (xdot, graphviz etc) to view it. For example: bpftool prog dump xlated id 2 visual &>output.dot [xdot | dotty] output.dot dot -Tpng -o output.png This initial patch set hasn't tuned much on the dot description layout nor decoration, we could improve them later once the direction of the patch set is agreed on. We could also visualize some static analysis performance data. v2 (Jakub): - update license headers and add SPDX tags. ==================== Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: add bash completion for CFG dumpQuentin Monnet2018-03-021-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add bash completion for the "visual" keyword used for dumping the CFG of eBPF programs with bpftool. Make sure we only complete with this keyword when we dump "xlated" (and not "jited") instructions. Acked-by: Jiong Wang <jiong.wang@netronome.com> Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: new command-line option and documentation for 'visual'Jiong Wang2018-03-022-7/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds new command-line option for visualizing the xlated eBPF sequence. Documentations are updated accordingly. Usage: bpftool prog dump xlated id 2 visual Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: generate .dot graph from CFG informationJiong Wang2018-03-023-0/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch let bpftool print .dot graph file into stdout. This graph is generated by the following steps: - iterate through the function list. - generate basic-block(BB) definition for each BB in the function. - draw out edges to connect BBs. This patch is the initial support, the layout and decoration of the .dot graph could be improved. Also, it will be useful if we could visualize some performance data from static analysis. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: add out edges for each basic-blockJiong Wang2018-03-021-2/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds out edges for each basic-block. We will need these out edges to finish the .dot graph drawing. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: partition basic-block for each function in the CFGJiong Wang2018-03-021-1/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch partition basic-block for each function in the CFG. The algorithm is simple, we identify basic-block head in a first traversal, then second traversal to identify the tail. We could build extended basic-block (EBB) in next steps. EBB could make the graph more readable when the eBPF sequence is big. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: detect sub-programs from the eBPF sequenceJiong Wang2018-03-022-0/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch detect all sub-programs from the eBPF sequence and keep the information in the new CFG data structure. The detection algorithm is basically the same as the one in verifier except we need to use insn->off instead of insn->imm to get the pc-relative call offset. Because verifier has modified insn->off/insn->imm during finishing the verification. Also, we don't need to do some sanity checks as verifier has done them. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: factor out xlated dump related code into separate fileJiong Wang2018-03-023-254/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch factors out those code of dumping xlated eBPF instructions into xlated_dumper.[h|c]. They are quite independent dumper functions, so better to be kept separately. New dumper support will be added in later patches in this set. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| | * tools: bpftool: remove unnecessary 'if' to reduce indentationJiong Wang2018-03-021-20/+18Star
| |/ | | | | | | | | | | | | | | | | It is obvious we could use 'else if' instead of start a new 'if' in the touched code. Signed-off-by: Jiong Wang <jiong.wang@netronome.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
| * samples/bpf: detach prog from cgroupPrashant Bhole2018-03-022-0/+4
| | | | | | | | | | | | | | | | | | | | test_cgrp2_sock.sh and test_cgrp2_sock2.sh tests keep the program attached to cgroup even after completion. Using detach functionality of test_cgrp2_sock in both scripts. Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> Acked-by: David Ahern <dsa@cumulusnetworks.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
| * bpf, x64: remove bpf_flush_icacheDaniel Borkmann2018-02-271-13/+2Star
| | | | | | | | | | | | | | | | | | | | | | Unlike other archs flush_icache_range() is a noop on x64, therefore remove the JIT's bpf_flush_icache() altogether since not needed. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Cc: Eric Dumazet <edumazet@google.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org>