Skip to content

Commit 48bddb1

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix hotplug deadlock in hv_netvsc, from Stephen Hemminger. 2) Fix double-free in rmnet driver, from Dan Carpenter. 3) INET connection socket layer can double put request sockets, fix from Eric Dumazet. 4) Don't match collect metadata-mode tunnels if the device is down, from Haishuang Yan. 5) Do not perform TSO6/GSO on ipv6 packets with extensions headers in be2net driver, from Suresh Reddy. 6) Fix scaling error in gen_estimator, from Eric Dumazet. 7) Fix 64-bit statistics deadlock in systemport driver, from Florian Fainelli. 8) Fix use-after-free in sctp_sock_dump, from Xin Long. 9) Reject invalid BPF_END instructions in verifier, from Edward Cree. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (43 commits) mlxsw: spectrum_router: Only handle IPv4 and IPv6 events Documentation: link in networking docs tcp: fix data delivery rate bpf/verifier: reject BPF_ALU64|BPF_END sctp: do not mark sk dumped when inet_sctp_diag_fill returns err sctp: fix an use-after-free issue in sctp_sock_dump netvsc: increase default receive buffer size tcp: update skb->skb_mstamp more carefully net: ipv4: fix l3slave check for index returned in IP_PKTINFO net: smsc911x: Quieten netif during suspend net: systemport: Fix 64-bit stats deadlock net: vrf: avoid gcc-4.6 warning qed: remove unnecessary call to memset tg3: clean up redundant initialization of tnapi tls: make tls_sw_free_resources static sctp: potential read out of bounds in sctp_ulpevent_type_enabled() MAINTAINERS: review Renesas DT bindings as well net_sched: gen_estimator: fix scaling error in bytes/packets samples nfp: wait for the NSP resource to appear on boot nfp: wait for board state before talking to the NSP ...
2 parents c850372 + 8e29f97 commit 48bddb1

File tree

48 files changed

+467
-234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+467
-234
lines changed

Documentation/networking/filter.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ in many more places. There's xt_bpf for netfilter, cls_bpf in the kernel
4545
qdisc layer, SECCOMP-BPF (SECure COMPuting [1]), and lots of other places
4646
such as team driver, PTP code, etc where BPF is being used.
4747

48-
[1] Documentation/prctl/seccomp_filter.txt
48+
[1] Documentation/userspace-api/seccomp_filter.rst
4949

5050
Original BPF paper:
5151

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11435,6 +11435,8 @@ RENESAS ETHERNET DRIVERS
1143511435
R: Sergei Shtylyov <[email protected]>
1143611436
1143711437
11438+
F: Documentation/devicetree/bindings/net/renesas,*.txt
11439+
F: Documentation/devicetree/bindings/net/sh_eth.txt
1143811440
F: drivers/net/ethernet/renesas/
1143911441
F: include/linux/sh_eth.h
1144011442

drivers/net/bonding/bond_main.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4289,7 +4289,7 @@ static int bond_check_params(struct bond_params *params)
42894289
int bond_mode = BOND_MODE_ROUNDROBIN;
42904290
int xmit_hashtype = BOND_XMIT_POLICY_LAYER2;
42914291
int lacp_fast = 0;
4292-
int tlb_dynamic_lb = 0;
4292+
int tlb_dynamic_lb;
42934293

42944294
/* Convert string parameters. */
42954295
if (mode) {
@@ -4601,16 +4601,13 @@ static int bond_check_params(struct bond_params *params)
46014601
}
46024602
ad_user_port_key = valptr->value;
46034603

4604-
if ((bond_mode == BOND_MODE_TLB) || (bond_mode == BOND_MODE_ALB)) {
4605-
bond_opt_initstr(&newval, "default");
4606-
valptr = bond_opt_parse(bond_opt_get(BOND_OPT_TLB_DYNAMIC_LB),
4607-
&newval);
4608-
if (!valptr) {
4609-
pr_err("Error: No tlb_dynamic_lb default value");
4610-
return -EINVAL;
4611-
}
4612-
tlb_dynamic_lb = valptr->value;
4604+
bond_opt_initstr(&newval, "default");
4605+
valptr = bond_opt_parse(bond_opt_get(BOND_OPT_TLB_DYNAMIC_LB), &newval);
4606+
if (!valptr) {
4607+
pr_err("Error: No tlb_dynamic_lb default value");
4608+
return -EINVAL;
46134609
}
4610+
tlb_dynamic_lb = valptr->value;
46144611

46154612
if (lp_interval == 0) {
46164613
pr_warn("Warning: ip_interval must be between 1 and %d, so it was reset to %d\n",

drivers/net/bonding/bond_options.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,9 @@ static int bond_option_mode_set(struct bonding *bond,
754754
bond->params.miimon);
755755
}
756756

757+
if (newval->value == BOND_MODE_ALB)
758+
bond->params.tlb_dynamic_lb = 1;
759+
757760
/* don't cache arp_validate between modes */
758761
bond->params.arp_validate = BOND_ARP_VALIDATE_NONE;
759762
bond->params.mode = newval->value;

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,11 +1735,8 @@ static void bcm_sysport_get_stats64(struct net_device *dev,
17351735
stats->tx_packets += tx_packets;
17361736
}
17371737

1738-
/* lockless update tx_bytes and tx_packets */
1739-
u64_stats_update_begin(&priv->syncp);
17401738
stats64->tx_bytes = stats->tx_bytes;
17411739
stats64->tx_packets = stats->tx_packets;
1742-
u64_stats_update_end(&priv->syncp);
17431740

17441741
do {
17451742
start = u64_stats_fetch_begin_irq(&priv->syncp);

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11536,11 +11536,11 @@ static int tg3_start(struct tg3 *tp, bool reset_phy, bool test_irq,
1153611536
tg3_napi_enable(tp);
1153711537

1153811538
for (i = 0; i < tp->irq_cnt; i++) {
11539-
struct tg3_napi *tnapi = &tp->napi[i];
1154011539
err = tg3_request_irq(tp, i);
1154111540
if (err) {
1154211541
for (i--; i >= 0; i--) {
11543-
tnapi = &tp->napi[i];
11542+
struct tg3_napi *tnapi = &tp->napi[i];
11543+
1154411544
free_irq(tnapi->irq_vec, tnapi);
1154511545
}
1154611546
goto out_napi_fini;

drivers/net/ethernet/emulex/benet/be.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,14 @@ static inline bool is_ipv4_pkt(struct sk_buff *skb)
930930
return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4;
931931
}
932932

933+
static inline bool is_ipv6_ext_hdr(struct sk_buff *skb)
934+
{
935+
if (ip_hdr(skb)->version == 6)
936+
return ipv6_ext_hdr(ipv6_hdr(skb)->nexthdr);
937+
else
938+
return false;
939+
}
940+
933941
#define be_error_recovering(adapter) \
934942
(adapter->flags & BE_FLAGS_TRY_RECOVERY)
935943

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5089,6 +5089,20 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
50895089
struct be_adapter *adapter = netdev_priv(dev);
50905090
u8 l4_hdr = 0;
50915091

5092+
if (skb_is_gso(skb)) {
5093+
/* IPv6 TSO requests with extension hdrs are a problem
5094+
* to Lancer and BE3 HW. Disable TSO6 feature.
5095+
*/
5096+
if (!skyhawk_chip(adapter) && is_ipv6_ext_hdr(skb))
5097+
features &= ~NETIF_F_TSO6;
5098+
5099+
/* Lancer cannot handle the packet with MSS less than 256.
5100+
* Disable the GSO support in such cases
5101+
*/
5102+
if (lancer_chip(adapter) && skb_shinfo(skb)->gso_size < 256)
5103+
features &= ~NETIF_F_GSO_MASK;
5104+
}
5105+
50925106
/* The code below restricts offload features for some tunneled and
50935107
* Q-in-Q packets.
50945108
* Offload features for normal (non tunnel) packets are unchanged.

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -575,15 +575,14 @@ static void mlxsw_sp_span_entry_destroy(struct mlxsw_sp *mlxsw_sp,
575575
}
576576

577577
static struct mlxsw_sp_span_entry *
578-
mlxsw_sp_span_entry_find(struct mlxsw_sp_port *port)
578+
mlxsw_sp_span_entry_find(struct mlxsw_sp *mlxsw_sp, u8 local_port)
579579
{
580-
struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp;
581580
int i;
582581

583582
for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
584583
struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i];
585584

586-
if (curr->used && curr->local_port == port->local_port)
585+
if (curr->used && curr->local_port == local_port)
587586
return curr;
588587
}
589588
return NULL;
@@ -594,7 +593,8 @@ static struct mlxsw_sp_span_entry
594593
{
595594
struct mlxsw_sp_span_entry *span_entry;
596595

597-
span_entry = mlxsw_sp_span_entry_find(port);
596+
span_entry = mlxsw_sp_span_entry_find(port->mlxsw_sp,
597+
port->local_port);
598598
if (span_entry) {
599599
/* Already exists, just take a reference */
600600
span_entry->ref_count++;
@@ -783,12 +783,13 @@ static int mlxsw_sp_span_mirror_add(struct mlxsw_sp_port *from,
783783
}
784784

785785
static void mlxsw_sp_span_mirror_remove(struct mlxsw_sp_port *from,
786-
struct mlxsw_sp_port *to,
786+
u8 destination_port,
787787
enum mlxsw_sp_span_type type)
788788
{
789789
struct mlxsw_sp_span_entry *span_entry;
790790

791-
span_entry = mlxsw_sp_span_entry_find(to);
791+
span_entry = mlxsw_sp_span_entry_find(from->mlxsw_sp,
792+
destination_port);
792793
if (!span_entry) {
793794
netdev_err(from->dev, "no span entry found\n");
794795
return;
@@ -1563,14 +1564,12 @@ static void
15631564
mlxsw_sp_port_del_cls_matchall_mirror(struct mlxsw_sp_port *mlxsw_sp_port,
15641565
struct mlxsw_sp_port_mall_mirror_tc_entry *mirror)
15651566
{
1566-
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
15671567
enum mlxsw_sp_span_type span_type;
1568-
struct mlxsw_sp_port *to_port;
15691568

1570-
to_port = mlxsw_sp->ports[mirror->to_local_port];
15711569
span_type = mirror->ingress ?
15721570
MLXSW_SP_SPAN_INGRESS : MLXSW_SP_SPAN_EGRESS;
1573-
mlxsw_sp_span_mirror_remove(mlxsw_sp_port, to_port, span_type);
1571+
mlxsw_sp_span_mirror_remove(mlxsw_sp_port, mirror->to_local_port,
1572+
span_type);
15741573
}
15751574

15761575
static int
@@ -2545,7 +2544,9 @@ static int mlxsw_sp_flash_device(struct net_device *dev,
25452544
return err;
25462545
}
25472546

2548-
#define MLXSW_SP_QSFP_I2C_ADDR 0x50
2547+
#define MLXSW_SP_I2C_ADDR_LOW 0x50
2548+
#define MLXSW_SP_I2C_ADDR_HIGH 0x51
2549+
#define MLXSW_SP_EEPROM_PAGE_LENGTH 256
25492550

25502551
static int mlxsw_sp_query_module_eeprom(struct mlxsw_sp_port *mlxsw_sp_port,
25512552
u16 offset, u16 size, void *data,
@@ -2554,12 +2555,25 @@ static int mlxsw_sp_query_module_eeprom(struct mlxsw_sp_port *mlxsw_sp_port,
25542555
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
25552556
char eeprom_tmp[MLXSW_SP_REG_MCIA_EEPROM_SIZE];
25562557
char mcia_pl[MLXSW_REG_MCIA_LEN];
2558+
u16 i2c_addr;
25572559
int status;
25582560
int err;
25592561

25602562
size = min_t(u16, size, MLXSW_SP_REG_MCIA_EEPROM_SIZE);
2563+
2564+
if (offset < MLXSW_SP_EEPROM_PAGE_LENGTH &&
2565+
offset + size > MLXSW_SP_EEPROM_PAGE_LENGTH)
2566+
/* Cross pages read, read until offset 256 in low page */
2567+
size = MLXSW_SP_EEPROM_PAGE_LENGTH - offset;
2568+
2569+
i2c_addr = MLXSW_SP_I2C_ADDR_LOW;
2570+
if (offset >= MLXSW_SP_EEPROM_PAGE_LENGTH) {
2571+
i2c_addr = MLXSW_SP_I2C_ADDR_HIGH;
2572+
offset -= MLXSW_SP_EEPROM_PAGE_LENGTH;
2573+
}
2574+
25612575
mlxsw_reg_mcia_pack(mcia_pl, mlxsw_sp_port->mapping.module,
2562-
0, 0, offset, size, MLXSW_SP_QSFP_I2C_ADDR);
2576+
0, 0, offset, size, i2c_addr);
25632577

25642578
err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(mcia), mcia_pl);
25652579
if (err)

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4868,7 +4868,8 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
48684868
struct fib_notifier_info *info = ptr;
48694869
struct mlxsw_sp_router *router;
48704870

4871-
if (!net_eq(info->net, &init_net))
4871+
if (!net_eq(info->net, &init_net) ||
4872+
(info->family != AF_INET && info->family != AF_INET6))
48724873
return NOTIFY_DONE;
48734874

48744875
fib_work = kzalloc(sizeof(*fib_work), GFP_ATOMIC);

drivers/net/ethernet/netronome/nfp/flower/offload.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@
4444
#include "../nfp_net.h"
4545
#include "../nfp_port.h"
4646

47+
#define NFP_FLOWER_WHITELIST_DISSECTOR \
48+
(BIT(FLOW_DISSECTOR_KEY_CONTROL) | \
49+
BIT(FLOW_DISSECTOR_KEY_BASIC) | \
50+
BIT(FLOW_DISSECTOR_KEY_IPV4_ADDRS) | \
51+
BIT(FLOW_DISSECTOR_KEY_IPV6_ADDRS) | \
52+
BIT(FLOW_DISSECTOR_KEY_PORTS) | \
53+
BIT(FLOW_DISSECTOR_KEY_ETH_ADDRS) | \
54+
BIT(FLOW_DISSECTOR_KEY_VLAN) | \
55+
BIT(FLOW_DISSECTOR_KEY_IP))
56+
4757
static int
4858
nfp_flower_xmit_flow(struct net_device *netdev,
4959
struct nfp_fl_payload *nfp_flow, u8 mtype)
@@ -112,6 +122,9 @@ nfp_flower_calculate_key_layers(struct nfp_fl_key_ls *ret_key_ls,
112122
u8 key_layer;
113123
int key_size;
114124

125+
if (flow->dissector->used_keys & ~NFP_FLOWER_WHITELIST_DISSECTOR)
126+
return -EOPNOTSUPP;
127+
115128
if (dissector_uses_key(flow->dissector,
116129
FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
117130
struct flow_dissector_key_control *mask_enc_ctl =

drivers/net/ethernet/netronome/nfp/nfp_main.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,45 @@ static const struct pci_device_id nfp_pci_device_ids[] = {
7474
};
7575
MODULE_DEVICE_TABLE(pci, nfp_pci_device_ids);
7676

77+
static bool nfp_board_ready(struct nfp_pf *pf)
78+
{
79+
const char *cp;
80+
long state;
81+
int err;
82+
83+
cp = nfp_hwinfo_lookup(pf->hwinfo, "board.state");
84+
if (!cp)
85+
return false;
86+
87+
err = kstrtol(cp, 0, &state);
88+
if (err < 0)
89+
return false;
90+
91+
return state == 15;
92+
}
93+
94+
static int nfp_pf_board_state_wait(struct nfp_pf *pf)
95+
{
96+
const unsigned long wait_until = jiffies + 10 * HZ;
97+
98+
while (!nfp_board_ready(pf)) {
99+
if (time_is_before_eq_jiffies(wait_until)) {
100+
nfp_err(pf->cpp, "NFP board initialization timeout\n");
101+
return -EINVAL;
102+
}
103+
104+
nfp_info(pf->cpp, "waiting for board initialization\n");
105+
if (msleep_interruptible(500))
106+
return -ERESTARTSYS;
107+
108+
/* Refresh cached information */
109+
kfree(pf->hwinfo);
110+
pf->hwinfo = nfp_hwinfo_read(pf->cpp);
111+
}
112+
113+
return 0;
114+
}
115+
77116
static int nfp_pcie_sriov_read_nfd_limit(struct nfp_pf *pf)
78117
{
79118
int err;
@@ -312,6 +351,10 @@ static int nfp_nsp_init(struct pci_dev *pdev, struct nfp_pf *pf)
312351
struct nfp_nsp *nsp;
313352
int err;
314353

354+
err = nfp_resource_wait(pf->cpp, NFP_RESOURCE_NSP, 30);
355+
if (err)
356+
return err;
357+
315358
nsp = nfp_nsp_open(pf->cpp);
316359
if (IS_ERR(nsp)) {
317360
err = PTR_ERR(nsp);
@@ -425,6 +468,10 @@ static int nfp_pci_probe(struct pci_dev *pdev,
425468
nfp_hwinfo_lookup(pf->hwinfo, "assembly.revision"),
426469
nfp_hwinfo_lookup(pf->hwinfo, "cpld.version"));
427470

471+
err = nfp_pf_board_state_wait(pf);
472+
if (err)
473+
goto err_hwinfo_free;
474+
428475
err = devlink_register(devlink, &pdev->dev);
429476
if (err)
430477
goto err_hwinfo_free;

drivers/net/ethernet/netronome/nfp/nfp_net_main.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,6 @@
6464

6565
#define NFP_PF_CSR_SLICE_SIZE (32 * 1024)
6666

67-
static int nfp_is_ready(struct nfp_pf *pf)
68-
{
69-
const char *cp;
70-
long state;
71-
int err;
72-
73-
cp = nfp_hwinfo_lookup(pf->hwinfo, "board.state");
74-
if (!cp)
75-
return 0;
76-
77-
err = kstrtol(cp, 0, &state);
78-
if (err < 0)
79-
return 0;
80-
81-
return state == 15;
82-
}
83-
8467
/**
8568
* nfp_net_get_mac_addr() - Get the MAC address.
8669
* @pf: NFP PF handle
@@ -725,12 +708,6 @@ int nfp_net_pci_probe(struct nfp_pf *pf)
725708

726709
INIT_WORK(&pf->port_refresh_work, nfp_net_refresh_vnics);
727710

728-
/* Verify that the board has completed initialization */
729-
if (!nfp_is_ready(pf)) {
730-
nfp_err(pf->cpp, "NFP is not ready for NIC operation.\n");
731-
return -EINVAL;
732-
}
733-
734711
if (!pf->rtbl) {
735712
nfp_err(pf->cpp, "No %s, giving up.\n",
736713
pf->fw_loaded ? "symbol table" : "firmware found");

drivers/net/ethernet/netronome/nfp/nfpcore/nfp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name);
9797

9898
void nfp_resource_release(struct nfp_resource *res);
9999

100+
int nfp_resource_wait(struct nfp_cpp *cpp, const char *name, unsigned int secs);
101+
100102
u32 nfp_resource_cpp_id(struct nfp_resource *res);
101103

102104
const char *nfp_resource_name(struct nfp_resource *res);

0 commit comments

Comments
 (0)