Skip to content

Commit 68533eb

Browse files
committed
Merge tag 'net-5.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from can, rxrpc and wireguard. Previous releases - regressions: - igmp: respect RCU rules in ip_mc_source() and ip_mc_msfilter() - mld: respect RCU rules in ip6_mc_source() and ip6_mc_msfilter() - rds: acquire netns refcount on TCP sockets - rxrpc: enable IPv6 checksums on transport socket - nic: hinic: fix bug of wq out of bound access - nic: thunder: don't use pci_irq_vector() in atomic context - nic: bnxt_en: fix possible bnxt_open() failure caused by wrong RFS flag - nic: mlx5e: - lag, fix use-after-free in fib event handler - fix deadlock in sync reset flow Previous releases - always broken: - tcp: fix insufficient TCP source port randomness - can: grcan: grcan_close(): fix deadlock - nfc: reorder destructive operations in to avoid bugs Misc: - wireguard: improve selftests reliability" * tag 'net-5.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (63 commits) NFC: netlink: fix sleep in atomic bug when firmware download timeout selftests: ocelot: tc_flower_chains: specify conform-exceed action for policer tcp: drop the hash_32() part from the index calculation tcp: increase source port perturb table to 2^16 tcp: dynamically allocate the perturb table used by source ports tcp: add small random increments to the source port tcp: resalt the secret every 10 seconds tcp: use different parts of the port_offset for index and offset secure_seq: use the 64 bits of the siphash for port offset calculation wireguard: selftests: set panic_on_warn=1 from cmdline wireguard: selftests: bump package deps wireguard: selftests: restore support for ccache wireguard: selftests: use newer toolchains to fill out architectures wireguard: selftests: limit parallelism to $(nproc) tests at once wireguard: selftests: make routing loop test non-fatal net/mlx5: Fix matching on inner TTC net/mlx5: Avoid double clear or set of sync reset requested net/mlx5: Fix deadlock in sync reset flow net/mlx5e: Fix trust state reset in reload net/mlx5e: Avoid checking offload capability in post_parse action ...
2 parents a7391ad + 4071bf1 commit 68533eb

Some content is hidden

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

76 files changed

+724
-386
lines changed

drivers/net/can/grcan.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,14 @@ struct grcan_device_config {
241241
.rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \
242242
}
243243

244-
#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 0x4100
244+
#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 4100
245245
#define GRLIB_VERSION_MASK 0xffff
246246

247247
/* GRCAN private data structure */
248248
struct grcan_priv {
249249
struct can_priv can; /* must be the first member */
250250
struct net_device *dev;
251+
struct device *ofdev_dev;
251252
struct napi_struct napi;
252253

253254
struct grcan_registers __iomem *regs; /* ioremap'ed registers */
@@ -921,7 +922,7 @@ static void grcan_free_dma_buffers(struct net_device *dev)
921922
struct grcan_priv *priv = netdev_priv(dev);
922923
struct grcan_dma *dma = &priv->dma;
923924

924-
dma_free_coherent(&dev->dev, dma->base_size, dma->base_buf,
925+
dma_free_coherent(priv->ofdev_dev, dma->base_size, dma->base_buf,
925926
dma->base_handle);
926927
memset(dma, 0, sizeof(*dma));
927928
}
@@ -946,7 +947,7 @@ static int grcan_allocate_dma_buffers(struct net_device *dev,
946947

947948
/* Extra GRCAN_BUFFER_ALIGNMENT to allow for alignment */
948949
dma->base_size = lsize + ssize + GRCAN_BUFFER_ALIGNMENT;
949-
dma->base_buf = dma_alloc_coherent(&dev->dev,
950+
dma->base_buf = dma_alloc_coherent(priv->ofdev_dev,
950951
dma->base_size,
951952
&dma->base_handle,
952953
GFP_KERNEL);
@@ -1102,8 +1103,10 @@ static int grcan_close(struct net_device *dev)
11021103

11031104
priv->closing = true;
11041105
if (priv->need_txbug_workaround) {
1106+
spin_unlock_irqrestore(&priv->lock, flags);
11051107
del_timer_sync(&priv->hang_timer);
11061108
del_timer_sync(&priv->rr_timer);
1109+
spin_lock_irqsave(&priv->lock, flags);
11071110
}
11081111
netif_stop_queue(dev);
11091112
grcan_stop_hardware(dev);
@@ -1122,15 +1125,15 @@ static int grcan_close(struct net_device *dev)
11221125
return 0;
11231126
}
11241127

1125-
static int grcan_transmit_catch_up(struct net_device *dev, int budget)
1128+
static void grcan_transmit_catch_up(struct net_device *dev)
11261129
{
11271130
struct grcan_priv *priv = netdev_priv(dev);
11281131
unsigned long flags;
11291132
int work_done;
11301133

11311134
spin_lock_irqsave(&priv->lock, flags);
11321135

1133-
work_done = catch_up_echo_skb(dev, budget, true);
1136+
work_done = catch_up_echo_skb(dev, -1, true);
11341137
if (work_done) {
11351138
if (!priv->resetting && !priv->closing &&
11361139
!(priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY))
@@ -1144,8 +1147,6 @@ static int grcan_transmit_catch_up(struct net_device *dev, int budget)
11441147
}
11451148

11461149
spin_unlock_irqrestore(&priv->lock, flags);
1147-
1148-
return work_done;
11491150
}
11501151

11511152
static int grcan_receive(struct net_device *dev, int budget)
@@ -1227,19 +1228,13 @@ static int grcan_poll(struct napi_struct *napi, int budget)
12271228
struct net_device *dev = priv->dev;
12281229
struct grcan_registers __iomem *regs = priv->regs;
12291230
unsigned long flags;
1230-
int tx_work_done, rx_work_done;
1231-
int rx_budget = budget / 2;
1232-
int tx_budget = budget - rx_budget;
1231+
int work_done;
12331232

1234-
/* Half of the budget for receiving messages */
1235-
rx_work_done = grcan_receive(dev, rx_budget);
1233+
work_done = grcan_receive(dev, budget);
12361234

1237-
/* Half of the budget for transmitting messages as that can trigger echo
1238-
* frames being received
1239-
*/
1240-
tx_work_done = grcan_transmit_catch_up(dev, tx_budget);
1235+
grcan_transmit_catch_up(dev);
12411236

1242-
if (rx_work_done < rx_budget && tx_work_done < tx_budget) {
1237+
if (work_done < budget) {
12431238
napi_complete(napi);
12441239

12451240
/* Guarantee no interference with a running reset that otherwise
@@ -1256,7 +1251,7 @@ static int grcan_poll(struct napi_struct *napi, int budget)
12561251
spin_unlock_irqrestore(&priv->lock, flags);
12571252
}
12581253

1259-
return rx_work_done + tx_work_done;
1254+
return work_done;
12601255
}
12611256

12621257
/* Work tx bug by waiting while for the risky situation to clear. If that fails,
@@ -1587,6 +1582,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
15871582
memcpy(&priv->config, &grcan_module_config,
15881583
sizeof(struct grcan_device_config));
15891584
priv->dev = dev;
1585+
priv->ofdev_dev = &ofdev->dev;
15901586
priv->regs = base;
15911587
priv->can.bittiming_const = &grcan_bittiming_const;
15921588
priv->can.do_set_bittiming = grcan_set_bittiming;
@@ -1639,6 +1635,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
16391635
static int grcan_probe(struct platform_device *ofdev)
16401636
{
16411637
struct device_node *np = ofdev->dev.of_node;
1638+
struct device_node *sysid_parent;
16421639
u32 sysid, ambafreq;
16431640
int irq, err;
16441641
void __iomem *base;
@@ -1647,10 +1644,15 @@ static int grcan_probe(struct platform_device *ofdev)
16471644
/* Compare GRLIB version number with the first that does not
16481645
* have the tx bug (see start_xmit)
16491646
*/
1650-
err = of_property_read_u32(np, "systemid", &sysid);
1651-
if (!err && ((sysid & GRLIB_VERSION_MASK)
1652-
>= GRCAN_TXBUG_SAFE_GRLIB_VERSION))
1653-
txbug = false;
1647+
sysid_parent = of_find_node_by_path("/ambapp0");
1648+
if (sysid_parent) {
1649+
of_node_get(sysid_parent);
1650+
err = of_property_read_u32(sysid_parent, "systemid", &sysid);
1651+
if (!err && ((sysid & GRLIB_VERSION_MASK) >=
1652+
GRCAN_TXBUG_SAFE_GRLIB_VERSION))
1653+
txbug = false;
1654+
of_node_put(sysid_parent);
1655+
}
16541656

16551657
err = of_property_read_u32(np, "freq", &ambafreq);
16561658
if (err) {

drivers/net/dsa/b53/b53_common.c

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,46 +1354,25 @@ static void b53_phylink_get_caps(struct dsa_switch *ds, int port,
13541354
config->legacy_pre_march2020 = false;
13551355
}
13561356

1357-
int b53_phylink_mac_link_state(struct dsa_switch *ds, int port,
1358-
struct phylink_link_state *state)
1357+
static struct phylink_pcs *b53_phylink_mac_select_pcs(struct dsa_switch *ds,
1358+
int port,
1359+
phy_interface_t interface)
13591360
{
13601361
struct b53_device *dev = ds->priv;
1361-
int ret = -EOPNOTSUPP;
13621362

1363-
if ((phy_interface_mode_is_8023z(state->interface) ||
1364-
state->interface == PHY_INTERFACE_MODE_SGMII) &&
1365-
dev->ops->serdes_link_state)
1366-
ret = dev->ops->serdes_link_state(dev, port, state);
1363+
if (!dev->ops->phylink_mac_select_pcs)
1364+
return NULL;
13671365

1368-
return ret;
1366+
return dev->ops->phylink_mac_select_pcs(dev, port, interface);
13691367
}
1370-
EXPORT_SYMBOL(b53_phylink_mac_link_state);
13711368

13721369
void b53_phylink_mac_config(struct dsa_switch *ds, int port,
13731370
unsigned int mode,
13741371
const struct phylink_link_state *state)
13751372
{
1376-
struct b53_device *dev = ds->priv;
1377-
1378-
if (mode == MLO_AN_PHY || mode == MLO_AN_FIXED)
1379-
return;
1380-
1381-
if ((phy_interface_mode_is_8023z(state->interface) ||
1382-
state->interface == PHY_INTERFACE_MODE_SGMII) &&
1383-
dev->ops->serdes_config)
1384-
dev->ops->serdes_config(dev, port, mode, state);
13851373
}
13861374
EXPORT_SYMBOL(b53_phylink_mac_config);
13871375

1388-
void b53_phylink_mac_an_restart(struct dsa_switch *ds, int port)
1389-
{
1390-
struct b53_device *dev = ds->priv;
1391-
1392-
if (dev->ops->serdes_an_restart)
1393-
dev->ops->serdes_an_restart(dev, port);
1394-
}
1395-
EXPORT_SYMBOL(b53_phylink_mac_an_restart);
1396-
13971376
void b53_phylink_mac_link_down(struct dsa_switch *ds, int port,
13981377
unsigned int mode,
13991378
phy_interface_t interface)
@@ -2269,9 +2248,8 @@ static const struct dsa_switch_ops b53_switch_ops = {
22692248
.phy_write = b53_phy_write16,
22702249
.adjust_link = b53_adjust_link,
22712250
.phylink_get_caps = b53_phylink_get_caps,
2272-
.phylink_mac_link_state = b53_phylink_mac_link_state,
2251+
.phylink_mac_select_pcs = b53_phylink_mac_select_pcs,
22732252
.phylink_mac_config = b53_phylink_mac_config,
2274-
.phylink_mac_an_restart = b53_phylink_mac_an_restart,
22752253
.phylink_mac_link_down = b53_phylink_mac_link_down,
22762254
.phylink_mac_link_up = b53_phylink_mac_link_up,
22772255
.port_enable = b53_enable_port,

drivers/net/dsa/b53/b53_priv.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121

2222
#include <linux/kernel.h>
2323
#include <linux/mutex.h>
24-
#include <linux/phy.h>
24+
#include <linux/phylink.h>
2525
#include <linux/etherdevice.h>
2626
#include <net/dsa.h>
2727

2828
#include "b53_regs.h"
2929

3030
struct b53_device;
3131
struct net_device;
32-
struct phylink_link_state;
3332

3433
struct b53_io_ops {
3534
int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value);
@@ -48,13 +47,10 @@ struct b53_io_ops {
4847
void (*irq_disable)(struct b53_device *dev, int port);
4948
void (*phylink_get_caps)(struct b53_device *dev, int port,
5049
struct phylink_config *config);
50+
struct phylink_pcs *(*phylink_mac_select_pcs)(struct b53_device *dev,
51+
int port,
52+
phy_interface_t interface);
5153
u8 (*serdes_map_lane)(struct b53_device *dev, int port);
52-
int (*serdes_link_state)(struct b53_device *dev, int port,
53-
struct phylink_link_state *state);
54-
void (*serdes_config)(struct b53_device *dev, int port,
55-
unsigned int mode,
56-
const struct phylink_link_state *state);
57-
void (*serdes_an_restart)(struct b53_device *dev, int port);
5854
void (*serdes_link_set)(struct b53_device *dev, int port,
5955
unsigned int mode, phy_interface_t interface,
6056
bool link_up);
@@ -85,8 +81,15 @@ enum {
8581
BCM7278_DEVICE_ID = 0x7278,
8682
};
8783

84+
struct b53_pcs {
85+
struct phylink_pcs pcs;
86+
struct b53_device *dev;
87+
u8 lane;
88+
};
89+
8890
#define B53_N_PORTS 9
8991
#define B53_N_PORTS_25 6
92+
#define B53_N_PCS 2
9093

9194
struct b53_port {
9295
u16 vlan_ctl_mask;
@@ -143,6 +146,8 @@ struct b53_device {
143146
bool vlan_enabled;
144147
unsigned int num_ports;
145148
struct b53_port *ports;
149+
150+
struct b53_pcs pcs[B53_N_PCS];
146151
};
147152

148153
#define b53_for_each_port(dev, i) \
@@ -336,12 +341,9 @@ int b53_br_flags(struct dsa_switch *ds, int port,
336341
struct netlink_ext_ack *extack);
337342
int b53_setup_devlink_resources(struct dsa_switch *ds);
338343
void b53_port_event(struct dsa_switch *ds, int port);
339-
int b53_phylink_mac_link_state(struct dsa_switch *ds, int port,
340-
struct phylink_link_state *state);
341344
void b53_phylink_mac_config(struct dsa_switch *ds, int port,
342345
unsigned int mode,
343346
const struct phylink_link_state *state);
344-
void b53_phylink_mac_an_restart(struct dsa_switch *ds, int port);
345347
void b53_phylink_mac_link_down(struct dsa_switch *ds, int port,
346348
unsigned int mode,
347349
phy_interface_t interface);

0 commit comments

Comments
 (0)