Commit 1e15510b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull networking fixes from Jakub Kicinski:
 "Including fixes from bluetooth.

  We didn't get netfilter or wireless PRs this week, so next week's PR
  is probably going to be bigger. A healthy dose of fixes for bugs
  introduced in the current release nonetheless.

  Current release - regressions:

   - Bluetooth: always allow SCO packets for user channel

   - af_unix: fix memory leak in unix_dgram_sendmsg()

   - rxrpc:
       - remove redundant peer->mtu_lock causing lockdep splats
       - fix spinlock flavor issues with the peer record hash

   - eth: iavf: fix circular lock dependency with netdev_lock

   - net: use rtnl_net_dev_lock() in
     register_netdevice_notifier_dev_net() RDMA driver register notifier
     after the device

  Current release - new code bugs:

   - ethtool: fix ioctl confusing drivers about desired HDS user config

   - eth: ixgbe: fix media cage present detection for E610 device

  Previous releases - regressions:

   - loopback: avoid sending IP packets without an Ethernet header

   - mptcp: reset connection when MPTCP opts are dropped after join

  Previous releases - always broken:

   - net: better track kernel sockets lifetime

   - ipv6: fix dst ref loop on input in seg6 and rpl lw tunnels

   - phy: qca807x: use right value from DTS for DAC_DSP_BIAS_CURRENT

   - eth: enetc: number of error handling fixes

   - dsa: rtl8366rb: reshuffle the code to fix config / build issue with
     LED support"

* tag 'net-6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (53 commits)
  net: ti: icss-iep: Reject perout generation request
  idpf: fix checksums set in idpf_rx_rsc()
  selftests: drv-net: Check if combined-count exists
  net: ipv6: fix dst ref loop on input in rpl lwt
  net: ipv6: fix dst ref loop on input in seg6 lwt
  usbnet: gl620a: fix endpoint checking in genelink_bind()
  net/mlx5: IRQ, Fix null string in debug print
  net/mlx5: Restore missing trace event when enabling vport QoS
  net/mlx5: Fix vport QoS cleanup on error
  net: mvpp2: cls: Fixed Non IP flow, with vlan tag flow defination.
  af_unix: Fix memory leak in unix_dgram_sendmsg()
  net: Handle napi_schedule() calls from non-interrupt
  net: Clear old fragment checksum value in napi_reuse_skb
  gve: unlink old napi when stopping a queue using queue API
  net: Use rtnl_net_dev_lock() in register_netdevice_notifier_dev_net().
  tcp: Defer ts_recent changes until req is owned
  net: enetc: fix the off-by-one issue in enetc_map_tx_tso_buffs()
  net: enetc: remove the mm_lock from the ENETC v4 driver
  net: enetc: add missing enetc4_link_deinit()
  net: enetc: update UDP checksum when updating originTimestamp field
  ...
parents f09d694c 54e1b4be
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2878,7 +2878,7 @@ F: drivers/pinctrl/nxp/
ARM/NXP S32G/S32R DWMAC ETHERNET DRIVER
M:	Jan Petrous <jan.petrous@oss.nxp.com>
L:	NXP S32 Linux Team <s32@nxp.com>
R:	s32@nxp.com
S:	Maintained
F:	Documentation/devicetree/bindings/net/nxp,s32-dwmac.yaml
F:	drivers/net/ethernet/stmicro/stmmac/dwmac-s32.c
@@ -21922,10 +21922,13 @@ F: sound/soc/uniphier/
SOCKET TIMESTAMPING
M:	Willem de Bruijn <willemdebruijn.kernel@gmail.com>
R:	Jason Xing <kernelxing@tencent.com>
S:	Maintained
F:	Documentation/networking/timestamping.rst
F:	include/linux/net_tstamp.h
F:	include/uapi/linux/net_tstamp.h
F:	tools/testing/selftests/bpf/*/net_timestamping*
F:	tools/testing/selftests/net/*timestamp*
F:	tools/testing/selftests/net/so_txtime.c
SOEKRIS NET48XX LED SUPPORT
+4 −2
Original line number Diff line number Diff line
@@ -2102,7 +2102,8 @@ static int btusb_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
		return submit_or_queue_tx_urb(hdev, urb);

	case HCI_SCODATA_PKT:
		if (hci_conn_num(hdev, SCO_LINK) < 1)
		if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
		    hci_conn_num(hdev, SCO_LINK) < 1)
			return -ENODEV;

		urb = alloc_isoc_urb(hdev, skb);
@@ -2576,7 +2577,8 @@ static int btusb_send_frame_intel(struct hci_dev *hdev, struct sk_buff *skb)
		return submit_or_queue_tx_urb(hdev, urb);

	case HCI_SCODATA_PKT:
		if (hci_conn_num(hdev, SCO_LINK) < 1)
		if (!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
		    hci_conn_num(hdev, SCO_LINK) < 1)
			return -ENODEV;

		urb = alloc_isoc_urb(hdev, skb);
+6 −0
Original line number Diff line number Diff line
@@ -43,4 +43,10 @@ config NET_DSA_REALTEK_RTL8366RB
	help
	  Select to enable support for Realtek RTL8366RB.

config NET_DSA_REALTEK_RTL8366RB_LEDS
	bool "Support RTL8366RB LED control"
	depends on (LEDS_CLASS=y || LEDS_CLASS=NET_DSA_REALTEK_RTL8366RB)
	depends on NET_DSA_REALTEK_RTL8366RB
	default NET_DSA_REALTEK_RTL8366RB

endif
+3 −0
Original line number Diff line number Diff line
@@ -12,4 +12,7 @@ endif

obj-$(CONFIG_NET_DSA_REALTEK_RTL8366RB) += rtl8366.o
rtl8366-objs 				:= rtl8366-core.o rtl8366rb.o
ifdef CONFIG_NET_DSA_REALTEK_RTL8366RB_LEDS
rtl8366-objs 				+= rtl8366rb-leds.o
endif
obj-$(CONFIG_NET_DSA_REALTEK_RTL8365MB) += rtl8365mb.o
+177 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0

#include <linux/bitops.h>
#include <linux/regmap.h>
#include <net/dsa.h>
#include "rtl83xx.h"
#include "rtl8366rb.h"

static inline u32 rtl8366rb_led_group_port_mask(u8 led_group, u8 port)
{
	switch (led_group) {
	case 0:
		return FIELD_PREP(RTL8366RB_LED_0_X_CTRL_MASK, BIT(port));
	case 1:
		return FIELD_PREP(RTL8366RB_LED_0_X_CTRL_MASK, BIT(port));
	case 2:
		return FIELD_PREP(RTL8366RB_LED_0_X_CTRL_MASK, BIT(port));
	case 3:
		return FIELD_PREP(RTL8366RB_LED_0_X_CTRL_MASK, BIT(port));
	default:
		return 0;
	}
}

static int rb8366rb_get_port_led(struct rtl8366rb_led *led)
{
	struct realtek_priv *priv = led->priv;
	u8 led_group = led->led_group;
	u8 port_num = led->port_num;
	int ret;
	u32 val;

	ret = regmap_read(priv->map, RTL8366RB_LED_X_X_CTRL_REG(led_group),
			  &val);
	if (ret) {
		dev_err(priv->dev, "error reading LED on port %d group %d\n",
			led_group, port_num);
		return ret;
	}

	return !!(val & rtl8366rb_led_group_port_mask(led_group, port_num));
}

static int rb8366rb_set_port_led(struct rtl8366rb_led *led, bool enable)
{
	struct realtek_priv *priv = led->priv;
	u8 led_group = led->led_group;
	u8 port_num = led->port_num;
	int ret;

	ret = regmap_update_bits(priv->map,
				 RTL8366RB_LED_X_X_CTRL_REG(led_group),
				 rtl8366rb_led_group_port_mask(led_group,
							       port_num),
				 enable ? 0xffff : 0);
	if (ret) {
		dev_err(priv->dev, "error updating LED on port %d group %d\n",
			led_group, port_num);
		return ret;
	}

	/* Change the LED group to manual controlled LEDs if required */
	ret = rb8366rb_set_ledgroup_mode(priv, led_group,
					 RTL8366RB_LEDGROUP_FORCE);

	if (ret) {
		dev_err(priv->dev, "error updating LED GROUP group %d\n",
			led_group);
		return ret;
	}

	return 0;
}

static int
rtl8366rb_cled_brightness_set_blocking(struct led_classdev *ldev,
				       enum led_brightness brightness)
{
	struct rtl8366rb_led *led = container_of(ldev, struct rtl8366rb_led,
						 cdev);

	return rb8366rb_set_port_led(led, brightness == LED_ON);
}

static int rtl8366rb_setup_led(struct realtek_priv *priv, struct dsa_port *dp,
			       struct fwnode_handle *led_fwnode)
{
	struct rtl8366rb *rb = priv->chip_data;
	struct led_init_data init_data = { };
	enum led_default_state state;
	struct rtl8366rb_led *led;
	u32 led_group;
	int ret;

	ret = fwnode_property_read_u32(led_fwnode, "reg", &led_group);
	if (ret)
		return ret;

	if (led_group >= RTL8366RB_NUM_LEDGROUPS) {
		dev_warn(priv->dev, "Invalid LED reg %d defined for port %d",
			 led_group, dp->index);
		return -EINVAL;
	}

	led = &rb->leds[dp->index][led_group];
	led->port_num = dp->index;
	led->led_group = led_group;
	led->priv = priv;

	state = led_init_default_state_get(led_fwnode);
	switch (state) {
	case LEDS_DEFSTATE_ON:
		led->cdev.brightness = 1;
		rb8366rb_set_port_led(led, 1);
		break;
	case LEDS_DEFSTATE_KEEP:
		led->cdev.brightness =
			rb8366rb_get_port_led(led);
		break;
	case LEDS_DEFSTATE_OFF:
	default:
		led->cdev.brightness = 0;
		rb8366rb_set_port_led(led, 0);
	}

	led->cdev.max_brightness = 1;
	led->cdev.brightness_set_blocking =
		rtl8366rb_cled_brightness_set_blocking;
	init_data.fwnode = led_fwnode;
	init_data.devname_mandatory = true;

	init_data.devicename = kasprintf(GFP_KERNEL, "Realtek-%d:0%d:%d",
					 dp->ds->index, dp->index, led_group);
	if (!init_data.devicename)
		return -ENOMEM;

	ret = devm_led_classdev_register_ext(priv->dev, &led->cdev, &init_data);
	if (ret) {
		dev_warn(priv->dev, "Failed to init LED %d for port %d",
			 led_group, dp->index);
		return ret;
	}

	return 0;
}

int rtl8366rb_setup_leds(struct realtek_priv *priv)
{
	struct dsa_switch *ds = &priv->ds;
	struct device_node *leds_np;
	struct dsa_port *dp;
	int ret = 0;

	dsa_switch_for_each_port(dp, ds) {
		if (!dp->dn)
			continue;

		leds_np = of_get_child_by_name(dp->dn, "leds");
		if (!leds_np) {
			dev_dbg(priv->dev, "No leds defined for port %d",
				dp->index);
			continue;
		}

		for_each_child_of_node_scoped(leds_np, led_np) {
			ret = rtl8366rb_setup_led(priv, dp,
						  of_fwnode_handle(led_np));
			if (ret)
				break;
		}

		of_node_put(leds_np);
		if (ret)
			return ret;
	}
	return 0;
}
Loading