Skip to content

Commit 2c89c1b

Browse files
committed
Merge tag 'net-6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni: "Including fixes from CAN, WiFi and netfilter. We have still a comple of regressions open due to the recent drivers locking refactor. The patches are in-flight, but not ready yet. Current release - regressions: - core: lock netdevices during dev_shutdown - sch_htb: make htb_deactivate() idempotent - eth: virtio-net: don't re-enable refill work too early Current release - new code bugs: - eth: icssg-prueth: fix kernel panic during concurrent Tx queue access Previous releases - regressions: - gre: fix again IPv6 link-local address generation. - eth: b53: fix learning on VLAN unaware bridges Previous releases - always broken: - wifi: fix out-of-bounds access during multi-link element defragmentation - can: - initialize spin lock on device probe - fix order of unregistration calls - openvswitch: fix unsafe attribute parsing in output_userspace() - eth: - virtio-net: fix total qstat values - mtk_eth_soc: reset all TX queues on DMA free - fbnic: firmware IPC mailbox fixes" * tag 'net-6.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (55 commits) virtio-net: fix total qstat values net: export a helper for adding up queue stats fbnic: Do not allow mailbox to toggle to ready outside fbnic_mbx_poll_tx_ready fbnic: Pull fbnic_fw_xmit_cap_msg use out of interrupt context fbnic: Improve responsiveness of fbnic_mbx_poll_tx_ready fbnic: Cleanup handling of completions fbnic: Actually flush_tx instead of stalling out fbnic: Add additional handling of IRQs fbnic: Gate AXI read/write enabling on FW mailbox fbnic: Fix initialization of mailbox descriptor rings net: dsa: b53: do not set learning and unicast/multicast on up net: dsa: b53: fix learning on VLAN unaware bridges net: dsa: b53: fix toggling vlan_filtering net: dsa: b53: do not program vlans when vlan filtering is off net: dsa: b53: do not allow to configure VLAN 0 net: dsa: b53: always rejoin default untagged VLAN on bridge leave net: dsa: b53: fix VLAN ID for untagged vlan on bridge leave net: dsa: b53: fix flushing old pvid VLAN on pvid change net: dsa: b53: fix clearing PVID of a port net: dsa: b53: keep CPU port always tagged again ...
2 parents 26a9a47 + 3c44b2d commit 2c89c1b

File tree

44 files changed

+1049
-429
lines changed

Some content is hidden

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

44 files changed

+1049
-429
lines changed

Documentation/devicetree/bindings/net/ethernet-controller.yaml

Lines changed: 90 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,17 @@ properties:
7474
- rev-rmii
7575
- moca
7676

77-
# RX and TX delays are added by the MAC when required
77+
# RX and TX delays are provided by the PCB. See below
7878
- rgmii
7979

80-
# RGMII with internal RX and TX delays provided by the PHY,
81-
# the MAC should not add the RX or TX delays in this case
80+
# RX and TX delays are not provided by the PCB. This is the most
81+
# frequent case. See below
8282
- rgmii-id
8383

84-
# RGMII with internal RX delay provided by the PHY, the MAC
85-
# should not add an RX delay in this case
84+
# TX delay is provided by the PCB. See below
8685
- rgmii-rxid
8786

88-
# RGMII with internal TX delay provided by the PHY, the MAC
89-
# should not add an TX delay in this case
87+
# RX delay is provided by the PCB. See below
9088
- rgmii-txid
9189
- rtbi
9290
- smii
@@ -286,4 +284,89 @@ allOf:
286284

287285
additionalProperties: true
288286

287+
# Informative
288+
# ===========
289+
#
290+
# 'phy-modes' & 'phy-connection-type' properties 'rgmii', 'rgmii-id',
291+
# 'rgmii-rxid', and 'rgmii-txid' are frequently used wrongly by
292+
# developers. This informative section clarifies their usage.
293+
#
294+
# The RGMII specification requires a 2ns delay between the data and
295+
# clock signals on the RGMII bus. How this delay is implemented is not
296+
# specified.
297+
#
298+
# One option is to make the clock traces on the PCB longer than the
299+
# data traces. A sufficiently difference in length can provide the 2ns
300+
# delay. If both the RX and TX delays are implemented in this manner,
301+
# 'rgmii' should be used, so indicating the PCB adds the delays.
302+
#
303+
# If the PCB does not add these delays via extra long traces,
304+
# 'rgmii-id' should be used. Here, 'id' refers to 'internal delay',
305+
# where either the MAC or PHY adds the delay.
306+
#
307+
# If only one of the two delays are implemented via extra long clock
308+
# lines, either 'rgmii-rxid' or 'rgmii-txid' should be used,
309+
# indicating the MAC or PHY should implement one of the delays
310+
# internally, while the PCB implements the other delay.
311+
#
312+
# Device Tree describes hardware, and in this case, it describes the
313+
# PCB between the MAC and the PHY, if the PCB implements delays or
314+
# not.
315+
#
316+
# In practice, very few PCBs make use of extra long clock lines. Hence
317+
# any RGMII phy mode other than 'rgmii-id' is probably wrong, and is
318+
# unlikely to be accepted during review without details provided in
319+
# the commit description and comments in the .dts file.
320+
#
321+
# When the PCB does not implement the delays, the MAC or PHY must. As
322+
# such, this is software configuration, and so not described in Device
323+
# Tree.
324+
#
325+
# The following describes how Linux implements the configuration of
326+
# the MAC and PHY to add these delays when the PCB does not. As stated
327+
# above, developers often get this wrong, and the aim of this section
328+
# is reduce the frequency of these errors by Linux developers. Other
329+
# users of the Device Tree may implement it differently, and still be
330+
# consistent with both the normative and informative description
331+
# above.
332+
#
333+
# By default in Linux, when using phylib/phylink, the MAC is expected
334+
# to read the 'phy-mode' from Device Tree, not implement any delays,
335+
# and pass the value to the PHY. The PHY will then implement delays as
336+
# specified by the 'phy-mode'. The PHY should always be reconfigured
337+
# to implement the needed delays, replacing any setting performed by
338+
# strapping or the bootloader, etc.
339+
#
340+
# Experience to date is that all PHYs which implement RGMII also
341+
# implement the ability to add or not add the needed delays. Hence
342+
# this default is expected to work in all cases. Ignoring this default
343+
# is likely to be questioned by Reviews, and require a strong argument
344+
# to be accepted.
345+
#
346+
# There are a small number of cases where the MAC has hard coded
347+
# delays which cannot be disabled. The 'phy-mode' only describes the
348+
# PCB. The inability to disable the delays in the MAC does not change
349+
# the meaning of 'phy-mode'. It does however mean that a 'phy-mode' of
350+
# 'rgmii' is now invalid, it cannot be supported, since both the PCB
351+
# and the MAC and PHY adding delays cannot result in a functional
352+
# link. Thus the MAC should report a fatal error for any modes which
353+
# cannot be supported. When the MAC implements the delay, it must
354+
# ensure that the PHY does not also implement the same delay. So it
355+
# must modify the phy-mode it passes to the PHY, removing the delay it
356+
# has added. Failure to remove the delay will result in a
357+
# non-functioning link.
358+
#
359+
# Sometimes there is a need to fine tune the delays. Often the MAC or
360+
# PHY can perform this fine tuning. In the MAC node, the Device Tree
361+
# properties 'rx-internal-delay-ps' and 'tx-internal-delay-ps' should
362+
# be used to indicate fine tuning performed by the MAC. The values
363+
# expected here are small. A value of 2000ps, i.e 2ns, and a phy-mode
364+
# of 'rgmii' will not be accepted by Reviewers.
365+
#
366+
# If the PHY is to perform fine tuning, the properties
367+
# 'rx-internal-delay-ps' and 'tx-internal-delay-ps' in the PHY node
368+
# should be used. When the PHY is implementing delays, e.g. 'rgmii-id'
369+
# these properties should have a value near to 2000ps. If the PCB is
370+
# implementing delays, e.g. 'rgmii', a small value can be used to fine
371+
# tune the delay added by the PCB.
289372
...

drivers/net/can/m_can/m_can.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2379,6 +2379,7 @@ struct m_can_classdev *m_can_class_allocate_dev(struct device *dev,
23792379
SET_NETDEV_DEV(net_dev, dev);
23802380

23812381
m_can_of_parse_mram(class_dev, mram_config_vals);
2382+
spin_lock_init(&class_dev->tx_handling_spinlock);
23822383
out:
23832384
return class_dev;
23842385
}
@@ -2462,9 +2463,9 @@ EXPORT_SYMBOL_GPL(m_can_class_register);
24622463

24632464
void m_can_class_unregister(struct m_can_classdev *cdev)
24642465
{
2466+
unregister_candev(cdev->net);
24652467
if (cdev->is_peripheral)
24662468
can_rx_offload_del(&cdev->offload);
2467-
unregister_candev(cdev->net);
24682469
}
24692470
EXPORT_SYMBOL_GPL(m_can_class_unregister);
24702471

drivers/net/can/rockchip/rockchip_canfd-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ static void rkcanfd_remove(struct platform_device *pdev)
937937
struct rkcanfd_priv *priv = platform_get_drvdata(pdev);
938938
struct net_device *ndev = priv->ndev;
939939

940-
can_rx_offload_del(&priv->offload);
941940
rkcanfd_unregister(priv);
941+
can_rx_offload_del(&priv->offload);
942942
free_candev(ndev);
943943
}
944944

drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,24 @@ static const struct can_bittiming_const mcp251xfd_data_bittiming_const = {
7575
.brp_inc = 1,
7676
};
7777

78+
/* The datasheet of the mcp2518fd (DS20006027B) specifies a range of
79+
* [-64,63] for TDCO, indicating a relative TDCO.
80+
*
81+
* Manual tests have shown, that using a relative TDCO configuration
82+
* results in bus off, while an absolute configuration works.
83+
*
84+
* For TDCO use the max value (63) from the data sheet, but 0 as the
85+
* minimum.
86+
*/
87+
static const struct can_tdc_const mcp251xfd_tdc_const = {
88+
.tdcv_min = 0,
89+
.tdcv_max = 63,
90+
.tdco_min = 0,
91+
.tdco_max = 63,
92+
.tdcf_min = 0,
93+
.tdcf_max = 0,
94+
};
95+
7896
static const char *__mcp251xfd_get_model_str(enum mcp251xfd_model model)
7997
{
8098
switch (model) {
@@ -510,8 +528,7 @@ static int mcp251xfd_set_bittiming(const struct mcp251xfd_priv *priv)
510528
{
511529
const struct can_bittiming *bt = &priv->can.bittiming;
512530
const struct can_bittiming *dbt = &priv->can.data_bittiming;
513-
u32 val = 0;
514-
s8 tdco;
531+
u32 tdcmod, val = 0;
515532
int err;
516533

517534
/* CAN Control Register
@@ -575,11 +592,16 @@ static int mcp251xfd_set_bittiming(const struct mcp251xfd_priv *priv)
575592
return err;
576593

577594
/* Transmitter Delay Compensation */
578-
tdco = clamp_t(int, dbt->brp * (dbt->prop_seg + dbt->phase_seg1),
579-
-64, 63);
580-
val = FIELD_PREP(MCP251XFD_REG_TDC_TDCMOD_MASK,
581-
MCP251XFD_REG_TDC_TDCMOD_AUTO) |
582-
FIELD_PREP(MCP251XFD_REG_TDC_TDCO_MASK, tdco);
595+
if (priv->can.ctrlmode & CAN_CTRLMODE_TDC_AUTO)
596+
tdcmod = MCP251XFD_REG_TDC_TDCMOD_AUTO;
597+
else if (priv->can.ctrlmode & CAN_CTRLMODE_TDC_MANUAL)
598+
tdcmod = MCP251XFD_REG_TDC_TDCMOD_MANUAL;
599+
else
600+
tdcmod = MCP251XFD_REG_TDC_TDCMOD_DISABLED;
601+
602+
val = FIELD_PREP(MCP251XFD_REG_TDC_TDCMOD_MASK, tdcmod) |
603+
FIELD_PREP(MCP251XFD_REG_TDC_TDCV_MASK, priv->can.tdc.tdcv) |
604+
FIELD_PREP(MCP251XFD_REG_TDC_TDCO_MASK, priv->can.tdc.tdco);
583605

584606
return regmap_write(priv->map_reg, MCP251XFD_REG_TDC, val);
585607
}
@@ -2083,10 +2105,12 @@ static int mcp251xfd_probe(struct spi_device *spi)
20832105
priv->can.do_get_berr_counter = mcp251xfd_get_berr_counter;
20842106
priv->can.bittiming_const = &mcp251xfd_bittiming_const;
20852107
priv->can.data_bittiming_const = &mcp251xfd_data_bittiming_const;
2108+
priv->can.tdc_const = &mcp251xfd_tdc_const;
20862109
priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
20872110
CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_BERR_REPORTING |
20882111
CAN_CTRLMODE_FD | CAN_CTRLMODE_FD_NON_ISO |
2089-
CAN_CTRLMODE_CC_LEN8_DLC;
2112+
CAN_CTRLMODE_CC_LEN8_DLC | CAN_CTRLMODE_TDC_AUTO |
2113+
CAN_CTRLMODE_TDC_MANUAL;
20902114
set_bit(MCP251XFD_FLAGS_DOWN, priv->flags);
20912115
priv->ndev = ndev;
20922116
priv->spi = spi;
@@ -2174,8 +2198,8 @@ static void mcp251xfd_remove(struct spi_device *spi)
21742198
struct mcp251xfd_priv *priv = spi_get_drvdata(spi);
21752199
struct net_device *ndev = priv->ndev;
21762200

2177-
can_rx_offload_del(&priv->offload);
21782201
mcp251xfd_unregister(priv);
2202+
can_rx_offload_del(&priv->offload);
21792203
spi->max_speed_hz = priv->spi_max_speed_hz_orig;
21802204
free_candev(ndev);
21812205
}

0 commit comments

Comments
 (0)