* [PATCH AUTOSEL 4.19 013/258] ath10k: assign 'n_cipher_suites' for WCN3990
From: Sasha Levin @ 2019-01-28 15:55 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Brian Norris, Rakesh Pillai, Govind Singh, Kalle Valo,
Sasha Levin, ath10k, linux-wireless, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Brian Norris <briannorris@chromium.org>
[ Upstream commit 2bd345cd2bfc0bd44528896313c0b45f087bdf67 ]
Commit 2ea9f12cefe4 ("ath10k: add new cipher suite support") added a new
n_cipher_suites HW param with a fallback value and a warning log. Commit
03a72288c546 ("ath10k: wmi: add hw params entry for wcn3990") later
added WCN3990 HW entries, but it missed the n_cipher_suites.
Rather than seeing this warning every boot
ath10k_snoc 18800000.wifi: invalid hw_params.n_cipher_suites 0
let's provide the appropriate value.
Cc: Rakesh Pillai <pillair@qti.qualcomm.com>
Cc: Govind Singh <govinds@qti.qualcomm.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/ath/ath10k/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index c40cd129afe7..5210cffb5344 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -532,6 +532,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
.hw_ops = &wcn3990_ops,
.decap_align_bytes = 1,
.num_peers = TARGET_HL_10_TLV_NUM_PEERS,
+ .n_cipher_suites = 8,
.ast_skid_limit = TARGET_HL_10_TLV_AST_SKID_LIMIT,
.num_wds_entries = TARGET_HL_10_TLV_NUM_WDS_ENTRIES,
.target_64bit = true,
--
2.19.1
^ permalink raw reply related
* Re: [PATCH bpf-next v2 3/3] selftests/bpf: add simple BPF_PROG_TEST_RUN examples for flow dissector
From: Song Liu @ 2019-01-28 17:26 UTC (permalink / raw)
To: Stanislav Fomichev
Cc: Stanislav Fomichev, Networking, David S . Miller,
Alexei Starovoitov, Daniel Borkmann
In-Reply-To: <20190126005842.GF26773@mini-arch>
On Fri, Jan 25, 2019 at 4:58 PM Stanislav Fomichev <sdf@fomichev.me> wrote:
>
> On 01/25, Song Liu wrote:
> > On Thu, Jan 24, 2019 at 8:52 AM Stanislav Fomichev <sdf@google.com> wrote:
> > >
> > > Use existing pkt_v4 and pkt_v6 to make sure flow_keys are what we want.
> > >
> > > Also, add new bpf_flow_load routine (and flow_dissector_load.h header)
> > > that loads bpf_flow.o program and does all required setup.
> > >
> > > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > > ---
> > > tools/testing/selftests/bpf/Makefile | 3 +
> > > .../selftests/bpf/flow_dissector_load.c | 43 ++--------
> > > .../selftests/bpf/flow_dissector_load.h | 55 +++++++++++++
> > > tools/testing/selftests/bpf/test_progs.c | 78 ++++++++++++++++++-
> > > 4 files changed, 139 insertions(+), 40 deletions(-)
> > > create mode 100644 tools/testing/selftests/bpf/flow_dissector_load.h
> > >
> > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > > index 70229de510f5..ade67470a152 100644
> > > --- a/tools/testing/selftests/bpf/Makefile
> > > +++ b/tools/testing/selftests/bpf/Makefile
> > > @@ -19,6 +19,9 @@ all: $(TEST_CUSTOM_PROGS)
> > > $(TEST_CUSTOM_PROGS): $(OUTPUT)/%: %.c
> > > $(CC) -o $(TEST_CUSTOM_PROGS) -static $< -Wl,--build-id
> > >
> > > +flow_dissector_load.c: flow_dissector_load.h
> > > +test_run.c: flow_dissector_load.h
> > > +
> > > # Order correspond to 'make run_tests' order
> > > TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \
> > > test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \
> > > diff --git a/tools/testing/selftests/bpf/flow_dissector_load.c b/tools/testing/selftests/bpf/flow_dissector_load.c
> > > index ae8180b11d5f..77cafa66d048 100644
> > > --- a/tools/testing/selftests/bpf/flow_dissector_load.c
> > > +++ b/tools/testing/selftests/bpf/flow_dissector_load.c
> > > @@ -12,6 +12,7 @@
> > > #include <bpf/libbpf.h>
> > >
> > > #include "bpf_rlimit.h"
> > > +#include "flow_dissector_load.h"
> > >
> > > const char *cfg_pin_path = "/sys/fs/bpf/flow_dissector";
> > > const char *cfg_map_name = "jmp_table";
> > > @@ -21,46 +22,13 @@ char *cfg_path_name;
> > >
> > > static void load_and_attach_program(void)
> > > {
> > > - struct bpf_program *prog, *main_prog;
> > > - struct bpf_map *prog_array;
> > > - int i, fd, prog_fd, ret;
> > > + int prog_fd, ret;
> > > struct bpf_object *obj;
> > > - int prog_array_fd;
> > >
> > > - ret = bpf_prog_load(cfg_path_name, BPF_PROG_TYPE_FLOW_DISSECTOR, &obj,
> > > - &prog_fd);
> > > + ret = bpf_flow_load(&obj, cfg_path_name, cfg_section_name,
> > > + cfg_map_name, &prog_fd);
> > > if (ret)
> > > - error(1, 0, "bpf_prog_load %s", cfg_path_name);
> > > -
> > > - main_prog = bpf_object__find_program_by_title(obj, cfg_section_name);
> > > - if (!main_prog)
> > > - error(1, 0, "bpf_object__find_program_by_title %s",
> > > - cfg_section_name);
> > > -
> > > - prog_fd = bpf_program__fd(main_prog);
> > > - if (prog_fd < 0)
> > > - error(1, 0, "bpf_program__fd");
> > > -
> > > - prog_array = bpf_object__find_map_by_name(obj, cfg_map_name);
> > > - if (!prog_array)
> > > - error(1, 0, "bpf_object__find_map_by_name %s", cfg_map_name);
> > > -
> > > - prog_array_fd = bpf_map__fd(prog_array);
> > > - if (prog_array_fd < 0)
> > > - error(1, 0, "bpf_map__fd %s", cfg_map_name);
> > > -
> > > - i = 0;
> > > - bpf_object__for_each_program(prog, obj) {
> > > - fd = bpf_program__fd(prog);
> > > - if (fd < 0)
> > > - error(1, 0, "bpf_program__fd");
> > > -
> > > - if (fd != prog_fd) {
> > > - printf("%d: %s\n", i, bpf_program__title(prog, false));
> > > - bpf_map_update_elem(prog_array_fd, &i, &fd, BPF_ANY);
> > > - ++i;
> > > - }
> > > - }
> > > + error(1, 0, "bpf_flow_load %s", cfg_path_name);
> > >
> > > ret = bpf_prog_attach(prog_fd, 0 /* Ignore */, BPF_FLOW_DISSECTOR, 0);
> > > if (ret)
> > > @@ -69,7 +37,6 @@ static void load_and_attach_program(void)
> > > ret = bpf_object__pin(obj, cfg_pin_path);
> > > if (ret)
> > > error(1, 0, "bpf_object__pin %s", cfg_pin_path);
> > > -
> > > }
> > >
> > > static void detach_program(void)
> > > diff --git a/tools/testing/selftests/bpf/flow_dissector_load.h b/tools/testing/selftests/bpf/flow_dissector_load.h
> > > new file mode 100644
> > > index 000000000000..41dd6959feb0
> > > --- /dev/null
> > > +++ b/tools/testing/selftests/bpf/flow_dissector_load.h
> > > @@ -0,0 +1,55 @@
> > > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> > > +#ifndef FLOW_DISSECTOR_LOAD
> > > +#define FLOW_DISSECTOR_LOAD
> > > +
> > > +#include <bpf/bpf.h>
> > > +#include <bpf/libbpf.h>
> > > +
> > > +static inline int bpf_flow_load(struct bpf_object **obj,
> > > + const char *path,
> > > + const char *section_name,
> > > + const char *map_name,
> > > + int *prog_fd)
> > > +{
> > > + struct bpf_program *prog, *main_prog;
> > > + struct bpf_map *prog_array;
> > > + int prog_array_fd;
> > > + int ret, fd, i;
> > > +
> > > + ret = bpf_prog_load(path, BPF_PROG_TYPE_FLOW_DISSECTOR, obj,
> > > + prog_fd);
> > > + if (ret)
> > > + return ret;
> > > +
> > > + main_prog = bpf_object__find_program_by_title(*obj, section_name);
> > > + if (!main_prog)
> > > + return ret;
> > > +
> > > + *prog_fd = bpf_program__fd(main_prog);
> > > + if (*prog_fd < 0)
> > > + return ret;
> > > +
> > > + prog_array = bpf_object__find_map_by_name(*obj, map_name);
> > > + if (!prog_array)
> > > + return ret;
> > > +
> > > + prog_array_fd = bpf_map__fd(prog_array);
> > > + if (prog_array_fd < 0)
> > > + return ret;
> > > +
> > > + i = 0;
> > > + bpf_object__for_each_program(prog, *obj) {
> > > + fd = bpf_program__fd(prog);
> > > + if (fd < 0)
> > > + return fd;
> > > +
> > > + if (fd != *prog_fd) {
> > > + bpf_map_update_elem(prog_array_fd, &i, &fd, BPF_ANY);
> > > + ++i;
> > > + }
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +
> > > +#endif /* FLOW_DISSECTOR_LOAD */
> > > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
> > > index 126fc624290d..5f46680d4ad4 100644
> > > --- a/tools/testing/selftests/bpf/test_progs.c
> > > +++ b/tools/testing/selftests/bpf/test_progs.c
> > > @@ -39,6 +39,7 @@ typedef __u16 __sum16;
> > > #include "bpf_endian.h"
> > > #include "bpf_rlimit.h"
> > > #include "trace_helpers.h"
> > > +#include "flow_dissector_load.h"
> > >
> > > static int error_cnt, pass_cnt;
> > > static bool jit_enabled;
> > > @@ -53,9 +54,10 @@ static struct {
> > > } __packed pkt_v4 = {
> > > .eth.h_proto = __bpf_constant_htons(ETH_P_IP),
> > > .iph.ihl = 5,
> > > - .iph.protocol = 6,
> > > + .iph.protocol = IPPROTO_TCP,
> > > .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES),
> > > .tcp.urg_ptr = 123,
> > > + .tcp.doff = 5,
> > > };
> > >
> > > /* ipv6 test vector */
> > > @@ -65,9 +67,10 @@ static struct {
> > > struct tcphdr tcp;
> > > } __packed pkt_v6 = {
> > > .eth.h_proto = __bpf_constant_htons(ETH_P_IPV6),
> > > - .iph.nexthdr = 6,
> > > + .iph.nexthdr = IPPROTO_TCP,
> > > .iph.payload_len = __bpf_constant_htons(MAGIC_BYTES),
> > > .tcp.urg_ptr = 123,
> > > + .tcp.doff = 5,
> > > };
> >
> > Why do we need these changes? They seem unrelated to me.
> doff = 5 is required for the current flow dissector program
> implementation (bpf_flow.c), without it it doesn't return success:
> https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/testing/selftests/bpf/bpf_flow.c#n188
>
> 6 to IPPROTO_TCP just to look nice, since I'm already touching it.
Thanks for the explanation.
Acked-by: Song Liu <songliubraving@fb.com>
>
> >
> > Thanks,
> > Song
> >
> >
> > >
> > > #define _CHECK(condition, tag, duration, format...) ({ \
> > > @@ -1882,6 +1885,76 @@ static void test_queue_stack_map(int type)
> > > bpf_object__close(obj);
> > > }
> > >
> > > +#define CHECK_FLOW_KEYS(desc, got, expected) \
> > > + CHECK(memcmp(&got, &expected, sizeof(got)) != 0, \
> > > + desc, \
> > > + "nhoff=%u/%u " \
> > > + "thoff=%u/%u " \
> > > + "addr_proto=0x%x/0x%x " \
> > > + "is_frag=%u/%u " \
> > > + "is_first_frag=%u/%u " \
> > > + "is_encap=%u/%u " \
> > > + "n_proto=0x%x/0x%x " \
> > > + "sport=%u/%u " \
> > > + "dport=%u/%u\n", \
> > > + got.nhoff, expected.nhoff, \
> > > + got.thoff, expected.thoff, \
> > > + got.addr_proto, expected.addr_proto, \
> > > + got.is_frag, expected.is_frag, \
> > > + got.is_first_frag, expected.is_first_frag, \
> > > + got.is_encap, expected.is_encap, \
> > > + got.n_proto, expected.n_proto, \
> > > + got.sport, expected.sport, \
> > > + got.dport, expected.dport)
> > > +
> > > +static struct bpf_flow_keys pkt_v4_flow_keys = {
> > > + .nhoff = 0,
> > > + .thoff = sizeof(struct iphdr),
> > > + .addr_proto = ETH_P_IP,
> > > + .ip_proto = IPPROTO_TCP,
> > > + .n_proto = bpf_htons(ETH_P_IP),
> > > +};
> > > +
> > > +static struct bpf_flow_keys pkt_v6_flow_keys = {
> > > + .nhoff = 0,
> > > + .thoff = sizeof(struct ipv6hdr),
> > > + .addr_proto = ETH_P_IPV6,
> > > + .ip_proto = IPPROTO_TCP,
> > > + .n_proto = bpf_htons(ETH_P_IPV6),
> > > +};
> > > +
> > > +static void test_flow_dissector(void)
> > > +{
> > > + struct bpf_flow_keys flow_keys;
> > > + struct bpf_object *obj;
> > > + __u32 duration, retval;
> > > + int err, prog_fd;
> > > + __u32 size;
> > > +
> > > + err = bpf_flow_load(&obj, "./bpf_flow.o", "flow_dissector",
> > > + "jmp_table", &prog_fd);
> > > + if (err) {
> > > + error_cnt++;
> > > + return;
> > > + }
> > > +
> > > + err = bpf_prog_test_run(prog_fd, 10, &pkt_v4, sizeof(pkt_v4),
> > > + &flow_keys, &size, &retval, &duration);
> > > + CHECK(size != sizeof(flow_keys) || err || retval != 1, "ipv4",
> > > + "err %d errno %d retval %d duration %d size %u/%lu\n",
> > > + err, errno, retval, duration, size, sizeof(flow_keys));
> > > + CHECK_FLOW_KEYS("ipv4_flow_keys", flow_keys, pkt_v4_flow_keys);
> > > +
> > > + err = bpf_prog_test_run(prog_fd, 10, &pkt_v6, sizeof(pkt_v6),
> > > + &flow_keys, &size, &retval, &duration);
> > > + CHECK(size != sizeof(flow_keys) || err || retval != 1, "ipv6",
> > > + "err %d errno %d retval %d duration %d size %u/%lu\n",
> > > + err, errno, retval, duration, size, sizeof(flow_keys));
> > > + CHECK_FLOW_KEYS("ipv6_flow_keys", flow_keys, pkt_v6_flow_keys);
> > > +
> > > + bpf_object__close(obj);
> > > +}
> > > +
> > > int main(void)
> > > {
> > > srand(time(NULL));
> > > @@ -1909,6 +1982,7 @@ int main(void)
> > > test_reference_tracking();
> > > test_queue_stack_map(QUEUE);
> > > test_queue_stack_map(STACK);
> > > + test_flow_dissector();
> > >
> > > printf("Summary: %d PASSED, %d FAILED\n", pass_cnt, error_cnt);
> > > return error_cnt ? EXIT_FAILURE : EXIT_SUCCESS;
> > > --
> > > 2.20.1.321.g9e740568ce-goog
> > >
^ permalink raw reply
* [PATCH AUTOSEL 4.19 030/258] ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl
From: Sasha Levin @ 2019-01-28 15:55 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Miroslav Lichvar, Richard Cochran, Jacob Keller, David S . Miller,
Sasha Levin, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Miroslav Lichvar <mlichvar@redhat.com>
[ Upstream commit 83d0bdc7390b890905634186baaa294475cd6a06 ]
If a gettime64 call fails, return the error and avoid copying data back
to user.
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_chardev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 2012551d93e0..796eeffdf93b 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -228,7 +228,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
pct->sec = ts.tv_sec;
pct->nsec = ts.tv_nsec;
pct++;
- ptp->info->gettime64(ptp->info, &ts);
+ err = ptp->info->gettime64(ptp->info, &ts);
+ if (err)
+ goto out;
pct->sec = ts.tv_sec;
pct->nsec = ts.tv_nsec;
pct++;
@@ -281,6 +283,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
break;
}
+out:
kfree(sysoff);
return err;
}
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 034/258] sctp: Fix SKB list traversal in sctp_intl_store_reasm().
From: Sasha Levin @ 2019-01-28 15:55 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: David S. Miller, Sasha Levin, linux-sctp, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: "David S. Miller" <davem@davemloft.net>
[ Upstream commit 348bbc25c40844c5efa083a3842c7f53d70a815e ]
To be fully correct, an iterator has an undefined value when something
like skb_queue_walk() naturally terminates.
This will actually matter when SKB queues are converted over to
list_head.
Formalize what this code ends up doing with the current
implementation.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/sctp/stream_interleave.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/net/sctp/stream_interleave.c b/net/sctp/stream_interleave.c
index 500449b72eca..2b499a85db0e 100644
--- a/net/sctp/stream_interleave.c
+++ b/net/sctp/stream_interleave.c
@@ -140,7 +140,7 @@ static void sctp_intl_store_reasm(struct sctp_ulpq *ulpq,
struct sctp_ulpevent *event)
{
struct sctp_ulpevent *cevent;
- struct sk_buff *pos;
+ struct sk_buff *pos, *loc;
pos = skb_peek_tail(&ulpq->reasm);
if (!pos) {
@@ -166,23 +166,30 @@ static void sctp_intl_store_reasm(struct sctp_ulpq *ulpq,
return;
}
+ loc = NULL;
skb_queue_walk(&ulpq->reasm, pos) {
cevent = sctp_skb2event(pos);
if (event->stream < cevent->stream ||
(event->stream == cevent->stream &&
- MID_lt(event->mid, cevent->mid)))
+ MID_lt(event->mid, cevent->mid))) {
+ loc = pos;
break;
-
+ }
if (event->stream == cevent->stream &&
event->mid == cevent->mid &&
!(cevent->msg_flags & SCTP_DATA_FIRST_FRAG) &&
(event->msg_flags & SCTP_DATA_FIRST_FRAG ||
- event->fsn < cevent->fsn))
+ event->fsn < cevent->fsn)) {
+ loc = pos;
break;
+ }
}
- __skb_queue_before(&ulpq->reasm, pos, sctp_event2skb(event));
+ if (!loc)
+ __skb_queue_tail(&ulpq->reasm, sctp_event2skb(event));
+ else
+ __skb_queue_before(&ulpq->reasm, loc, sctp_event2skb(event));
}
static struct sctp_ulpevent *sctp_intl_retrieve_partial(
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 035/258] iwlwifi: fw: do not set sgi bits for HE connection
From: Sasha Levin @ 2019-01-28 15:55 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Naftali Goldstein, Luca Coelho, Sasha Levin, linux-wireless,
netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Naftali Goldstein <naftali.goldstein@intel.com>
[ Upstream commit 5c2dbebb446539eb9640bf59a02756d6e7f1fc53 ]
If the association supports HE, HT/VHT rates will never be used for Tx
and therefore there's no need to set the sgi-per-channel-width-support
bits, so don't set them in this case.
Fixes: 110b32f065f3 ("iwlwifi: mvm: rs: add basic implementation of the new RS API handlers")
Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index 8169d1450b3b..d1c1a8069c7e 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -98,8 +98,12 @@ static u8 rs_fw_sgi_cw_support(struct ieee80211_sta *sta)
{
struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
+ struct ieee80211_sta_he_cap *he_cap = &sta->he_cap;
u8 supp = 0;
+ if (he_cap && he_cap->has_he)
+ return 0;
+
if (ht_cap->cap & IEEE80211_HT_CAP_SGI_20)
supp |= BIT(IWL_TLC_MNG_CH_WIDTH_20MHZ);
if (ht_cap->cap & IEEE80211_HT_CAP_SGI_40)
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 042/258] i40e: prevent overlapping tx_timeout recover
From: Sasha Levin @ 2019-01-28 15:55 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Alan Brady, Jeff Kirsher, Sasha Levin, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Alan Brady <alan.brady@intel.com>
[ Upstream commit d5585b7b6846a6d0f9517afe57be3843150719da ]
If a TX hang occurs, we attempt to recover by incrementally resetting.
If we're starved for CPU time, it's possible the reset doesn't actually
complete (or even fire) before another tx_timeout fires causing us to
fly through the different resets without actually doing them.
This adds a bit to set and check if a timeout recovery is already
pending and, if so, bail out of tx_timeout. The bit will get cleared at
the end of i40e_rebuild when reset is complete.
Signed-off-by: Alan Brady <alan.brady@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/i40e/i40e.h | 1 +
drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
index 7a80652e2500..f84e2c2d02c0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -122,6 +122,7 @@ enum i40e_state_t {
__I40E_MDD_EVENT_PENDING,
__I40E_VFLR_EVENT_PENDING,
__I40E_RESET_RECOVERY_PENDING,
+ __I40E_TIMEOUT_RECOVERY_PENDING,
__I40E_MISC_IRQ_REQUESTED,
__I40E_RESET_INTR_RECEIVED,
__I40E_REINIT_REQUESTED,
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index ed9d3fc4aaba..bfa5c525cf31 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -336,6 +336,10 @@ static void i40e_tx_timeout(struct net_device *netdev)
(pf->tx_timeout_last_recovery + netdev->watchdog_timeo)))
return; /* don't do any new action before the next timeout */
+ /* don't kick off another recovery if one is already pending */
+ if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state))
+ return;
+
if (tx_ring) {
head = i40e_get_head(tx_ring);
/* Read interrupt register */
@@ -9566,6 +9570,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
clear_bit(__I40E_RESET_FAILED, pf->state);
clear_recovery:
clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state);
+ clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state);
}
/**
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 045/258] usbnet: smsc95xx: fix rx packet alignment
From: Sasha Levin @ 2019-01-28 15:55 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Ben Dooks, David S . Miller, Sasha Levin, netdev, linux-usb
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Ben Dooks <ben.dooks@codethink.co.uk>
[ Upstream commit 810eeb1f41a9a272eedc94ca18c072e75678ede4 ]
The smsc95xx driver already takes into account the NET_IP_ALIGN
parameter when setting up the receive packet data, which means
we do not need to worry about aligning the packets in the usbnet
driver.
Adding the EVENT_NO_IP_ALIGN means that the IPv4 header is now
passed to the ip_rcv() routine with the start on an aligned address.
Tested on Raspberry Pi B3.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/usb/smsc95xx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index f2d01cb6f958..6e971628bb50 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1295,6 +1295,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
dev->net->features |= NETIF_F_RXCSUM;
dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM;
+ set_bit(EVENT_NO_IP_ALIGN, &dev->flags);
smsc95xx_init_mac_address(dev);
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 050/258] bpf: libbpf: retry map creation without the name
From: Sasha Levin @ 2019-01-28 15:55 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Stanislav Fomichev, Daniel Borkmann, Sasha Levin, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Stanislav Fomichev <sdf@google.com>
[ Upstream commit 23499442c319412aa8e54e7a939e2eb531bdd77d ]
Since commit 88cda1c9da02 ("bpf: libbpf: Provide basic API support
to specify BPF obj name"), libbpf unconditionally sets bpf_attr->name
for maps. Pre v4.14 kernels don't know about map names and return an
error about unexpected non-zero data. Retry sys_bpf without a map
name to cover older kernels.
v2 changes:
* check for errno == EINVAL as suggested by Daniel Borkmann
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/lib/bpf/bpf.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 60aa4ca8b2c5..7a0014794bff 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -77,6 +77,7 @@ int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr)
{
__u32 name_len = create_attr->name ? strlen(create_attr->name) : 0;
union bpf_attr attr;
+ int ret;
memset(&attr, '\0', sizeof(attr));
@@ -94,7 +95,15 @@ int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr)
attr.map_ifindex = create_attr->map_ifindex;
attr.inner_map_fd = create_attr->inner_map_fd;
- return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
+ ret = sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
+ if (ret < 0 && errno == EINVAL && create_attr->name) {
+ /* Retry the same syscall, but without the name.
+ * Pre v4.14 kernels don't support map names.
+ */
+ memset(attr.map_name, 0, sizeof(attr.map_name));
+ return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
+ }
+ return ret;
}
int bpf_create_map_node(enum bpf_map_type map_type, const char *name,
--
2.19.1
^ permalink raw reply related
* Re: [PATCH bpf-next v2 2/3] bpf: add BPF_PROG_TEST_RUN support for flow dissector
From: Song Liu @ 2019-01-28 17:24 UTC (permalink / raw)
To: Stanislav Fomichev
Cc: Stanislav Fomichev, Networking, David S . Miller,
Alexei Starovoitov, Daniel Borkmann
In-Reply-To: <20190126005613.GE26773@mini-arch>
On Fri, Jan 25, 2019 at 4:56 PM Stanislav Fomichev <sdf@fomichev.me> wrote:
>
> On 01/25, Song Liu wrote:
> > On Thu, Jan 24, 2019 at 8:53 AM Stanislav Fomichev <sdf@google.com> wrote:
> > >
> > > The input is packet data, the output is struct bpf_flow_key. This should
> > > make it easy to test flow dissector programs without elaborate
> > > setup.
> > >
> > > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > > ---
> > > include/linux/bpf.h | 3 ++
> > > net/bpf/test_run.c | 82 +++++++++++++++++++++++++++++++++++++++++++++
> > > net/core/filter.c | 1 +
> > > 3 files changed, 86 insertions(+)
> > >
> > > diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> > > index e734f163bd0b..701ef954a258 100644
> > > --- a/include/linux/bpf.h
> > > +++ b/include/linux/bpf.h
> > > @@ -397,6 +397,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
> > > union bpf_attr __user *uattr);
> > > int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
> > > union bpf_attr __user *uattr);
> > > +int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
> > > + const union bpf_attr *kattr,
> > > + union bpf_attr __user *uattr);
> > >
> > > /* an array of programs to be executed under rcu_lock.
> > > *
> > > diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> > > index fa2644d276ef..2c5172b33209 100644
> > > --- a/net/bpf/test_run.c
> > > +++ b/net/bpf/test_run.c
> > > @@ -240,3 +240,85 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
> > > kfree(data);
> > > return ret;
> > > }
> > > +
> > > +int bpf_prog_test_run_flow_dissector(struct bpf_prog *prog,
> > > + const union bpf_attr *kattr,
> > > + union bpf_attr __user *uattr)
> >
> > I think this function duplicates a lot of logic from bpf_prog_test_run_skb().
> > Can we somehow reuse bpf_prog_test_run_skb()?
> I did that initially
> (https://marc.info/?l=linux-netdev&m=154830227529929&w=2), but then
> Alexey suggested that there is not much to reuse (plus can hinder the
> test performance of the existing types).
I see.
Acked-by: Song Liu <songliubraving@fb.com>
Thanks!
> >
> > Thanks,
> > Song
> >
> >
> > > +{
> > > + u32 size = kattr->test.data_size_in;
> > > + u32 repeat = kattr->test.repeat;
> > > + struct bpf_flow_keys flow_keys;
> > > + u64 time_start, time_spent = 0;
> > > + struct bpf_skb_data_end *cb;
> > > + u32 retval, duration;
> > > + struct sk_buff *skb;
> > > + struct sock *sk;
> > > + void *data;
> > > + int ret;
> > > + u32 i;
> > > +
> > > + if (prog->type != BPF_PROG_TYPE_FLOW_DISSECTOR)
> > > + return -EINVAL;
> > > +
> > > + data = bpf_test_init(kattr, size, NET_SKB_PAD + NET_IP_ALIGN,
> > > + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
> > > + if (IS_ERR(data))
> > > + return PTR_ERR(data);
> > > +
> > > + sk = kzalloc(sizeof(*sk), GFP_USER);
> > > + if (!sk) {
> > > + kfree(data);
> > > + return -ENOMEM;
> > > + }
> > > + sock_net_set(sk, current->nsproxy->net_ns);
> > > + sock_init_data(NULL, sk);
> > > +
> > > + skb = build_skb(data, 0);
> > > + if (!skb) {
> > > + kfree(data);
> > > + kfree(sk);
> > > + return -ENOMEM;
> > > + }
> > > + skb->sk = sk;
> > > +
> > > + skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
> > > + __skb_put(skb, size);
> > > + skb->protocol = eth_type_trans(skb,
> > > + current->nsproxy->net_ns->loopback_dev);
> > > + skb_reset_network_header(skb);
> > > +
> > > + cb = (struct bpf_skb_data_end *)skb->cb;
> > > + cb->qdisc_cb.flow_keys = &flow_keys;
> > > +
> > > + if (!repeat)
> > > + repeat = 1;
> > > +
> > > + time_start = ktime_get_ns();
> > > + for (i = 0; i < repeat; i++) {
> > > + preempt_disable();
> > > + rcu_read_lock();
> > > + retval = __skb_flow_bpf_dissect(prog, skb,
> > > + &flow_keys_dissector,
> > > + &flow_keys);
> > > + rcu_read_unlock();
> > > + preempt_enable();
> > > +
> > > + if (need_resched()) {
> > > + if (signal_pending(current))
> > > + break;
> > > + time_spent += ktime_get_ns() - time_start;
> > > + cond_resched();
> > > + time_start = ktime_get_ns();
> > > + }
> > > + }
> > > + time_spent += ktime_get_ns() - time_start;
> > > + do_div(time_spent, repeat);
> > > + duration = time_spent > U32_MAX ? U32_MAX : (u32)time_spent;
> > > +
> > > + ret = bpf_test_finish(kattr, uattr, &flow_keys, sizeof(flow_keys),
> > > + retval, duration);
> > > +
> > > + kfree_skb(skb);
> > > + kfree(sk);
> > > + return ret;
> > > +}
> > > diff --git a/net/core/filter.c b/net/core/filter.c
> > > index 2b3b436ef545..ff4641dae2be 100644
> > > --- a/net/core/filter.c
> > > +++ b/net/core/filter.c
> > > @@ -7690,6 +7690,7 @@ const struct bpf_verifier_ops flow_dissector_verifier_ops = {
> > > };
> > >
> > > const struct bpf_prog_ops flow_dissector_prog_ops = {
> > > + .test_run = bpf_prog_test_run_flow_dissector,
> > > };
> > >
> > > int sk_detach_filter(struct sock *sk)
> > > --
> > > 2.20.1.321.g9e740568ce-goog
> > >
^ permalink raw reply
* [PATCH AUTOSEL 4.19 063/258] ptp: Fix pass zero to ERR_PTR() in ptp_clock_register
From: Sasha Levin @ 2019-01-28 15:56 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: YueHaibing, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: YueHaibing <yuehaibing@huawei.com>
[ Upstream commit aea0a897af9e44c258e8ab9296fad417f1bc063a ]
Fix smatch warning:
drivers/ptp/ptp_clock.c:298 ptp_clock_register() warn:
passing zero to 'ERR_PTR'
'err' should be set while device_create_with_groups and
pps_register_source fails
Fixes: 85a66e550195 ("ptp: create "pins" together with the rest of attributes")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/ptp/ptp_clock.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 7eacc1c4b3b1..c64903a5978f 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -253,8 +253,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
ptp->dev = device_create_with_groups(ptp_class, parent, ptp->devid,
ptp, ptp->pin_attr_groups,
"ptp%d", ptp->index);
- if (IS_ERR(ptp->dev))
+ if (IS_ERR(ptp->dev)) {
+ err = PTR_ERR(ptp->dev);
goto no_device;
+ }
/* Register a new PPS source. */
if (info->pps) {
@@ -265,6 +267,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
pps.owner = info->owner;
ptp->pps_source = pps_register_source(&pps, PTP_PPS_DEFAULTS);
if (!ptp->pps_source) {
+ err = -EINVAL;
pr_err("failed to register pps source\n");
goto no_pps;
}
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 078/258] net: aquantia: return 'err' if set MPI_DEINIT state fails
From: Sasha Levin @ 2019-01-28 15:56 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: YueHaibing, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: YueHaibing <yuehaibing@huawei.com>
[ Upstream commit 4e3c7c00bba0636b97eb23d582c20b0f5d95ce20 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c:260:7:
warning: variable 'err' set but not used [-Wunused-but-set-variable]
'err' should be returned while set MPI_DEINIT state fails
in hw_atl_utils_soft_reset.
Fixes: cce96d1883da ("net: aquantia: Regression on reset with 1.x firmware")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index c965e65d07db..9939ccaeb125 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -262,6 +262,8 @@ int hw_atl_utils_soft_reset(struct aq_hw_s *self)
AQ_HW_WAIT_FOR((aq_hw_read_reg(self, HW_ATL_MPI_STATE_ADR) &
HW_ATL_MPI_STATE_MSK) == MPI_DEINIT,
10, 1000U);
+ if (err)
+ return err;
}
if (self->rbl_enabled)
--
2.19.1
^ permalink raw reply related
* Re: [PATCH AUTOSEL 4.19 094/258] nfp: add locking around representor changes
From: Sasha Levin @ 2019-01-28 17:21 UTC (permalink / raw)
To: Jakub Kicinski
Cc: linux-kernel, stable, David S . Miller, oss-drivers, netdev
In-Reply-To: <20190128082825.4c8394a6@cakuba.hsd1.ca.comcast.net>
On Mon, Jan 28, 2019 at 08:28:25AM -0800, Jakub Kicinski wrote:
>On Mon, 28 Jan 2019 10:56:40 -0500, Sasha Levin wrote:
>> From: Jakub Kicinski <jakub.kicinski@netronome.com>
>>
>> [ Upstream commit 71844fac1ed459024dd2a448d63d5b28b8c87daa ]
>>
>> Up until now we never needed to keep a networking locks around
>> representors accesses, we only accessed them when device was
>> reconfigured (under nfp pf->lock) or on fast path (under RCU).
>> Now we want to be able to iterate over all representors during
>> notifications, so make sure representor assignment is done
>> under RTNL lock.
>>
>> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> Reviewed-by: John Hurley <john.hurley@netronome.com>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
>Hi Sasha!
>
>There is no need for backporting this unless 51a6588e8c08 ("nfp: add
>offloads on representors") is also back ported (which is a feature).
I'll drop it. Thanks for the heads-up.
--
Thanks,
Sasha
^ permalink raw reply
* [PATCH bpf-next v3 5/5] bpf: BPF_PROG_TYPE_CGROUP_{SKB,SOCK,SOCK_ADDR} require cgroups enabled
From: Stanislav Fomichev @ 2019-01-28 17:21 UTC (permalink / raw)
To: netdev; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190128172119.12105-1-sdf@google.com>
There is no way to exercise appropriate attach points without cgroups
enabled. This lets test_verifier correctly skip tests for these
prog_types if kernel was compiled without BPF cgroup support.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
include/linux/bpf_types.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/bpf_types.h b/include/linux/bpf_types.h
index 44d9ab4809bd..08bf2f1fe553 100644
--- a/include/linux/bpf_types.h
+++ b/include/linux/bpf_types.h
@@ -6,9 +6,11 @@ BPF_PROG_TYPE(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter)
BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_CLS, tc_cls_act)
BPF_PROG_TYPE(BPF_PROG_TYPE_SCHED_ACT, tc_cls_act)
BPF_PROG_TYPE(BPF_PROG_TYPE_XDP, xdp)
+#ifdef CONFIG_CGROUP_BPF
BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SKB, cg_skb)
BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK, cg_sock)
BPF_PROG_TYPE(BPF_PROG_TYPE_CGROUP_SOCK_ADDR, cg_sock_addr)
+#endif
BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_IN, lwt_in)
BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_OUT, lwt_out)
BPF_PROG_TYPE(BPF_PROG_TYPE_LWT_XMIT, lwt_xmit)
--
2.20.1.495.gaa96b0ce6b-goog
^ permalink raw reply related
* [PATCH bpf-next v3 4/5] selftests/bpf: mark verifier test that uses bpf_trace_printk as BPF_PROG_TYPE_TRACEPOINT
From: Stanislav Fomichev @ 2019-01-28 17:21 UTC (permalink / raw)
To: netdev; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190128172119.12105-1-sdf@google.com>
We don't have this helper if the kernel was compiled without
CONFIG_BPF_EVENTS. Setting prog_type to BPF_PROG_TYPE_TRACEPOINT
let's verifier correctly skip this test based on the missing
prog_type support in the kernel.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/verifier/unpriv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/bpf/verifier/unpriv.c b/tools/testing/selftests/bpf/verifier/unpriv.c
index dca58cf1a4ab..3e046695fad7 100644
--- a/tools/testing/selftests/bpf/verifier/unpriv.c
+++ b/tools/testing/selftests/bpf/verifier/unpriv.c
@@ -76,6 +76,7 @@
.errstr_unpriv = "unknown func bpf_trace_printk#6",
.result_unpriv = REJECT,
.result = ACCEPT,
+ .prog_type = BPF_PROG_TYPE_TRACEPOINT,
},
{
"unpriv: pass pointer to helper function",
--
2.20.1.495.gaa96b0ce6b-goog
^ permalink raw reply related
* [PATCH bpf-next v3 3/5] selftests/bpf: skip verifier tests for unsupported map types
From: Stanislav Fomichev @ 2019-01-28 17:21 UTC (permalink / raw)
To: netdev; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190128172119.12105-1-sdf@google.com>
Use recently introduced bpf_probe_map_type() to skip tests in the
test_verifier if map creation (create_map) fails. It's handled
explicitly for each fixup, i.e. if bpf_create_map returns negative fd,
we probe the kernel for the appropriate map support and skip the
test is map type is not supported.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/test_verifier.c | 36 +++++++++++++++++++--
1 file changed, 33 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index 2a36f9f2ee8f..97188dbe80bd 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -265,6 +265,16 @@ static int probe_filter_length(const struct bpf_insn *fp)
return len + 1;
}
+static bool skip_unsupported_map(enum bpf_map_type map_type)
+{
+ if (!bpf_probe_map_type(map_type, 0)) {
+ printf("SKIP (unsupported map type %d)\n", map_type);
+ skips++;
+ return true;
+ }
+ return false;
+}
+
static int create_map(uint32_t type, uint32_t size_key,
uint32_t size_value, uint32_t max_elem)
{
@@ -272,8 +282,11 @@ static int create_map(uint32_t type, uint32_t size_key,
fd = bpf_create_map(type, size_key, size_value, max_elem,
type == BPF_MAP_TYPE_HASH ? BPF_F_NO_PREALLOC : 0);
- if (fd < 0)
+ if (fd < 0) {
+ if (skip_unsupported_map(type))
+ return -1;
printf("Failed to create hash map '%s'!\n", strerror(errno));
+ }
return fd;
}
@@ -323,6 +336,8 @@ static int create_prog_array(enum bpf_prog_type prog_type, uint32_t max_elem,
mfd = bpf_create_map(BPF_MAP_TYPE_PROG_ARRAY, sizeof(int),
sizeof(int), max_elem, 0);
if (mfd < 0) {
+ if (skip_unsupported_map(BPF_MAP_TYPE_PROG_ARRAY))
+ return -1;
printf("Failed to create prog array '%s'!\n", strerror(errno));
return -1;
}
@@ -353,15 +368,20 @@ static int create_map_in_map(void)
inner_map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(int),
sizeof(int), 1, 0);
if (inner_map_fd < 0) {
+ if (skip_unsupported_map(BPF_MAP_TYPE_ARRAY))
+ return -1;
printf("Failed to create array '%s'!\n", strerror(errno));
return inner_map_fd;
}
outer_map_fd = bpf_create_map_in_map(BPF_MAP_TYPE_ARRAY_OF_MAPS, NULL,
sizeof(int), inner_map_fd, 1, 0);
- if (outer_map_fd < 0)
+ if (outer_map_fd < 0) {
+ if (skip_unsupported_map(BPF_MAP_TYPE_ARRAY_OF_MAPS))
+ return -1;
printf("Failed to create array of maps '%s'!\n",
strerror(errno));
+ }
close(inner_map_fd);
@@ -376,9 +396,12 @@ static int create_cgroup_storage(bool percpu)
fd = bpf_create_map(type, sizeof(struct bpf_cgroup_storage_key),
TEST_DATA_LEN, 0, 0);
- if (fd < 0)
+ if (fd < 0) {
+ if (skip_unsupported_map(type))
+ return -1;
printf("Failed to create cgroup storage '%s'!\n",
strerror(errno));
+ }
return fd;
}
@@ -582,6 +605,7 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
int run_errs, run_successes;
int map_fds[MAX_NR_MAPS];
const char *expected_err;
+ int fixup_skips;
__u32 pflags;
int i, err;
@@ -590,7 +614,13 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
if (!prog_type)
prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
+ fixup_skips = skips;
do_test_fixup(test, prog_type, prog, map_fds);
+ /* If there were some map skips during fixup due to missing bpf
+ * features, skip this test.
+ */
+ if (fixup_skips != skips)
+ return;
prog_len = probe_filter_length(prog);
pflags = 0;
--
2.20.1.495.gaa96b0ce6b-goog
^ permalink raw reply related
* [PATCH bpf-next v3 2/5] selftests/bpf: skip verifier tests for unsupported program types
From: Stanislav Fomichev @ 2019-01-28 17:21 UTC (permalink / raw)
To: netdev; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190128172119.12105-1-sdf@google.com>
Use recently introduced bpf_probe_prog_type() to skip tests in the
test_verifier() if bpf_verify_program() fails. The skipped test is
indicated in the output.
Example:
...
679/p bpf_get_stack return R0 within range SKIP (unsupported program
type 5)
680/p ld_abs: invalid op 1 OK
...
Summary: 863 PASSED, 165 SKIPPED, 3 FAILED
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/test_verifier.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index c5e22422a852..2a36f9f2ee8f 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -34,6 +34,7 @@
#include <linux/if_ether.h>
#include <bpf/bpf.h>
+#include <bpf/libbpf.h>
#ifdef HAVE_GENHDR
# include "autoconf.h"
@@ -59,6 +60,7 @@
#define UNPRIV_SYSCTL "kernel/unprivileged_bpf_disabled"
static bool unpriv_disabled = false;
+static int skips;
struct bpf_test {
const char *descr;
@@ -598,6 +600,11 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
pflags |= BPF_F_ANY_ALIGNMENT;
fd_prog = bpf_verify_program(prog_type, prog, prog_len, pflags,
"GPL", 0, bpf_vlog, sizeof(bpf_vlog), 1);
+ if (fd_prog < 0 && !bpf_probe_prog_type(prog_type, 0)) {
+ printf("SKIP (unsupported program type %d)\n", prog_type);
+ skips++;
+ goto close_fds;
+ }
expected_ret = unpriv && test->result_unpriv != UNDEF ?
test->result_unpriv : test->result;
@@ -751,7 +758,7 @@ static bool test_as_unpriv(struct bpf_test *test)
static int do_test(bool unpriv, unsigned int from, unsigned int to)
{
- int i, passes = 0, errors = 0, skips = 0;
+ int i, passes = 0, errors = 0;
for (i = from; i < to; i++) {
struct bpf_test *test = &tests[i];
--
2.20.1.495.gaa96b0ce6b-goog
^ permalink raw reply related
* [PATCH bpf-next v3 1/5] selftests/bpf: skip sockmap in test_maps if kernel doesn't have support
From: Stanislav Fomichev @ 2019-01-28 17:21 UTC (permalink / raw)
To: netdev; +Cc: davem, ast, daniel, Stanislav Fomichev
In-Reply-To: <20190128172119.12105-1-sdf@google.com>
Use recently introduced bpf_probe_map_type() to skip test_sockmap()
if map creation fails. The skipped test is indicated in the output.
Example:
test_sockmap SKIP (unsupported map type BPF_MAP_TYPE_SOCKMAP)
Fork 1024 tasks to 'test_update_delete'
...
test_sockmap SKIP (unsupported map type BPF_MAP_TYPE_SOCKMAP)
Fork 1024 tasks to 'test_update_delete'
...
test_maps: OK, 2 SKIPPED
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
tools/testing/selftests/bpf/test_maps.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index e2b9eee37187..e542c8e09073 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -32,6 +32,8 @@
#define ENOTSUPP 524
#endif
+static int skips;
+
static int map_flags;
#define CHECK(condition, tag, format...) ({ \
@@ -725,6 +727,15 @@ static void test_sockmap(int tasks, void *data)
sizeof(key), sizeof(value),
6, 0);
if (fd < 0) {
+ if (!bpf_probe_map_type(BPF_MAP_TYPE_SOCKMAP, 0)) {
+ printf("%s SKIP (unsupported map type BPF_MAP_TYPE_SOCKMAP)\n",
+ __func__);
+ skips++;
+ for (i = 0; i < 6; i++)
+ close(sfd[i]);
+ return;
+ }
+
printf("Failed to create sockmap %i\n", fd);
goto out_sockmap;
}
@@ -1702,6 +1713,6 @@ int main(void)
map_flags = BPF_F_NO_PREALLOC;
run_all_tests();
- printf("test_maps: OK\n");
+ printf("test_maps: OK, %d SKIPPED\n", skips);
return 0;
}
--
2.20.1.495.gaa96b0ce6b-goog
^ permalink raw reply related
* [PATCH bpf-next v3 0/5] skip verifier/map tests if kernel support is missing
From: Stanislav Fomichev @ 2019-01-28 17:21 UTC (permalink / raw)
To: netdev; +Cc: davem, ast, daniel, Stanislav Fomichev
If test_maps/test_verifier is running against the kernel which doesn't
have _all_ BPF features enabled, it fails with an error. This patch
series tries to probe kernel support for each failed test and skip
it instead. This lets users run BPF selftests in the not-all-bpf-yes
environments and received correct PASS/NON-PASS result.
See https://www.spinics.net/lists/netdev/msg539331.html for more
context.
The series goes like this:
* patch #1 skips sockmap tests in test_maps.c if BPF_MAP_TYPE_SOCKMAP
map is not supported (if bpf_create_map fails, we probe the kernel
for support)
* patch #2 skips verifier tests if test->prog_type is not supported (if
bpf_verify_program fails, we probe the kernel for support)
* patch #3 skips verifier tests if test fixup map is not supported (if
create_map fails, we probe the kernel for support)
* next patches fix various small issues that arise from the first four:
* patch #4 sets "unknown func bpf_trace_printk#6" prog_type to
BPF_PROG_TYPE_TRACEPOINT so it is correctly skipped in
CONFIG_BPF_EVENTS=n case
* patch #5 exposes BPF_PROG_TYPE_CGROUP_{SKB,SOCK,SOCK_ADDR} only when
CONFIG_CGROUP_BPF=y, this makes verifier correctly skip appropriate
tests
v3 changes:
* rebased on top of Quentin's series which adds probes to libbpf
v2 changes:
* don't sprinkle "ifdef CONFIG_CGROUP_BPF" all around net/core/filter.c,
doing it only in the bpf_types.h is enough to disable
BPF_PROG_TYPE_CGROUP_{SKB,SOCK,SOCK_ADDR} prog types for non-cgroup
enabled kernels
Stanislav Fomichev (5):
selftests/bpf: skip sockmap in test_maps if kernel doesn't have
support
selftests/bpf: skip verifier tests for unsupported program types
selftests/bpf: skip verifier tests for unsupported map types
selftests/bpf: mark verifier test that uses bpf_trace_printk as
BPF_PROG_TYPE_TRACEPOINT
bpf: BPF_PROG_TYPE_CGROUP_{SKB,SOCK,SOCK_ADDR} require cgroups enabled
include/linux/bpf_types.h | 2 +
tools/testing/selftests/bpf/test_maps.c | 13 +++++-
tools/testing/selftests/bpf/test_verifier.c | 45 +++++++++++++++++--
tools/testing/selftests/bpf/verifier/unpriv.c | 1 +
4 files changed, 56 insertions(+), 5 deletions(-)
--
2.20.1.495.gaa96b0ce6b-goog
^ permalink raw reply
* [PATCH AUTOSEL 4.19 094/258] nfp: add locking around representor changes
From: Sasha Levin @ 2019-01-28 15:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Jakub Kicinski, David S . Miller, Sasha Levin, oss-drivers,
netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Jakub Kicinski <jakub.kicinski@netronome.com>
[ Upstream commit 71844fac1ed459024dd2a448d63d5b28b8c87daa ]
Up until now we never needed to keep a networking locks around
representors accesses, we only accessed them when device was
reconfigured (under nfp pf->lock) or on fast path (under RCU).
Now we want to be able to iterate over all representors during
notifications, so make sure representor assignment is done
under RTNL lock.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: John Hurley <john.hurley@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/netronome/nfp/abm/main.c | 4 ++++
drivers/net/ethernet/netronome/nfp/nfp_app.c | 2 ++
drivers/net/ethernet/netronome/nfp/nfp_net_repr.c | 2 ++
3 files changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/netronome/nfp/abm/main.c b/drivers/net/ethernet/netronome/nfp/abm/main.c
index b84a6c2d387b..04ef4b986a43 100644
--- a/drivers/net/ethernet/netronome/nfp/abm/main.c
+++ b/drivers/net/ethernet/netronome/nfp/abm/main.c
@@ -415,7 +415,9 @@ nfp_abm_spawn_repr(struct nfp_app *app, struct nfp_abm_link *alink,
reprs = nfp_reprs_get_locked(app, rtype);
WARN(nfp_repr_get_locked(app, reprs, alink->id), "duplicate repr");
+ rtnl_lock();
rcu_assign_pointer(reprs->reprs[alink->id], netdev);
+ rtnl_unlock();
nfp_info(app->cpp, "%s Port %d Representor(%s) created\n",
ptype == NFP_PORT_PF_PORT ? "PCIe" : "Phys",
@@ -441,7 +443,9 @@ nfp_abm_kill_repr(struct nfp_app *app, struct nfp_abm_link *alink,
netdev = nfp_repr_get_locked(app, reprs, alink->id);
if (!netdev)
return;
+ rtnl_lock();
rcu_assign_pointer(reprs->reprs[alink->id], NULL);
+ rtnl_unlock();
synchronize_rcu();
/* Cast to make sure nfp_repr_clean_and_free() takes a nfp_repr */
nfp_repr_clean_and_free((struct nfp_repr *)netdev_priv(netdev));
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_app.c b/drivers/net/ethernet/netronome/nfp/nfp_app.c
index 8607d09ab732..ba6abe652cce 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_app.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_app.c
@@ -156,7 +156,9 @@ nfp_app_reprs_set(struct nfp_app *app, enum nfp_repr_type type,
struct nfp_reprs *old;
old = nfp_reprs_get_locked(app, type);
+ rtnl_lock();
rcu_assign_pointer(app->reprs[type], reprs);
+ rtnl_unlock();
return old;
}
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
index 18a09cdcd9c6..6985db8822bd 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
@@ -472,7 +472,9 @@ int nfp_reprs_resync_phys_ports(struct nfp_app *app)
continue;
nfp_app_repr_preclean(app, netdev);
+ rtnl_lock();
rcu_assign_pointer(reprs->reprs[i], NULL);
+ rtnl_unlock();
synchronize_rcu();
nfp_repr_clean(repr);
}
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 110/258] tipc: fix node keep alive interval calculation
From: Sasha Levin @ 2019-01-28 15:56 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hoang Le, David S . Miller, Sasha Levin, netdev, tipc-discussion
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Hoang Le <hoang.h.le@dektech.com.au>
[ Upstream commit f5d6c3e5a359c0507800e7ac68d565c21de9b5a1 ]
When setting LINK tolerance, node timer interval will be calculated
base on the LINK with lowest tolerance.
But when calculated, the old node timer interval only updated if current
setting value (tolerance/4) less than old ones regardless of number of
links as well as links' lowest tolerance value.
This caused to two cases missing if tolerance changed as following:
Case 1:
1.1/ There is one link (L1) available in the system
1.2/ Set L1's tolerance from 1500ms => lower (i.e 500ms)
1.3/ Then, fallback to default (1500ms) or higher (i.e 2000ms)
Expected:
node timer interval is 1500/4=375ms after 1.3
Result:
node timer interval will not being updated after changing tolerance at 1.3
since its value 1500/4=375ms is not less than 500/4=125ms at 1.2.
Case 2:
2.1/ There are two links (L1, L2) available in the system
2.2/ L1 and L2 tolerance value are 2000ms as initial
2.3/ Set L2's tolerance from 2000ms => lower 1500ms
2.4/ Disable link L2 (bring down its bearer)
Expected:
node timer interval is 2000ms/4=500ms after 2.4
Result:
node timer interval will not being updated after disabling L2 since
its value 2000ms/4=500ms is still not less than 1500/4=375ms at 2.3
although L2 is already not available in the system.
To fix this, we start the node interval calculation by initializing it to
a value larger than any conceivable calculated value. This way, the link
with the lowest tolerance will always determine the calculated value.
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/tipc/node.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 488019766433..32556f480a60 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -624,6 +624,12 @@ static void tipc_node_timeout(struct timer_list *t)
__skb_queue_head_init(&xmitq);
+ /* Initial node interval to value larger (10 seconds), then it will be
+ * recalculated with link lowest tolerance
+ */
+ tipc_node_read_lock(n);
+ n->keepalive_intv = 10000;
+ tipc_node_read_unlock(n);
for (bearer_id = 0; remains && (bearer_id < MAX_BEARERS); bearer_id++) {
tipc_node_read_lock(n);
le = &n->links[bearer_id];
--
2.19.1
^ permalink raw reply related
* Re: [PATCH] bpf/core.c - silence warning messages
From: Song Liu @ 2019-01-28 17:18 UTC (permalink / raw)
To: Valdis Kletnieks
Cc: Alexei Starovoitov, Daniel Borkmann, Networking, open list
In-Reply-To: <31468.1548648675@turing-police.cc.vt.edu>
On Sun, Jan 27, 2019 at 8:43 PM <valdis.kletnieks@vt.edu> wrote:
>
> Compiling kernel/bpf/core.c with W=1 causes a flood of warnings:
>
> kernel/bpf/core.c:1198:65: warning: initialized field overwritten [-Woverride-init]
> 1198 | #define BPF_INSN_3_TBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = true
> | ^~~~
> kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'
> 1087 | INSN_3(ALU, ADD, X), \
> | ^~~~~~
> kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP'
> 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL),
> | ^~~~~~~~~~~~
> kernel/bpf/core.c:1198:65: note: (near initialization for 'public_insntable[12]')
> 1198 | #define BPF_INSN_3_TBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = true
> | ^~~~
> kernel/bpf/core.c:1087:2: note: in expansion of macro 'BPF_INSN_3_TBL'
> 1087 | INSN_3(ALU, ADD, X), \
> | ^~~~~~
> kernel/bpf/core.c:1202:3: note: in expansion of macro 'BPF_INSN_MAP'
> 1202 | BPF_INSN_MAP(BPF_INSN_2_TBL, BPF_INSN_3_TBL),
> | ^~~~~~~~~~~~
>
> 98 copies of the above.
>
> The attached patch silences the warnings, because we *know* we're overwriting
> the default initializer. That leaves bpf/core.c with only 6 other warnings,
> which become more visible in comparison.
My concern is that this will also mute the warning for other parts of
bpf/core.c.
Maybe we should move bpf_opcode_in_insntable() to a separate file, and mute
warning for that file?
Daniel and Alexei, what do you think?
Thanks,
Song
>
> Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
>
> diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile
> index 4c2fa3ac56f6..2606665f2cb5 100644
> --- a/kernel/bpf/Makefile
> +++ b/kernel/bpf/Makefile
> @@ -21,3 +21,4 @@ obj-$(CONFIG_CGROUP_BPF) += cgroup.o
> ifeq ($(CONFIG_INET),y)
> obj-$(CONFIG_BPF_SYSCALL) += reuseport_array.o
> endif
> +CFLAGS_core.o += $(call cc-disable-warning, override-init)
>
^ permalink raw reply
* [PATCH AUTOSEL 4.19 146/258] selftests/bpf: use __bpf_constant_htons in test_prog.c
From: Sasha Levin @ 2019-01-28 15:57 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Stanislav Fomichev, Daniel Borkmann, Alexei Starovoitov,
Sasha Levin, netdev, linux-kselftest
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Stanislav Fomichev <sdf@google.com>
[ Upstream commit a0517a0f7ef23550b4484c37e2b9c2d32abebf64 ]
For some reason, my older GCC (< 4.8) isn't smart enough to optimize the
!__builtin_constant_p() branch in bpf_htons, I see:
error: implicit declaration of function '__builtin_bswap16'
Let's use __bpf_constant_htons as suggested by Daniel Borkmann.
I tried to use simple htons, but it produces the following:
test_progs.c:54:17: error: braced-group within expression allowed only
inside a function
.eth.h_proto = htons(ETH_P_IP),
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/testing/selftests/bpf/test_progs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index 0ef68204c84b..d029cad08cbd 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -51,10 +51,10 @@ static struct {
struct iphdr iph;
struct tcphdr tcp;
} __packed pkt_v4 = {
- .eth.h_proto = bpf_htons(ETH_P_IP),
+ .eth.h_proto = __bpf_constant_htons(ETH_P_IP),
.iph.ihl = 5,
.iph.protocol = 6,
- .iph.tot_len = bpf_htons(MAGIC_BYTES),
+ .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES),
.tcp.urg_ptr = 123,
};
@@ -64,9 +64,9 @@ static struct {
struct ipv6hdr iph;
struct tcphdr tcp;
} __packed pkt_v6 = {
- .eth.h_proto = bpf_htons(ETH_P_IPV6),
+ .eth.h_proto = __bpf_constant_htons(ETH_P_IPV6),
.iph.nexthdr = 6,
- .iph.payload_len = bpf_htons(MAGIC_BYTES),
+ .iph.payload_len = __bpf_constant_htons(MAGIC_BYTES),
.tcp.urg_ptr = 123,
};
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 171/258] bnxt_en: Disable MSIX before re-reserving NQs/CMPL rings.
From: Sasha Levin @ 2019-01-28 15:57 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Michael Chan, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Michael Chan <michael.chan@broadcom.com>
[ Upstream commit 36d65be9a88052cdfc8524eb591baf0e6c878408 ]
When bringing up a device, the code checks to see if the number of
MSIX has changed. pci_disable_msix() should be called first before
changing the number of reserved NQs/CMPL rings. This ensures that
the MSIX vectors associated with the NQs/CMPL rings are still
properly mapped when pci_disable_msix() masks the vectors.
This patch will prevent errors when RDMA support is added for the new
57500 chips. When the RDMA driver shuts down, the number of NQs is
decreased and we must use the new sequence to prevent MSIX errors.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index e2d92548226a..034f57500f00 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -6073,23 +6073,26 @@ static void bnxt_clear_int_mode(struct bnxt *bp)
int bnxt_reserve_rings(struct bnxt *bp)
{
int tcs = netdev_get_num_tc(bp->dev);
+ bool reinit_irq = false;
int rc;
if (!bnxt_need_reserve_rings(bp))
return 0;
- rc = __bnxt_reserve_rings(bp);
- if (rc) {
- netdev_err(bp->dev, "ring reservation failure rc: %d\n", rc);
- return rc;
- }
if (BNXT_NEW_RM(bp) && (bnxt_get_num_msix(bp) != bp->total_irqs)) {
bnxt_ulp_irq_stop(bp);
bnxt_clear_int_mode(bp);
- rc = bnxt_init_int_mode(bp);
+ reinit_irq = true;
+ }
+ rc = __bnxt_reserve_rings(bp);
+ if (reinit_irq) {
+ if (!rc)
+ rc = bnxt_init_int_mode(bp);
bnxt_ulp_irq_restart(bp, rc);
- if (rc)
- return rc;
+ }
+ if (rc) {
+ netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc);
+ return rc;
}
if (tcs && (bp->tx_nr_rings_per_tc * tcs != bp->tx_nr_rings)) {
netdev_err(bp->dev, "tx ring reservation failure\n");
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 182/258] net: hns3: fix incomplete uninitialization of IRQ in the hns3_nic_uninit_vector_data()
From: Sasha Levin @ 2019-01-28 15:58 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Huazhong Tan, Peng Li, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Huazhong Tan <tanhuazhong@huawei.com>
[ Upstream commit ae6017a71115ebc4e5c1a3f0f451319ab3f5c447 ]
In the hns3_nic_uninit_vector_data(), the procedure of uninitializing
the tqp_vector's IRQ has not set affinity_notify to NULL and changes
its init flag. This patch fixes it. And for simplificaton, local
variable tqp_vector is used instead of priv->tqp_vector[i].
Fixes: 424eb834a9be ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index b7b2f8254ce1..d5f15d8d18a9 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -2760,12 +2760,12 @@ static int hns3_nic_uninit_vector_data(struct hns3_nic_priv *priv)
hns3_free_vector_ring_chain(tqp_vector, &vector_ring_chain);
- if (priv->tqp_vector[i].irq_init_flag == HNS3_VECTOR_INITED) {
- (void)irq_set_affinity_hint(
- priv->tqp_vector[i].vector_irq,
- NULL);
- free_irq(priv->tqp_vector[i].vector_irq,
- &priv->tqp_vector[i]);
+ if (tqp_vector->irq_init_flag == HNS3_VECTOR_INITED) {
+ irq_set_affinity_notifier(tqp_vector->vector_irq,
+ NULL);
+ irq_set_affinity_hint(tqp_vector->vector_irq, NULL);
+ free_irq(tqp_vector->vector_irq, tqp_vector);
+ tqp_vector->irq_init_flag = HNS3_VECTOR_NOT_INITED;
}
priv->ring_data[i].ring->irq_init_flag = HNS3_VECTOR_NOT_INITED;
--
2.19.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 187/258] mac80211: fix radiotap vendor presence bitmap handling
From: Sasha Levin @ 2019-01-28 15:58 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Johannes Berg, Luca Coelho, Sasha Levin, linux-wireless, netdev
In-Reply-To: <20190128155924.51521-1-sashal@kernel.org>
From: Johannes Berg <johannes.berg@intel.com>
[ Upstream commit efc38dd7d5fa5c8cdd0c917c5d00947aa0539443 ]
Due to the alignment handling, it actually matters where in the code
we add the 4 bytes for the presence bitmap to the length; the first
field is the timestamp with 8 byte alignment so we need to add the
space for the extra vendor namespace presence bitmap *before* we do
any alignment for the fields.
Move the presence bitmap length accounting to the right place to fix
the alignment for the data properly.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/mac80211/rx.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 5e2b4a41acf1..51ad330bf8e8 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -142,6 +142,9 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
/* allocate extra bitmaps */
if (status->chains)
len += 4 * hweight8(status->chains);
+ /* vendor presence bitmap */
+ if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA)
+ len += 4;
if (ieee80211_have_rx_timestamp(status)) {
len = ALIGN(len, 8);
@@ -197,8 +200,6 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) {
struct ieee80211_vendor_radiotap *rtap = (void *)skb->data;
- /* vendor presence bitmap */
- len += 4;
/* alignment for fixed 6-byte vendor data header */
len = ALIGN(len, 2);
/* vendor data header */
--
2.19.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox