Skip to content

Commit 6e7bd3b

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix MAC address setting in mac80211 pmsr code, from Johannes Berg. 2) Probe SFP modules after being attached, from Russell King. 3) Byte ordering bug in SMC rx_curs_confirmed code, from Ursula Braun. 4) Revert some r8169 changes that are causing regressions, from Heiner Kallweit. 5) Fix spurious connection timeouts in netfilter nat code, from Florian Westphal. 6) SKB leak in tipc, from Hoang Le. 7) Short packet checkum issue in mlx4, similar to a previous mlx5 change, from Saeed Mahameed. The issue is that whilst padding bytes are usually zero, it is not guarateed and the hardware doesn't take the padding bytes into consideration when generating the checksum. 8) Fix various races in cls_tcindex, from Cong Wang. 9) Need to set stream ext to NULL before freeing in SCTP code, from Xin Long. 10) Fix locking in phy_is_started, from Heiner Kallweit. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (54 commits) net: ethernet: freescale: set FEC ethtool regs version net: hns: Fix object reference leaks in hns_dsaf_roce_reset() mm: page_alloc: fix ref bias in page_frag_alloc() for 1-byte allocs net: phy: fix potential race in the phylib state machine net: phy: don't use locking in phy_is_started selftests: fix timestamping Makefile net: dsa: bcm_sf2: potential array overflow in bcm_sf2_sw_suspend() net: fix possible overflow in __sk_mem_raise_allocated() dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit net: phy: fix interrupt handling in non-started states sctp: set stream ext to NULL after freeing it in sctp_stream_outq_migrate sctp: call gso_reset_checksum when computing checksum in sctp_gso_segment net/mlx5e: XDP, fix redirect resources availability check net/mlx5: Fix a compilation warning in events.c net/mlx5: No command allowed when command interface is not ready net/mlx5e: Fix NULL pointer derefernce in set channels error flow netfilter: nft_compat: use-after-free when deleting targets team: avoid complex list operations in team_nl_cmd_options_set() net_sched: fix two more memory leaks in cls_tcindex net_sched: fix a memory leak in cls_tcindex ...
2 parents 02d7504 + f9bcc9f commit 6e7bd3b

Some content is hidden

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

67 files changed

+429
-220
lines changed

Documentation/networking/operstates.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ and changeable from userspace under certain rules.
2222
2. Querying from userspace
2323

2424
Both admin and operational state can be queried via the netlink
25-
operation RTM_GETLINK. It is also possible to subscribe to RTMGRP_LINK
26-
to be notified of updates. This is important for setting from userspace.
25+
operation RTM_GETLINK. It is also possible to subscribe to RTNLGRP_LINK
26+
to be notified of updates while the interface is admin up. This is
27+
important for setting from userspace.
2728

2829
These values contain interface state:
2930

@@ -101,8 +102,9 @@ because some driver controlled protocol establishment has to
101102
complete. Corresponding functions are netif_dormant_on() to set the
102103
flag, netif_dormant_off() to clear it and netif_dormant() to query.
103104

104-
On device allocation, networking core sets the flags equivalent to
105-
netif_carrier_ok() and !netif_dormant().
105+
On device allocation, both flags __LINK_STATE_NOCARRIER and
106+
__LINK_STATE_DORMANT are cleared, so the effective state is equivalent
107+
to netif_carrier_ok() and !netif_dormant().
106108

107109

108110
Whenever the driver CHANGES one of these flags, a workqueue event is
@@ -133,11 +135,11 @@ netif_carrier_ok() && !netif_dormant() is set by the
133135
driver. Afterwards, the userspace application can set IFLA_OPERSTATE
134136
to IF_OPER_DORMANT or IF_OPER_UP as long as the driver does not set
135137
netif_carrier_off() or netif_dormant_on(). Changes made by userspace
136-
are multicasted on the netlink group RTMGRP_LINK.
138+
are multicasted on the netlink group RTNLGRP_LINK.
137139

138140
So basically a 802.1X supplicant interacts with the kernel like this:
139141

140-
-subscribe to RTMGRP_LINK
142+
-subscribe to RTNLGRP_LINK
141143
-set IFLA_LINKMODE to 1 via RTM_SETLINK
142144
-query RTM_GETLINK once to get initial state
143145
-if initial flags are not (IFF_LOWER_UP && !IFF_DORMANT), wait until

drivers/net/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,9 @@ config VXLAN
197197

198198
config GENEVE
199199
tristate "Generic Network Virtualization Encapsulation"
200-
depends on INET && NET_UDP_TUNNEL
200+
depends on INET
201201
depends on IPV6 || !IPV6
202-
select NET_IP_TUNNEL
202+
select NET_UDP_TUNNEL
203203
select GRO_CELLS
204204
---help---
205205
This allows one to create geneve virtual interfaces that provide

drivers/net/dsa/bcm_sf2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds)
690690
* port, the other ones have already been disabled during
691691
* bcm_sf2_sw_setup
692692
*/
693-
for (port = 0; port < DSA_MAX_PORTS; port++) {
693+
for (port = 0; port < ds->num_ports; port++) {
694694
if (dsa_is_user_port(ds, port) || dsa_is_cpu_port(ds, port))
695695
bcm_sf2_port_disable(ds, port, NULL);
696696
}

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip)
261261
unsigned int sub_irq;
262262
unsigned int n;
263263
u16 reg;
264+
u16 ctl1;
264265
int err;
265266

266267
mutex_lock(&chip->reg_lock);
@@ -270,13 +271,28 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_work(struct mv88e6xxx_chip *chip)
270271
if (err)
271272
goto out;
272273

273-
for (n = 0; n < chip->g1_irq.nirqs; ++n) {
274-
if (reg & (1 << n)) {
275-
sub_irq = irq_find_mapping(chip->g1_irq.domain, n);
276-
handle_nested_irq(sub_irq);
277-
++nhandled;
274+
do {
275+
for (n = 0; n < chip->g1_irq.nirqs; ++n) {
276+
if (reg & (1 << n)) {
277+
sub_irq = irq_find_mapping(chip->g1_irq.domain,
278+
n);
279+
handle_nested_irq(sub_irq);
280+
++nhandled;
281+
}
278282
}
279-
}
283+
284+
mutex_lock(&chip->reg_lock);
285+
err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &ctl1);
286+
if (err)
287+
goto unlock;
288+
err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &reg);
289+
unlock:
290+
mutex_unlock(&chip->reg_lock);
291+
if (err)
292+
goto out;
293+
ctl1 &= GENMASK(chip->g1_irq.nirqs, 0);
294+
} while (reg & ctl1);
295+
280296
out:
281297
return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
282298
}

drivers/net/ethernet/amazon/ena/ena_netdev.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,11 +2663,6 @@ static int ena_restore_device(struct ena_adapter *adapter)
26632663
goto err_device_destroy;
26642664
}
26652665

2666-
clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags);
2667-
/* Make sure we don't have a race with AENQ Links state handler */
2668-
if (test_bit(ENA_FLAG_LINK_UP, &adapter->flags))
2669-
netif_carrier_on(adapter->netdev);
2670-
26712666
rc = ena_enable_msix_and_set_admin_interrupts(adapter,
26722667
adapter->num_queues);
26732668
if (rc) {
@@ -2684,6 +2679,11 @@ static int ena_restore_device(struct ena_adapter *adapter)
26842679
}
26852680

26862681
set_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
2682+
2683+
clear_bit(ENA_FLAG_ONGOING_RESET, &adapter->flags);
2684+
if (test_bit(ENA_FLAG_LINK_UP, &adapter->flags))
2685+
netif_carrier_on(adapter->netdev);
2686+
26872687
mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
26882688
dev_err(&pdev->dev,
26892689
"Device reset completed successfully, Driver info: %s\n",

drivers/net/ethernet/amazon/ena/ena_netdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
#define DRV_MODULE_VER_MAJOR 2
4747
#define DRV_MODULE_VER_MINOR 0
48-
#define DRV_MODULE_VER_SUBMINOR 2
48+
#define DRV_MODULE_VER_SUBMINOR 3
4949

5050
#define DRV_MODULE_NAME "ena"
5151
#ifndef DRV_MODULE_VERSION

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,7 @@ static int fec_enet_get_regs_len(struct net_device *ndev)
20982098
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
20992099
defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
21002100
defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
2101+
static __u32 fec_enet_register_version = 2;
21012102
static u32 fec_enet_register_offset[] = {
21022103
FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0,
21032104
FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL,
@@ -2128,6 +2129,7 @@ static u32 fec_enet_register_offset[] = {
21282129
IEEE_R_FDXFC, IEEE_R_OCTETS_OK
21292130
};
21302131
#else
2132+
static __u32 fec_enet_register_version = 1;
21312133
static u32 fec_enet_register_offset[] = {
21322134
FEC_ECNTRL, FEC_IEVENT, FEC_IMASK, FEC_IVEC, FEC_R_DES_ACTIVE_0,
21332135
FEC_R_DES_ACTIVE_1, FEC_R_DES_ACTIVE_2, FEC_X_DES_ACTIVE_0,
@@ -2149,6 +2151,8 @@ static void fec_enet_get_regs(struct net_device *ndev,
21492151
u32 *buf = (u32 *)regbuf;
21502152
u32 i, off;
21512153

2154+
regs->version = fec_enet_register_version;
2155+
21522156
memset(buf, 0, regs->len);
21532157

21542158
for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) {

drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3081,13 +3081,15 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)
30813081
dsaf_dev = dev_get_drvdata(&pdev->dev);
30823082
if (!dsaf_dev) {
30833083
dev_err(&pdev->dev, "dsaf_dev is NULL\n");
3084+
put_device(&pdev->dev);
30843085
return -ENODEV;
30853086
}
30863087

30873088
/* now, make sure we are running on compatible SoC */
30883089
if (AE_IS_VER1(dsaf_dev->dsaf_ver)) {
30893090
dev_err(dsaf_dev->dev, "%s v1 chip doesn't support RoCE!\n",
30903091
dsaf_dev->ae_dev.name);
3092+
put_device(&pdev->dev);
30913093
return -ENODEV;
30923094
}
30933095

drivers/net/ethernet/mellanox/mlx4/en_rx.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,16 +617,29 @@ static int get_fixed_ipv6_csum(__wsum hw_checksum, struct sk_buff *skb,
617617
}
618618
#endif
619619

620+
#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
621+
620622
/* We reach this function only after checking that any of
621623
* the (IPv4 | IPv6) bits are set in cqe->status.
622624
*/
623625
static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
624626
netdev_features_t dev_features)
625627
{
626628
__wsum hw_checksum = 0;
629+
void *hdr;
630+
631+
/* CQE csum doesn't cover padding octets in short ethernet
632+
* frames. And the pad field is appended prior to calculating
633+
* and appending the FCS field.
634+
*
635+
* Detecting these padded frames requires to verify and parse
636+
* IP headers, so we simply force all those small frames to skip
637+
* checksum complete.
638+
*/
639+
if (short_frame(skb->len))
640+
return -EINVAL;
627641

628-
void *hdr = (u8 *)va + sizeof(struct ethhdr);
629-
642+
hdr = (u8 *)va + sizeof(struct ethhdr);
630643
hw_checksum = csum_unfold((__force __sum16)cqe->checksum);
631644

632645
if (cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_CVLAN_PRESENT_MASK) &&
@@ -819,6 +832,11 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
819832
skb_record_rx_queue(skb, cq_ring);
820833

821834
if (likely(dev->features & NETIF_F_RXCSUM)) {
835+
/* TODO: For IP non TCP/UDP packets when csum complete is
836+
* not an option (not supported or any other reason) we can
837+
* actually check cqe IPOK status bit and report
838+
* CHECKSUM_UNNECESSARY rather than CHECKSUM_NONE
839+
*/
822840
if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_TCP |
823841
MLX4_CQE_STATUS_UDP)) &&
824842
(cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) &&

drivers/net/ethernet/mellanox/mlx5/core/cmd.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,24 @@ void mlx5_cmd_trigger_completions(struct mlx5_core_dev *dev)
15831583
spin_unlock_irqrestore(&dev->cmd.alloc_lock, flags);
15841584
}
15851585

1586+
void mlx5_cmd_flush(struct mlx5_core_dev *dev)
1587+
{
1588+
struct mlx5_cmd *cmd = &dev->cmd;
1589+
int i;
1590+
1591+
for (i = 0; i < cmd->max_reg_cmds; i++)
1592+
while (down_trylock(&cmd->sem))
1593+
mlx5_cmd_trigger_completions(dev);
1594+
1595+
while (down_trylock(&cmd->pages_sem))
1596+
mlx5_cmd_trigger_completions(dev);
1597+
1598+
/* Unlock cmdif */
1599+
up(&cmd->pages_sem);
1600+
for (i = 0; i < cmd->max_reg_cmds; i++)
1601+
up(&cmd->sem);
1602+
}
1603+
15861604
static int status_to_err(u8 status)
15871605
{
15881606
return status ? -1 : 0; /* TBD more meaningful codes */

0 commit comments

Comments
 (0)