Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net-next v2 03/12] ethtool: Add loopback netlink UAPI definitions
From: Jakub Kicinski @ 2026-03-26 22:23 UTC (permalink / raw)
  To: Björn Töpel
  Cc: netdev, David S. Miller, Andrew Lunn, Donald Hunter, Eric Dumazet,
	Maxime Chevallier, Naveen Mamindlapalli, Paolo Abeni,
	Simon Horman, Danielle Ratson, Hariprasad Kelam, Ido Schimmel,
	Kory Maincent, Leon Romanovsky, Michael Chan, Oleksij Rempel,
	Pavan Chebbi, Piergiorgio Beruto, Russell King, Saeed Mahameed,
	Shuah Khan, Tariq Toukan, Willem de Bruijn, Kees Cook,
	linux-kernel, linux-kselftest, linux-rdma
In-Reply-To: <20260325145022.2607545-4-bjorn@kernel.org>

On Wed, 25 Mar 2026 15:50:10 +0100 Björn Töpel wrote:
> +      -
> +        name: depth
> +        type: u8
> +        doc: |
> +          Ordering index within a component instance. When a component
> +          has multiple loopback points of the same type (e.g. two PCS
> +          blocks inside a rate-adaptation PHY), depth distinguishes
> +          them. Lower depth values are closer to the host side, higher
> +          values are closer to the line/media side. Defaults to 0 when
> +          there is only one loopback point per (component, name) tuple.
> +      -
> +        name: supported
> +        type: u8
> +        enum: loopback-direction
> +        enum-as-flags: true
> +        doc: Bitmask of supported loopback directions
> +      -
> +        name: direction
> +        type: u8
> +        enum: loopback-direction
> +        doc: Current loopback direction, 0 means disabled

u32, Netlink attrs are padded to 4B anyway

^ permalink raw reply

* Re: [PATCH net-next v2 03/12] ethtool: Add loopback netlink UAPI definitions
From: Jakub Kicinski @ 2026-03-26 22:22 UTC (permalink / raw)
  To: Björn Töpel
  Cc: netdev, David S. Miller, Andrew Lunn, Donald Hunter, Eric Dumazet,
	Maxime Chevallier, Naveen Mamindlapalli, Paolo Abeni,
	Simon Horman, Danielle Ratson, Hariprasad Kelam, Ido Schimmel,
	Kory Maincent, Leon Romanovsky, Michael Chan, Oleksij Rempel,
	Pavan Chebbi, Piergiorgio Beruto, Russell King, Saeed Mahameed,
	Shuah Khan, Tariq Toukan, Willem de Bruijn, Kees Cook,
	linux-kernel, linux-kselftest, linux-rdma
In-Reply-To: <20260325145022.2607545-4-bjorn@kernel.org>

On Wed, 25 Mar 2026 15:50:10 +0100 Björn Töpel wrote:
> +      -
> +        name: unspec
> +        type: unused
> +        value: 0

I don't think we need to add unspec attrs for new sets ?

^ permalink raw reply

* Re: [PATCH next] netfilter: nf_conntrack_h323: Correct indentation when H323_TRACE defined
From: David Laight @ 2026-03-26 22:18 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Florian Westphal, Phil Sutter, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, netfilter-devel,
	coreteam, netdev, linux-kernel, Masami Hiramatsu, Petr Mladek,
	Rasmus Villemoes, Andy Shevchenko, Steven Rostedt,
	Sergey Senozhatsky, Andrew Morton
In-Reply-To: <acWWBxmPd_BNqUHF@chamomile>

On Thu, 26 Mar 2026 21:24:39 +0100
Pablo Neira Ayuso <pablo@netfilter.org> wrote:

> Hi David,
> 
> On Thu, Mar 26, 2026 at 08:18:19PM +0000, david.laight.linux@gmail.com wrote:
> > From: David Laight <david.laight.linux@gmail.com>
> > 
> > The trace lines are indented using PRINT("%*.s", xx, " ").
> > Userspace will treat this as "%*.0s" and will output no characters
> > when 'xx' is zero, the kernel treats it as "%*s" and will output
> > a single ' ' - which is probably what is intended.
> > 
> > Change all the formats to "%*s" removing the default precision.
> > This gives a single space indent when level is zero.  
> 
> Do you have a setup using this helper? Or you just found this via
> visual inspection?

Found with grep looking for places which might be affected by 'fixing'
the kernel printf code to be POSIX compliant.

	David

> 
> > Signed-off-by: David Laight <david.laight.linux@gmail.com>
> > ---
> >  net/netfilter/nf_conntrack_h323_asn1.c | 38 +++++++++++++-------------
> >  1 file changed, 19 insertions(+), 19 deletions(-)
> > 
> > diff --git a/net/netfilter/nf_conntrack_h323_asn1.c b/net/netfilter/nf_conntrack_h323_asn1.c
> > index 7b1497ed97d2..287402428975 100644
> > --- a/net/netfilter/nf_conntrack_h323_asn1.c
> > +++ b/net/netfilter/nf_conntrack_h323_asn1.c
> > @@ -276,7 +276,7 @@ static unsigned int get_uint(struct bitstr *bs, int b)
> >  static int decode_nul(struct bitstr *bs, const struct field_t *f,
> >                        char *base, int level)
> >  {
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	return H323_ERROR_NONE;
> >  }
> > @@ -284,7 +284,7 @@ static int decode_nul(struct bitstr *bs, const struct field_t *f,
> >  static int decode_bool(struct bitstr *bs, const struct field_t *f,
> >                         char *base, int level)
> >  {
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	INC_BIT(bs);
> >  	if (nf_h323_error_boundary(bs, 0, 0))
> > @@ -297,7 +297,7 @@ static int decode_oid(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	BYTE_ALIGN(bs);
> >  	if (nf_h323_error_boundary(bs, 1, 0))
> > @@ -316,7 +316,7 @@ static int decode_int(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s", level * TAB_SIZE, " ", f->name);
> >  
> >  	switch (f->sz) {
> >  	case BYTE:		/* Range == 256 */
> > @@ -363,7 +363,7 @@ static int decode_int(struct bitstr *bs, const struct field_t *f,
> >  static int decode_enum(struct bitstr *bs, const struct field_t *f,
> >                         char *base, int level)
> >  {
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	if ((f->attr & EXT) && get_bit(bs)) {
> >  		INC_BITS(bs, 7);
> > @@ -381,7 +381,7 @@ static int decode_bitstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	BYTE_ALIGN(bs);
> >  	switch (f->sz) {
> > @@ -417,7 +417,7 @@ static int decode_numstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* 2 <= Range <= 255 */
> >  	if (nf_h323_error_boundary(bs, 0, f->sz))
> > @@ -437,7 +437,7 @@ static int decode_octstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s", level * TAB_SIZE, " ", f->name);
> >  
> >  	switch (f->sz) {
> >  	case FIXD:		/* Range == 1 */
> > @@ -490,7 +490,7 @@ static int decode_bmpstr(struct bitstr *bs, const struct field_t *f,
> >  {
> >  	unsigned int len;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	switch (f->sz) {
> >  	case BYTE:		/* Range == 256 */
> > @@ -522,7 +522,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  	const struct field_t *son;
> >  	unsigned char *beg = NULL;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* Decode? */
> >  	base = (base && (f->attr & DECODE)) ? base + f->offset : NULL;
> > @@ -544,7 +544,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  	/* Decode the root components */
> >  	for (i = opt = 0, son = f->fields; i < f->lb; i++, son++) {
> >  		if (son->attr & STOP) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			return H323_ERROR_STOP;
> >  		}
> > @@ -562,7 +562,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  			if (nf_h323_error_boundary(bs, len, 0))
> >  				return H323_ERROR_BOUND;
> >  			if (!base || !(son->attr & DECODE)) {
> > -				PRINT("%*.s%s\n", (level + 1) * TAB_SIZE,
> > +				PRINT("%*s%s\n", (level + 1) * TAB_SIZE,
> >  				      " ", son->name);
> >  				bs->cur += len;
> >  				continue;
> > @@ -615,7 +615,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  		}
> >  
> >  		if (son->attr & STOP) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			return H323_ERROR_STOP;
> >  		}
> > @@ -629,7 +629,7 @@ static int decode_seq(struct bitstr *bs, const struct field_t *f,
> >  		if (nf_h323_error_boundary(bs, len, 0))
> >  			return H323_ERROR_BOUND;
> >  		if (!base || !(son->attr & DECODE)) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			bs->cur += len;
> >  			continue;
> > @@ -655,7 +655,7 @@ static int decode_seqof(struct bitstr *bs, const struct field_t *f,
> >  	const struct field_t *son;
> >  	unsigned char *beg = NULL;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* Decode? */
> >  	base = (base && (f->attr & DECODE)) ? base + f->offset : NULL;
> > @@ -710,7 +710,7 @@ static int decode_seqof(struct bitstr *bs, const struct field_t *f,
> >  			if (nf_h323_error_boundary(bs, len, 0))
> >  				return H323_ERROR_BOUND;
> >  			if (!base || !(son->attr & DECODE)) {
> > -				PRINT("%*.s%s\n", (level + 1) * TAB_SIZE,
> > +				PRINT("%*s%s\n", (level + 1) * TAB_SIZE,
> >  				      " ", son->name);
> >  				bs->cur += len;
> >  				continue;
> > @@ -751,7 +751,7 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f,
> >  	const struct field_t *son;
> >  	unsigned char *beg = NULL;
> >  
> > -	PRINT("%*.s%s\n", level * TAB_SIZE, " ", f->name);
> > +	PRINT("%*s%s\n", level * TAB_SIZE, " ", f->name);
> >  
> >  	/* Decode? */
> >  	base = (base && (f->attr & DECODE)) ? base + f->offset : NULL;
> > @@ -792,7 +792,7 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f,
> >  	/* Transfer to son level */
> >  	son = &f->fields[type];
> >  	if (son->attr & STOP) {
> > -		PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ", son->name);
> > +		PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ", son->name);
> >  		return H323_ERROR_STOP;
> >  	}
> >  
> > @@ -804,7 +804,7 @@ static int decode_choice(struct bitstr *bs, const struct field_t *f,
> >  		if (nf_h323_error_boundary(bs, len, 0))
> >  			return H323_ERROR_BOUND;
> >  		if (!base || !(son->attr & DECODE)) {
> > -			PRINT("%*.s%s\n", (level + 1) * TAB_SIZE, " ",
> > +			PRINT("%*s%s\n", (level + 1) * TAB_SIZE, " ",
> >  			      son->name);
> >  			bs->cur += len;
> >  			return H323_ERROR_NONE;
> > -- 
> > 2.39.5
> >   


^ permalink raw reply

* Re: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
From: kernel test robot @ 2026-03-26 22:16 UTC (permalink / raw)
  To: luka.gejak, davem, edumazet, kuba, pabeni, netdev
  Cc: llvm, oe-kbuild-all, horms, fmaurer, liuhangbin, linux-kernel,
	Luka Gejak
In-Reply-To: <20260324144630.189094-3-luka.gejak@linux.dev>

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/luka-gejak-linux-dev/net-hsr-constify-hsr_ops-and-prp_ops-protocol-operation-structures/20260326-143638
base:   net-next/main
patch link:    https://lore.kernel.org/r/20260324144630.189094-3-luka.gejak%40linux.dev
patch subject: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
config: i386-randconfig-001-20260327 (https://download.01.org/0day-ci/archive/20260327/202603270658.FJCTgZee-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260327/202603270658.FJCTgZee-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603270658.FJCTgZee-lkp@intel.com/

All errors (new ones prefixed by >>):

>> net/hsr/hsr_netlink.c:436:2: error: fallthrough annotation is outside switch statement
     436 |         fallthrough;
         |         ^
   include/linux/compiler_attributes.h:214:56: note: expanded from macro 'fallthrough'
     214 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                                        ^
   net/hsr/hsr_netlink.c:527:2: error: fallthrough annotation is outside switch statement
     527 |         fallthrough;
         |         ^
   include/linux/compiler_attributes.h:214:56: note: expanded from macro 'fallthrough'
     214 | # define fallthrough                    __attribute__((__fallthrough__))
         |                                                        ^
   2 errors generated.


vim +436 net/hsr/hsr_netlink.c

   300	
   301	/* HSR_C_GET_NODE_STATUS lets userspace query the internal HSR node table
   302	 * about the status of a specific node in the network, defined by its MAC
   303	 * address.
   304	 *
   305	 * Input: hsr ifindex, node mac address
   306	 * Output: hsr ifindex, node mac address (copied from request),
   307	 *	   age of latest frame from node over slave 1, slave 2 [ms]
   308	 */
   309	static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
   310	{
   311		/* For receiving */
   312		struct nlattr *na;
   313		struct net_device *hsr_dev;
   314	
   315		/* For sending */
   316		struct sk_buff *skb_out;
   317		void *msg_head;
   318		struct hsr_priv *hsr;
   319		struct hsr_port *port;
   320		unsigned char hsr_node_addr_b[ETH_ALEN];
   321		int hsr_node_if1_age;
   322		u16 hsr_node_if1_seq;
   323		int hsr_node_if2_age;
   324		u16 hsr_node_if2_seq;
   325		int addr_b_ifindex;
   326		int res;
   327	
   328		if (!info)
   329			goto invalid;
   330	
   331		na = info->attrs[HSR_A_IFINDEX];
   332		if (!na)
   333			goto invalid;
   334		na = info->attrs[HSR_A_NODE_ADDR];
   335		if (!na)
   336			goto invalid;
   337	
   338		rcu_read_lock();
   339		hsr_dev = dev_get_by_index_rcu(genl_info_net(info),
   340					       nla_get_u32(info->attrs[HSR_A_IFINDEX]));
   341		if (!hsr_dev)
   342			goto rcu_unlock;
   343		if (!is_hsr_master(hsr_dev))
   344			goto rcu_unlock;
   345	
   346		/* Send reply */
   347		skb_out = genlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
   348		if (!skb_out) {
   349			res = -ENOMEM;
   350			goto fail;
   351		}
   352	
   353		msg_head = genlmsg_put(skb_out, NETLINK_CB(skb_in).portid,
   354				       info->snd_seq, &hsr_genl_family, 0,
   355				       HSR_C_SET_NODE_STATUS);
   356		if (!msg_head) {
   357			res = -ENOMEM;
   358			goto nla_put_failure;
   359		}
   360	
   361		res = nla_put_u32(skb_out, HSR_A_IFINDEX, hsr_dev->ifindex);
   362		if (res < 0)
   363			goto nla_put_failure;
   364	
   365		hsr = netdev_priv(hsr_dev);
   366		res = hsr_get_node_data(hsr,
   367					(unsigned char *)
   368					nla_data(info->attrs[HSR_A_NODE_ADDR]),
   369						 hsr_node_addr_b,
   370						 &addr_b_ifindex,
   371						 &hsr_node_if1_age,
   372						 &hsr_node_if1_seq,
   373						 &hsr_node_if2_age,
   374						 &hsr_node_if2_seq);
   375		if (res < 0)
   376			goto nla_put_failure;
   377	
   378		res = nla_put(skb_out, HSR_A_NODE_ADDR, ETH_ALEN,
   379			      nla_data(info->attrs[HSR_A_NODE_ADDR]));
   380		if (res < 0)
   381			goto nla_put_failure;
   382	
   383		if (addr_b_ifindex > -1) {
   384			res = nla_put(skb_out, HSR_A_NODE_ADDR_B, ETH_ALEN,
   385				      hsr_node_addr_b);
   386			if (res < 0)
   387				goto nla_put_failure;
   388	
   389			res = nla_put_u32(skb_out, HSR_A_ADDR_B_IFINDEX,
   390					  addr_b_ifindex);
   391			if (res < 0)
   392				goto nla_put_failure;
   393		}
   394	
   395		res = nla_put_u32(skb_out, HSR_A_IF1_AGE, hsr_node_if1_age);
   396		if (res < 0)
   397			goto nla_put_failure;
   398		res = nla_put_u16(skb_out, HSR_A_IF1_SEQ, hsr_node_if1_seq);
   399		if (res < 0)
   400			goto nla_put_failure;
   401		port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_A);
   402		if (port)
   403			res = nla_put_u32(skb_out, HSR_A_IF1_IFINDEX,
   404					  port->dev->ifindex);
   405		if (res < 0)
   406			goto nla_put_failure;
   407	
   408		res = nla_put_u32(skb_out, HSR_A_IF2_AGE, hsr_node_if2_age);
   409		if (res < 0)
   410			goto nla_put_failure;
   411		res = nla_put_u16(skb_out, HSR_A_IF2_SEQ, hsr_node_if2_seq);
   412		if (res < 0)
   413			goto nla_put_failure;
   414		port = hsr_port_get_hsr(hsr, HSR_PT_SLAVE_B);
   415		if (port)
   416			res = nla_put_u32(skb_out, HSR_A_IF2_IFINDEX,
   417					  port->dev->ifindex);
   418		if (res < 0)
   419			goto nla_put_failure;
   420	
   421		rcu_read_unlock();
   422	
   423		genlmsg_end(skb_out, msg_head);
   424		genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid);
   425	
   426		return 0;
   427	
   428	rcu_unlock:
   429		rcu_read_unlock();
   430	invalid:
   431		netlink_ack(skb_in, nlmsg_hdr(skb_in), -EINVAL, NULL);
   432		return 0;
   433	
   434	nla_put_failure:
   435		kfree_skb(skb_out);
 > 436		fallthrough;
   437	
   438	fail:
   439		rcu_read_unlock();
   440		return res;
   441	}
   442	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* Re: [PATCH net-next] virtio_net: sync RX buffer before reading the header
From: Michael S. Tsirkin @ 2026-03-26 22:03 UTC (permalink / raw)
  To: Simon Horman
  Cc: linux-kernel, Omar Elghoul, Srikanth Aithal, Jason Wang,
	Xuan Zhuo, Eugenio Pérez, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexei Starovoitov,
	Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
	Stanislav Fomichev, Vishwanath Seshagiri, netdev, virtualization,
	bpf
In-Reply-To: <20260326181736.GV111839@horms.kernel.org>

On Thu, Mar 26, 2026 at 06:17:36PM +0000, Simon Horman wrote:
> On Tue, Mar 24, 2026 at 11:15:54AM -0400, Michael S. Tsirkin wrote:
> > receive_buf() reads the virtio header through buf before
> > page_pool_dma_sync_for_cpu() runs in receive_small() or
> > receive_mergeable(). The header buffer is thus unsynchronized at the
> > point where flags and, for mergeable buffers, num_buffers are consumed.
> > 
> > Omar Elghoul reported that on s390x Secure Execution this showed up as
> > greatly reduced virtio-net performance together with "bad gso" and
> > "bad csum" messages in dmesg. This is because with SE sync actually
> > copies data, so the header is uninitialized.
> > 
> > Move the sync into receive_buf() so the
> > header is synchronized before any access through buf.
> > 
> > Tool use: Cursor with GPT-5.4 drafted the initial code move from prompt:
> > "in drivers/net/virtio_net.c, move page_pool_dma_sync_for_cpu on receive
> > path to before memory is accessed through buf".
> > The result and the commit log were reviewed and edited manually.
> > 
> > Fixes: 168b61da6871 ("virtio_net: add page_pool support for buffer allocation")
> 
> Hi Michael,
> 
> The hash for a patch with that subject in net-next appears to be 24fbd3967f3f.

Thanks, will fix in the next version.

> > Reported-by: Omar Elghoul <oelghoul@linux.ibm.com>
> > Tested-by: Srikanth Aithal <sraithal@amd.com>
> > Tested-by: Omar Elghoul <oelghoul@linux.ibm.com>
> > Link: https://lore.kernel.org/r/20260323150136.14452-1-oelghoul@linux.ibm.com
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> ...


^ permalink raw reply

* Re: [PATCH v4 net-next 5/5] net: pcs: pcs-mtk-lynxi: deprecate "mediatek,pnswap"
From: Vladimir Oltean @ 2026-03-26 21:54 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: netdev, devicetree, linux-kernel, linux-mediatek, Daniel Golle,
	Horatiu Vultur, Bj√∏rn Mork, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno,
	Eric Woudstra, Alexander Couzens, Chester A. Unal, DENG Qingfang,
	Sean Wang, Felix Fietkau
In-Reply-To: <e0ad52862d34cf4e0169c9850a7f164f127d0093@linux.dev>

Hi Frank,

On Tue, Mar 24, 2026 at 06:36:44AM +0000, Frank Wunderlich wrote:
> Hi,
> 
> looks like this patch breaks BPI-R3 serdes between mt7986 SoC and mt7531 switch in 7.0 (6.19 is ok).
> in ethtool i see only tx on mac but no rx. if i revert this patch i can ping through dsa-ports again.
> 
> i did not completely understanding the code with the default-pol as it is now splitted between rx and tx.
> 
> mt7986 and this board does not have mediatek,pnswap set, so the final  regmap_update_bits writes val=0,
> before there was only write to this register on invert mode...but i guess this should not break. Maybe some
> kind of timing issue between mac and switch?
> 
> maybe reverting this patch skips changes made here:
> bde1ae2d52ab 2026-01-19 net: pcs: pcs-mtk-lynxi: pass SGMIISYS OF node to PCS
> 
> I resend as last try was sending as html (option "always send as text" in webmailer seems to be ignored
> somehow, had to choose "unformatted" in this response too).
> 
> regards Frank

Sorry for the delay.

If writing val=0 breaks the link, I'm curious
(a) whether it still breaks if we don't write anything at all
(b) what was the register value originally

Could you please test the patch below and let me know what it prints,
and whether traffic passes with it applied?

-- >8 --
diff --git a/drivers/net/pcs/pcs-mtk-lynxi.c b/drivers/net/pcs/pcs-mtk-lynxi.c
index c12f8087af9b..5c5f45b93b82 100644
--- a/drivers/net/pcs/pcs-mtk-lynxi.c
+++ b/drivers/net/pcs/pcs-mtk-lynxi.c
@@ -126,7 +126,7 @@ static int mtk_pcs_config_polarity(struct mtk_pcs_lynxi *mpcs,
 {
 	struct fwnode_handle *fwnode = mpcs->fwnode, *pcs_fwnode;
 	unsigned int pol, default_pol = PHY_POL_NORMAL;
-	unsigned int val = 0;
+	unsigned int val = 0, tmp;
 	int ret;
 
 	if (fwnode_property_read_bool(fwnode, "mediatek,pnswap"))
@@ -153,8 +153,14 @@ static int mtk_pcs_config_polarity(struct mtk_pcs_lynxi *mpcs,
 	if (pol == PHY_POL_INVERT)
 		val |= SGMII_PN_SWAP_TX;
 
-	return regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_WRAP_CTRL,
-				  SGMII_PN_SWAP_RX | SGMII_PN_SWAP_TX, val);
+	ret = regmap_read(mpcs->regmap, SGMSYS_QPHY_WRAP_CTRL, &tmp);
+	if (ret)
+		return ret;
+
+	pr_err("SGMSYS_QPHY_WRAP_CTRL = 0x%x, intending to write 0x%lx\n",
+	       tmp, (tmp & ~(SGMII_PN_SWAP_RX | SGMII_PN_SWAP_TX)) | val);
+
+	return 0;
 }
 
 static int mtk_pcs_lynxi_config(struct phylink_pcs *pcs, unsigned int neg_mode,
-- >8 --

^ permalink raw reply related

* Re: [PATCH net-next v11 06/15] quic: add stream management
From: Xin Long @ 2026-03-26 21:48 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: network dev, quic, davem, Eric Dumazet, Paolo Abeni, Simon Horman,
	Stefan Metzmacher, Moritz Buhl, Tyler Fanelli, Pengtao He,
	Thomas Dreibholz, linux-cifs, Steve French, Namjae Jeon,
	Paulo Alcantara, Tom Talpey, kernel-tls-handshake, Chuck Lever,
	Jeff Layton, Steve Dickson, Hannes Reinecke, Alexander Aring,
	David Howells, Matthieu Baerts, John Ericson, Cong Wang,
	D . Wythe, Jason Baron, illiliti, Sabrina Dubroca,
	Marcelo Ricardo Leitner, Daniel Stenberg, Andy Gospodarek,
	Marc E . Fiuczynski
In-Reply-To: <20260326130740.74b4c92f@kernel.org>

On Thu, Mar 26, 2026 at 4:07 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 26 Mar 2026 11:06:26 -0400 Xin Long wrote:
> > The AI report on
> >
> >   https://netdev-ai.bots.linux.dev/ai-review.html?id=1624d906-c0b6-4e12-a63f-5cbfc51b660e#patch-5
> >
> > is false positive.
> >
> > As the sk_alloc() calls sk_prot_alloc() with __GFP_ZERO, and the streams->head
> > is always initialized to NULL.
>
> Can you also check the google one?
>
> https://sashiko.dev/#/patchset/4019cfba3ffd6f91aee24713d2adc778f858b4c4.1774410440.git.lucien.xin@gmail.com

Will do. There are quite a few reports, and it may take me some time
to review them all carefully.

BTW, what's the workflow for the Google AI feedback? should I reply to
each item in this thread like we did with Claude one, or is there a
different workflow?

Thanks.

^ permalink raw reply

* Re: [PATCH nf] netfilter: nf_conntrack_sip: fix use of uninitialized rtp_addr in process_sdp
From: Pablo Neira Ayuso @ 2026-03-26 21:39 UTC (permalink / raw)
  To: Florian Westphal
  Cc: Weiming Shi, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Phil Sutter, Simon Horman, netfilter-devel, coreteam,
	netdev, linux-kernel, Xiang Mei
In-Reply-To: <acWaoSUm9SrD8_pS@strlen.de>

On Thu, Mar 26, 2026 at 09:44:17PM +0100, Florian Westphal wrote:
> Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > @@ -1091,9 +1095,11 @@ static int process_sdp(struct sk_buff *skb, unsigned int protoff,
> > >  					  &matchoff, &matchlen, &maddr) > 0) {
> > >  			maddr_len = matchlen;
> > >  			memcpy(&rtp_addr, &maddr, sizeof(rtp_addr));
> > > -		} else if (caddr_len)
> > > +			have_rtp_addr = true;
> > > +		} else if (caddr_len) {
> > >  			memcpy(&rtp_addr, &caddr, sizeof(rtp_addr));
> > > -		else {
> > > +			have_rtp_addr = true;
> > 
> > After this update, this loop sets over rtp_addr, but this was already
> > set by ct_sip_parse_sdp_addr() a bit above.
> > 
> > This new chunk results in:
> > 
> >                 } else if (caddr_len) {
> >                        memcpy(&rtp_addr, &caddr, sizeof(rtp_addr));
> >                        have_rtp_addr = true;
> > 
> > which is not needed? Why does caddr need to be copied over and over
> > again to rtp_addr?
> 
> Code before update was:
>                 if (ct_sip_parse_sdp_addr(ct, *dptr, mediaoff, *datalen,
>                                           SDP_HDR_CONNECTION, SDP_HDR_MEDIA,
>                                           &matchoff, &matchlen, &maddr) > 0) {
>                         maddr_len = matchlen;
>                         memcpy(&rtp_addr, &maddr, sizeof(rtp_addr));
>                 } else if (caddr_len)
>                         memcpy(&rtp_addr, &caddr, sizeof(rtp_addr));
>                 else {
> 
> 
> so we re-set rtp_addr to the session description in case it was
> overwritten by earlier iteration of the loop.
> 
> 1. Extract session description (caddr_len set)
> 2. enter loop, parse media description (overwrite rtp_addr with media
>    address)
> 3. next loop fails ct_sip_parse_sdp_addr() call
>    Restore the original session address instead of using
>    the previous media description.
> 
> I think its correct this way.

Thanks for explaining, this is leaving things as they were before this
patch.

^ permalink raw reply

* Re: [PATCH net-next 1/2] devlink: unify devlink_shd_get_priv() into devlink_priv()
From: Jakub Kicinski @ 2026-03-26 21:38 UTC (permalink / raw)
  To: Przemek Kitszel
  Cc: Jiri Pirko, netdev, Tony Nguyen, intel-wired-lan,
	Aleksandr Loktionov, edumazet, horms, pabeni, davem,
	Michal Schmidt
In-Reply-To: <20260325063143.261806-2-przemyslaw.kitszel@intel.com>

On Wed, 25 Mar 2026 07:26:52 +0100 Przemek Kitszel wrote:
> Current API makes it possible to access shared devlink instance's priv
> data:
> 
> 	void *devlink_shd_get_priv(struct devlink *devlink);
> 
> but it is easy to forget (especially during rebase from "before shared
> devlinks" era) and call:
> 
> 	void *devlink_priv(struct devlink *devlink);
> 
> which even has the same signature, so it's hard to catch the error.

The implicit conversion may make things hard to reason about.
Are you sure you actually mean that it's "easy to forget" or
it's easier for OOT transition?

If we are worried about misuse we should instead add an accessor
for "individual" (better name welcome) instance and WARN_ON()
when devlink_priv() is used in the shared setup.

Or add a third argument to devlink_priv() which will pass the size 
of the LHS ptr, and warn on attempts to access priv of the wrong
size?

^ permalink raw reply

* Re: [PATCH net] netfilter: nf_flow_table_offload: fix heap overflow in flow_action_entry_next()
From: Pablo Neira Ayuso @ 2026-03-26 21:32 UTC (permalink / raw)
  To: Hyunwoo Kim
  Cc: fw, phil, davem, edumazet, kuba, pabeni, horms, netfilter-devel,
	coreteam, netdev
In-Reply-To: <aaxe-uH2Qr6qM4E9@v4bel>

On Sun, Mar 08, 2026 at 02:23:06AM +0900, Hyunwoo Kim wrote:
> flow_action_entry_next() increments num_entries and returns a pointer
> into the flow_action_entry array without any bounds checking.  The array
> is allocated with a fixed size of NF_FLOW_RULE_ACTION_MAX (16) entries,
> but certain combinations of IPv6 + SNAT + DNAT + double VLAN (QinQ)
> require 17 or more entries, causing a slab-out-of-bounds write in the
> kmalloc-4k slab.
> 
> The maximum possible entry count is:
>   tunnel(2) + eth(4) + VLAN(4) + IPv6_NAT(10) + redirect(1) = 21
> 
> Increase NF_FLOW_RULE_ACTION_MAX to 24 (with headroom) to cover the
> worst case.

For the record, proposed patch:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/20260326200935.729750-1-pablo@netfilter.org/

^ permalink raw reply

* Re: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
From: kernel test robot @ 2026-03-26 21:31 UTC (permalink / raw)
  To: luka.gejak, davem, edumazet, kuba, pabeni, netdev
  Cc: oe-kbuild-all, horms, fmaurer, liuhangbin, linux-kernel,
	Luka Gejak
In-Reply-To: <20260324144630.189094-3-luka.gejak@linux.dev>

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/luka-gejak-linux-dev/net-hsr-constify-hsr_ops-and-prp_ops-protocol-operation-structures/20260326-143638
base:   net-next/main
patch link:    https://lore.kernel.org/r/20260324144630.189094-3-luka.gejak%40linux.dev
patch subject: [PATCH net-next v1 2/7] net: hsr: replace fallthrough comments with fallthrough macro
config: parisc-randconfig-002-20260327 (https://download.01.org/0day-ci/archive/20260327/202603270549.2hiC5jsf-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260327/202603270549.2hiC5jsf-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603270549.2hiC5jsf-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/compiler_types.h:88,
                    from <command-line>:
   net/hsr/hsr_netlink.c: In function 'hsr_get_node_list':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
    # define fallthrough                    __attribute__((__fallthrough__))
                                            ^~~~~~~~~~~~~
   net/hsr/hsr_netlink.c:527:2: note: in expansion of macro 'fallthrough'
     fallthrough;
     ^~~~~~~~~~~
   net/hsr/hsr_netlink.c: In function 'hsr_get_node_status':
>> include/linux/compiler_attributes.h:214:41: error: invalid use of attribute 'fallthrough'
    # define fallthrough                    __attribute__((__fallthrough__))
                                            ^~~~~~~~~~~~~
   net/hsr/hsr_netlink.c:436:2: note: in expansion of macro 'fallthrough'
     fallthrough;
     ^~~~~~~~~~~


vim +/fallthrough +214 include/linux/compiler_attributes.h

294f69e662d157 Joe Perches   2019-10-05  201  
294f69e662d157 Joe Perches   2019-10-05  202  /*
294f69e662d157 Joe Perches   2019-10-05  203   * Add the pseudo keyword 'fallthrough' so case statement blocks
294f69e662d157 Joe Perches   2019-10-05  204   * must end with any of these keywords:
294f69e662d157 Joe Perches   2019-10-05  205   *   break;
294f69e662d157 Joe Perches   2019-10-05  206   *   fallthrough;
ca0760e7d79e2b Wei Ming Chen 2021-05-06  207   *   continue;
294f69e662d157 Joe Perches   2019-10-05  208   *   goto <label>;
294f69e662d157 Joe Perches   2019-10-05  209   *   return [expression];
294f69e662d157 Joe Perches   2019-10-05  210   *
294f69e662d157 Joe Perches   2019-10-05  211   *  gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
294f69e662d157 Joe Perches   2019-10-05  212   */
294f69e662d157 Joe Perches   2019-10-05  213  #if __has_attribute(__fallthrough__)
294f69e662d157 Joe Perches   2019-10-05 @214  # define fallthrough                    __attribute__((__fallthrough__))
294f69e662d157 Joe Perches   2019-10-05  215  #else
294f69e662d157 Joe Perches   2019-10-05  216  # define fallthrough                    do {} while (0)  /* fallthrough */
a3f8a30f3f0079 Miguel Ojeda  2018-08-30  217  #endif
a3f8a30f3f0079 Miguel Ojeda  2018-08-30  218  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* Re: [PATCH net] netfilter: ctnetlink: fix use-after-free of exp->master in single expectation GET
From: Pablo Neira Ayuso @ 2026-03-26 21:30 UTC (permalink / raw)
  To: Hyunwoo Kim
  Cc: fw, phil, davem, edumazet, kuba, pabeni, horms, netfilter-devel,
	coreteam, netdev
In-Reply-To: <aaxehlr7zbTj7dbe@v4bel>

On Sun, Mar 08, 2026 at 02:21:10AM +0900, Hyunwoo Kim wrote:
> ctnetlink_get_expect() in the non-dump path calls
> nf_ct_expect_find_get() which only takes a reference on the expectation
> itself, not on exp->master.  It then calls ctnetlink_exp_fill_info()
> which dereferences exp->master extensively (tuplehash, ct->ext via
> nfct_help()).
> 
> A concurrent conntrack deletion through NFNL_SUBSYS_CTNETLINK (a
> different nfnetlink subsystem mutex than NFNL_SUBSYS_CTNETLINK_EXP) can
> free the master conntrack while the single GET is in progress, leading
> to use-after-free.  In particular, kfree(ct->ext) is immediate and not
> RCU-deferred.
> 
> Fix this by taking a reference on exp->master under rcu_read_lock
> (required for SLAB_TYPESAFE_BY_RCU) before calling
> ctnetlink_exp_fill_info() and releasing it afterwards.

For the record, this was fixed by expanding the nf_conntrack_lock
section in ctnetlink_get_expect(). The observation is that
nf_ct_remove_expectations() holds the nf_conntrack_expect_lock while
called from the ct object release path, so the ct->ext area does not
go away until the nf_conntrack_expect_lock is released.

I'm archiving this patch.

^ permalink raw reply

* Re: [PATCH v24 08/11] cxl: Export function for unwinding cxl by accelerators
From: Cheatham, Benjamin @ 2026-03-26 21:28 UTC (permalink / raw)
  To: Alejandro Lucero Palau, Jonathan Cameron, alejandro.lucero-palau
  Cc: linux-cxl, netdev, dave.jiang, dan.j.williams, edward.cree, davem,
	kuba, pabeni, edumazet, Gregory Price
In-Reply-To: <0d21a506-e158-4b80-8264-064ff891dde1@amd.com>

On 3/24/2026 4:36 PM, Alejandro Lucero Palau wrote:
> 
> On 3/24/26 16:50, Jonathan Cameron wrote:
>> On Mon, 23 Mar 2026 11:31:14 +0000
>> alejandro.lucero-palau@amd.com wrote:
>>
>>> From: Alejandro Lucero <alucerop@amd.com>
>>>
>>> Add cxl_unregister_region() to the accelerator driver API
>>> for a clean exit.
>>>
>>> Signed-off-by: Alejandro Lucero <alucerop@amd.com>
>>> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
>> For this I'm seeing an outstanding question from Gregory on v23.
> 
> 
> Yes, I did not forget about it but I forgot to comment back.
> 
> 
> The kreview is obviously wrong but I think it points out to the missing invocation I need to add. I did not suffer those problems Gregory mentions, but I think that is due to how I configure my testing kernel. So, yes, I need to remove the release action from inside this function to avoid invoking ... this same function. That is another thing that puzzled me when I saw that review, and it implies I need to have different functions for accelerator driver specific invocation and for normal release action call. Or maybe just an extra param only removing the devm release action if invoked by accelerators. I think I will go with this last one. Any suggestion?
> 

May be a dumb question, but what happens if you don't export this function and just rely on the devm action registered during creation in the core?
An extra parameter seems icky to me, but the alternative would be to push registering the release action to the endpoint driver (cxl_pci, sfc, etc.) which
is pretty rough as well.

I may just be missing something here, I haven't thought about this too much. I was going to look at the rest of the set tomorrow, I'll see if I can think
of something then.

Thanks,
Ben
> 
> Thank you

^ permalink raw reply

* [net-next,PATCH v5 2/3] dt-bindings: net: realtek,rtl82xx: Document realtek,*-ssc-enable property
From: Marek Vasut @ 2026-03-26 21:06 UTC (permalink / raw)
  To: netdev
  Cc: Marek Vasut, Krzysztof Kozlowski, David S. Miller,
	Aleksander Jan Bajkowski, Andrew Lunn, Conor Dooley, Eric Dumazet,
	Florian Fainelli, Heiner Kallweit, Ivan Galkin, Jakub Kicinski,
	Krzysztof Kozlowski, Michael Klein, Paolo Abeni, Rob Herring,
	Russell King, Vladimir Oltean, devicetree
In-Reply-To: <20260326210704.58912-1-marek.vasut@mailbox.org>

Document support for spread spectrum clocking (SSC) on RTL8211F(D)(I)-CG,
RTL8211FS(I)(-VS)-CG, RTL8211FG(I)(-VS)-CG PHYs. Introduce DT properties
'realtek,clkout-ssc-enable', 'realtek,rxc-ssc-enable' and
'realtek,sysclk-ssc-enable' which control CLKOUT, RXC and SYSCLK
SSC spread spectrum clocking enablement on these signals. These
clock are not exposed via the clock API, therefore assigned-clock-sscs
property does not apply.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Aleksander Jan Bajkowski <olek2@wp.pl>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Ivan Galkin <ivan.galkin@axis.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Michael Klein <michael@fossekall.de>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: devicetree@vger.kernel.org
Cc: netdev@vger.kernel.org
---
V2: Split SSC clock control for each CLKOUT, RXC, SYSCLK signal
V3: - Add RB from krzk
    - Update commit subject, use realtek,*-ssc-enable to be accurate
V4: No change
V5: No change
---
 .../devicetree/bindings/net/realtek,rtl82xx.yaml  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
index eafcc2f3e3d66..45033c31a2d51 100644
--- a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
+++ b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
@@ -50,6 +50,21 @@ properties:
     description:
       Disable CLKOUT clock, CLKOUT clock default is enabled after hardware reset.
 
+  realtek,clkout-ssc-enable:
+    type: boolean
+    description:
+      Enable CLKOUT SSC mode, CLKOUT SSC mode default is disabled after hardware reset.
+
+  realtek,rxc-ssc-enable:
+    type: boolean
+    description:
+      Enable RXC SSC mode, RXC SSC mode default is disabled after hardware reset.
+
+  realtek,sysclk-ssc-enable:
+    type: boolean
+    description:
+      Enable SYSCLK SSC mode, SYSCLK SSC mode default is disabled after hardware reset.
+
   wakeup-source:
     type: boolean
     description:
-- 
2.53.0


^ permalink raw reply related

* [net-next,PATCH v5 3/3] net: phy: realtek: Add property to enable SSC
From: Marek Vasut @ 2026-03-26 21:06 UTC (permalink / raw)
  To: netdev
  Cc: Marek Vasut, David S. Miller, Aleksander Jan Bajkowski,
	Andrew Lunn, Conor Dooley, Eric Dumazet, Florian Fainelli,
	Heiner Kallweit, Ivan Galkin, Jakub Kicinski, Krzysztof Kozlowski,
	Michael Klein, Paolo Abeni, Rob Herring, Russell King,
	Vladimir Oltean, devicetree
In-Reply-To: <20260326210704.58912-1-marek.vasut@mailbox.org>

Add support for spread spectrum clocking (SSC) on RTL8211F(D)(I)-CG,
RTL8211FS(I)(-VS)-CG, RTL8211FG(I)(-VS)-CG PHYs. The implementation
follows EMI improvement application note Rev. 1.2 for these PHYs.

The current implementation enables SSC for both RXC and SYSCLK clock
signals. Introduce DT properties 'realtek,clkout-ssc-enable',
'realtek,rxc-ssc-enable' and 'realtek,sysclk-ssc-enable' which control
CLKOUT, RXC and SYSCLK SSC spread spectrum clocking enablement on these
signals.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Aleksander Jan Bajkowski <olek2@wp.pl>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Ivan Galkin <ivan.galkin@axis.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Michael Klein <michael@fossekall.de>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: devicetree@vger.kernel.org
Cc: netdev@vger.kernel.org
---
V2: Split SSC clock control for each CLKOUT, RXC, SYSCLK signal
V3: Update RTL8211FVD PHYCR2 comment to state this PHY has PHYCR2 register,
    but SSC configuration is not supported due to different layout.
V4: - Perform all SSC configuration before disabling CLKOUT
    - Perform all SSC configuration in the same order as in the SSC appnote
    - Rebase on current next, retest using spectrum analyzer again
V5: s@SCC@SSC@ typo
---
 drivers/net/phy/realtek/realtek_main.c | 131 +++++++++++++++++++++++++
 1 file changed, 131 insertions(+)

diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c
index 023e47ad605bd..0b5d35841fdd4 100644
--- a/drivers/net/phy/realtek/realtek_main.c
+++ b/drivers/net/phy/realtek/realtek_main.c
@@ -75,10 +75,18 @@
 
 #define RTL8211F_PHYCR2				0x19
 #define RTL8211F_CLKOUT_EN			BIT(0)
+#define RTL8211F_SYSCLK_SSC_EN			BIT(3)
 #define RTL8211F_PHYCR2_PHY_EEE_ENABLE		BIT(5)
+#define RTL8211F_CLKOUT_SSC_EN			BIT(7)
 
 #define RTL8211F_INSR				0x1d
 
+/* RTL8211F SSC settings */
+#define RTL8211F_SSC_PAGE			0xc44
+#define RTL8211F_SSC_RXC			0x13
+#define RTL8211F_SSC_SYSCLK			0x17
+#define RTL8211F_SSC_CLKOUT			0x19
+
 /* RTL8211F LED configuration */
 #define RTL8211F_LEDCR_PAGE			0xd04
 #define RTL8211F_LEDCR				0x10
@@ -215,6 +223,9 @@ MODULE_LICENSE("GPL");
 struct rtl821x_priv {
 	bool enable_aldps;
 	bool disable_clk_out;
+	bool enable_clkout_ssc;
+	bool enable_rxc_ssc;
+	bool enable_sysclk_ssc;
 	struct clk *clk;
 	/* rtl8211f */
 	u16 iner;
@@ -278,6 +289,12 @@ static int rtl821x_probe(struct phy_device *phydev)
 						   "realtek,aldps-enable");
 	priv->disable_clk_out = of_property_read_bool(dev->of_node,
 						      "realtek,clkout-disable");
+	priv->enable_clkout_ssc = of_property_read_bool(dev->of_node,
+							"realtek,clkout-ssc-enable");
+	priv->enable_rxc_ssc = of_property_read_bool(dev->of_node,
+						     "realtek,rxc-ssc-enable");
+	priv->enable_sysclk_ssc = of_property_read_bool(dev->of_node,
+							"realtek,sysclk-ssc-enable");
 
 	phydev->priv = priv;
 
@@ -707,6 +724,108 @@ static int rtl8211f_config_phy_eee(struct phy_device *phydev)
 			  RTL8211F_PHYCR2_PHY_EEE_ENABLE, 0);
 }
 
+static int rtl8211f_config_clkout_ssc(struct phy_device *phydev)
+{
+	struct rtl821x_priv *priv = phydev->priv;
+	struct device *dev = &phydev->mdio.dev;
+	int ret;
+
+	/* The value is preserved if the device tree property is absent */
+	if (!priv->enable_clkout_ssc)
+		return 0;
+
+	/* RTL8211FVD has PHYCR2 register, but configuration of CLKOUT SSC
+	 * is not currently supported by this driver due to different bit
+	 * layout.
+	 */
+	if (phydev->drv->phy_id == RTL_8211FVD_PHYID)
+		return 0;
+
+	/* Unnamed registers from EMI improvement parameters application note 1.2 */
+	ret = phy_write_paged(phydev, 0xd09, 0x10, 0xcf00);
+	if (ret < 0) {
+		dev_err(dev, "CLKOUT SSC initialization failed: %pe\n", ERR_PTR(ret));
+		return ret;
+	}
+
+	ret = phy_write(phydev, RTL8211F_SSC_CLKOUT, 0x38c3);
+	if (ret < 0) {
+		dev_err(dev, "CLKOUT SSC configuration failed: %pe\n", ERR_PTR(ret));
+		return ret;
+	}
+
+	/*
+	 * Enable CLKOUT SSC using PHYCR2 bit 7 , this step is missing from the
+	 * EMI improvement parameters application note 1.2 section 2.3
+	 */
+	ret = phy_set_bits(phydev, RTL8211F_PHYCR2, RTL8211F_CLKOUT_SSC_EN);
+	if (ret < 0) {
+		dev_err(dev, "CLKOUT SSC enable failed: %pe\n", ERR_PTR(ret));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int rtl8211f_config_rxc_ssc(struct phy_device *phydev)
+{
+	struct rtl821x_priv *priv = phydev->priv;
+	struct device *dev = &phydev->mdio.dev;
+	int ret;
+
+	/* The value is preserved if the device tree property is absent */
+	if (!priv->enable_rxc_ssc)
+		return 0;
+
+	/* RTL8211FVD has PHYCR2 register, but configuration of RXC SSC
+	 * is not currently supported by this driver due to different bit
+	 * layout.
+	 */
+	if (phydev->drv->phy_id == RTL_8211FVD_PHYID)
+		return 0;
+
+	ret = phy_write_paged(phydev, RTL8211F_SSC_PAGE, RTL8211F_SSC_RXC, 0x5f00);
+	if (ret < 0) {
+		dev_err(dev, "RXC SSC configuration failed: %pe\n", ERR_PTR(ret));
+		return ret;
+	}
+
+	return 0;
+}
+
+static int rtl8211f_config_sysclk_ssc(struct phy_device *phydev)
+{
+	struct rtl821x_priv *priv = phydev->priv;
+	struct device *dev = &phydev->mdio.dev;
+	int ret;
+
+	/* The value is preserved if the device tree property is absent */
+	if (!priv->enable_sysclk_ssc)
+		return 0;
+
+	/* RTL8211FVD has PHYCR2 register, but configuration of SYSCLK SSC
+	 * is not currently supported by this driver due to different bit
+	 * layout.
+	 */
+	if (phydev->drv->phy_id == RTL_8211FVD_PHYID)
+		return 0;
+
+	ret = phy_write_paged(phydev, RTL8211F_SSC_PAGE, RTL8211F_SSC_SYSCLK, 0x4f00);
+	if (ret < 0) {
+		dev_err(dev, "SYSCLK SSC configuration failed: %pe\n", ERR_PTR(ret));
+		return ret;
+	}
+
+	/* Enable SSC */
+	ret = phy_set_bits(phydev, RTL8211F_PHYCR2, RTL8211F_SYSCLK_SSC_EN);
+	if (ret < 0) {
+		dev_err(dev, "SYSCLK SSC enable failed: %pe\n", ERR_PTR(ret));
+		return ret;
+	}
+
+	return 0;
+}
+
 static int rtl8211f_config_init(struct phy_device *phydev)
 {
 	struct device *dev = &phydev->mdio.dev;
@@ -723,6 +842,18 @@ static int rtl8211f_config_init(struct phy_device *phydev)
 	if (ret)
 		return ret;
 
+	ret = rtl8211f_config_rxc_ssc(phydev);
+	if (ret)
+		return ret;
+
+	ret = rtl8211f_config_sysclk_ssc(phydev);
+	if (ret)
+		return ret;
+
+	ret = rtl8211f_config_clkout_ssc(phydev);
+	if (ret)
+		return ret;
+
 	ret = rtl8211f_config_clk_out(phydev);
 	if (ret) {
 		dev_err(dev, "clkout configuration failed: %pe\n",
-- 
2.53.0


^ permalink raw reply related

* [net-next,PATCH v5 1/3] dt-bindings: net: realtek,rtl82xx: Keep property list sorted
From: Marek Vasut @ 2026-03-26 21:06 UTC (permalink / raw)
  To: netdev
  Cc: Marek Vasut, Rob Herring (Arm), David S. Miller,
	Aleksander Jan Bajkowski, Andrew Lunn, Conor Dooley, Eric Dumazet,
	Florian Fainelli, Heiner Kallweit, Ivan Galkin, Jakub Kicinski,
	Krzysztof Kozlowski, Michael Klein, Paolo Abeni, Russell King,
	Vladimir Oltean, devicetree

Sort the documented properties alphabetically, no functional change.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Aleksander Jan Bajkowski <olek2@wp.pl>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Ivan Galkin <ivan.galkin@axis.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Michael Klein <michael@fossekall.de>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: devicetree@vger.kernel.org
Cc: netdev@vger.kernel.org
---
V2: No change
V3: No change
V4: Add AB from Rob
V5: No change
---
 .../devicetree/bindings/net/realtek,rtl82xx.yaml          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
index 2b5697bd7c5df..eafcc2f3e3d66 100644
--- a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
+++ b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
@@ -40,15 +40,15 @@ properties:
 
   leds: true
 
-  realtek,clkout-disable:
+  realtek,aldps-enable:
     type: boolean
     description:
-      Disable CLKOUT clock, CLKOUT clock default is enabled after hardware reset.
+      Enable ALDPS mode, ALDPS mode default is disabled after hardware reset.
 
-  realtek,aldps-enable:
+  realtek,clkout-disable:
     type: boolean
     description:
-      Enable ALDPS mode, ALDPS mode default is disabled after hardware reset.
+      Disable CLKOUT clock, CLKOUT clock default is enabled after hardware reset.
 
   wakeup-source:
     type: boolean
-- 
2.53.0


^ permalink raw reply related

* Re: [PATCH v2] device property: Make modifications of fwnode "flags" thread safe
From: Danilo Krummrich @ 2026-03-26 21:03 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Greg Kroah-Hartman, Rafael J . Wysocki, stable, Andy Shevchenko,
	Mark Brown, Wolfram Sang, Andrew Lunn, Daniel Scally,
	David S. Miller, Eric Dumazet, Fabio Estevam, Frank Li,
	Heikki Krogerus, Heiner Kallweit, Jakub Kicinski, Len Brown,
	Paolo Abeni, Pengutronix Kernel Team, Rob Herring, Russell King,
	Sakari Ailus, Saravana Kannan, Sascha Hauer, devicetree,
	driver-core, imx, linux-acpi, linux-arm-kernel, linux-i2c,
	linux-kernel, linux-spi, netdev
In-Reply-To: <20260317090112.v2.1.I0a4d03104ecd5103df3d76f66c8d21b1d15a2e38@changeid>

On Tue Mar 17, 2026 at 5:01 PM CET, Douglas Anderson wrote:
> In various places in the kernel, we modify the fwnode "flags" member
> by doing either:
>   fwnode->flags |= SOME_FLAG;
>   fwnode->flags &= ~SOME_FLAG;
>
> This type of modification is not thread-safe. If two threads are both
> mucking with the flags at the same time then one can clobber the
> other.
>
> While flags are often modified while under the "fwnode_link_lock",
> this is not universally true.
>
> Create some accessor functions for setting, clearing, and testing the
> FWNODE flags and move all users to these accessor functions. New
> accessor functions use set_bit() and clear_bit(), which are
> thread-safe.
>
> Cc: stable@vger.kernel.org
> Fixes: c2c724c868c4 ("driver core: Add fw_devlink_parse_fwtree()")
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Mark Brown <broonie@kernel.org>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

    [ Fix fwnode_clear_flag() argument alignment, restore dropped blank
      line in fwnode_dev_initialized(), and remove unnecessary parentheses
      around fwnode_test_flag() calls. - Danilo ]

Applied to driver-core-testing, thanks!

^ permalink raw reply

* Re: [PATCH net] netfilter: ctnetlink: fix use-after-free of exp->master in expectation dump
From: Pablo Neira Ayuso @ 2026-03-26 21:00 UTC (permalink / raw)
  To: Hyunwoo Kim
  Cc: fw, phil, davem, edumazet, kuba, pabeni, horms, netfilter-devel,
	coreteam, netdev
In-Reply-To: <aaxeXUnPpqLUURrt@v4bel>

On Sun, Mar 08, 2026 at 02:20:29AM +0900, Hyunwoo Kim wrote:
> ctnetlink_exp_dump_table() iterates the expectation hash table under
> rcu_read_lock and dereferences exp->master to access the master
> conntrack's fields (ct_net, tuplehash, ct->ext).  However, expectations
> do not hold a reference on exp->master.  A concurrent conntrack deletion
> via NFNL_SUBSYS_CTNETLINK (a different nfnetlink subsystem mutex) can
> free the master conntrack while the dump is in progress, leading to
> use-after-free on ct->ext which is freed immediately by kfree().
>
> Fix this by taking a reference on exp->master with
> refcount_inc_not_zero() before accessing it.  If the master conntrack is
> already being destroyed, skip the expectation.

For the record, ctnetlink_exp_dump_expect() does not access ct->ext
anymore since f01794106042 ("netfilter: nf_conntrack_expect: use
expect->helper"). I am archiving this proposed patch.

Thanks for reporting.

^ permalink raw reply

* [PATCH net 3/3] net/mlx5: Add null check for flow namespace in mlx5_cmd_set_slave_root_fdb
From: Oskar Ray-Frayssinet @ 2026-03-26 20:58 UTC (permalink / raw)
  To: saeedm
  Cc: tariqt, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
	pabeni, netdev, linux-rdma, linux-kernel, Oskar Ray-Frayssinet
In-Reply-To: <20260326205824.11749-1-rayfraytech@gmail.com>

mlx5_get_flow_namespace() can return NULL if the namespace is not
available. Add a null check to prevent potential null pointer
dereference when accessing ns->node.

Signed-off-by: Oskar Ray-Frayssinet <rayfraytech@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
index c348ee62cd3a..c52d8ca6aa0b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
@@ -186,6 +186,8 @@ static int mlx5_cmd_set_slave_root_fdb(struct mlx5_core_dev *master,
 	} else {
 		ns = mlx5_get_flow_namespace(slave,
 					     MLX5_FLOW_NAMESPACE_FDB);
+		if (!ns)
+			return -EOPNOTSUPP;
 		root = find_root(&ns->node);
 		MLX5_SET(set_flow_table_root_in, in, table_id,
 			 root->root_ft->id);
-- 
2.43.0


^ permalink raw reply related

* [PATCH net 2/3] net/mlx5: Add null check for flow namespace in esw_set_slave_root_fdb
From: Oskar Ray-Frayssinet @ 2026-03-26 20:58 UTC (permalink / raw)
  To: saeedm
  Cc: tariqt, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
	pabeni, netdev, linux-rdma, linux-kernel, Oskar Ray-Frayssinet
In-Reply-To: <20260326205824.11749-1-rayfraytech@gmail.com>

mlx5_get_flow_namespace() can return NULL if the namespace is not
available. Add null checks to prevent potential null pointer
dereference when accessing ns->node in both master and slave branches.

Signed-off-by: Oskar Ray-Frayssinet <rayfraytech@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 7a9ee36b8dca..63aff6255c02 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2821,6 +2821,8 @@ static int esw_set_slave_root_fdb(struct mlx5_core_dev *master,
 	if (master) {
 		ns = mlx5_get_flow_namespace(master,
 					     MLX5_FLOW_NAMESPACE_FDB);
+		if (!ns)
+			return -EOPNOTSUPP;
 		root = find_root(&ns->node);
 		mutex_lock(&root->chain_lock);
 		MLX5_SET(set_flow_table_root_in, in,
@@ -2833,6 +2835,8 @@ static int esw_set_slave_root_fdb(struct mlx5_core_dev *master,
 	} else {
 		ns = mlx5_get_flow_namespace(slave,
 					     MLX5_FLOW_NAMESPACE_FDB);
+		if (!ns)
+			return -EOPNOTSUPP;
 		root = find_root(&ns->node);
 		mutex_lock(&root->chain_lock);
 		MLX5_SET(set_flow_table_root_in, in, table_id,
-- 
2.43.0


^ permalink raw reply related

* [PATCH net 1/3] net/mlx5e: Add null check for flow namespace in mlx5e_tc_nic_create_miss_table
From: Oskar Ray-Frayssinet @ 2026-03-26 20:58 UTC (permalink / raw)
  To: saeedm
  Cc: tariqt, mbloch, leon, andrew+netdev, davem, edumazet, kuba,
	pabeni, netdev, linux-rdma, linux-kernel, Oskar Ray-Frayssinet

mlx5_get_flow_namespace() can return NULL if the namespace is not
available. Add a null check to prevent potential null pointer
dereference when accessing ns->node.

Signed-off-by: Oskar Ray-Frayssinet <rayfraytech@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 1434b65d4746..503c9cc96a02 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -5216,6 +5216,10 @@ static int mlx5e_tc_nic_create_miss_table(struct mlx5e_priv *priv)
 	ft_attr.level = MLX5E_TC_MISS_LEVEL;
 	ft_attr.prio = 0;
 	ns = mlx5_get_flow_namespace(priv->mdev, MLX5_FLOW_NAMESPACE_KERNEL);
+	if (!ns) {
+		netdev_err(priv->netdev, "failed to get flow namespace\n");
+		return -EOPNOTSUPP;
+	}
 
 	*ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
 	if (IS_ERR(*ft)) {
-- 
2.43.0


^ permalink raw reply related

* Re: [PATCH net] net: psp: check for device unregister when creating assoc
From: Willem de Bruijn @ 2026-03-26 20:46 UTC (permalink / raw)
  To: Jakub Kicinski, Willem de Bruijn
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
	Yiming Qian, daniel.zahka
In-Reply-To: <20260326130459.7225ae28@kernel.org>

Jakub Kicinski wrote:
> On Tue, 24 Mar 2026 18:40:00 -0400 Willem de Bruijn wrote:
> > > @@ -320,6 +320,11 @@ int psp_assoc_device_get_locked(const struct genl_split_ops *ops,
> > >  	id = info->attrs[PSP_A_ASSOC_DEV_ID];
> > >  	if (psd) {
> > >  		mutex_lock(&psd->lock);
> > > +		if (!psp_dev_is_registered(psd)) {
> > > +			mutex_unlock(&psd->lock);
> > > +			err = -ENODEV;
> > > +			goto err_psd_put;
> > > +		}  
> > 
> > This ensures that psd is valid for this caller of psp_dev_get_for_sock
> > and psp_dev_tryget, which is its only one (for now).
> > 
> > But is it confusing that psd can be cleared out while a reference is
> > held? Is the assumption that psp_dev_unregister usually holds the last
> > reference and its psp_dev_put will complete the clean up by calling
> > psp_dev_free. If so, would it make sense to defer everything
> > to psp_dev_free?
> > 
> > This is a simpler changes and fixes the issue for the only caller, so
> > LGTM. Just curious.
> 
> Meaning we should add a dance around removal like netdev does?
> Sleep until all the references are gone?
> Subjectively I think it's ugly, and in netdev it didn't really
> prevent races. Dunno, definitely subjective.

Yeah, if any caller of psp_dev_unregister has to know that the device
is gone to proceed, it would require something like that. Okay, I see
that that is needlessly messy.

^ permalink raw reply

* [PATCH net-next 2/4] net: phy: mediatek: add phy driver for MT7628 built-in Fast Ethernet PHYs
From: Joris Vaisvila @ 2026-03-26 20:44 UTC (permalink / raw)
  To: netdev
  Cc: horms, pabeni, kuba, edumazet, davem, olteanv, Andrew Lunn,
	devicetree, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Joris Vaisvila
In-Reply-To: <20260326204413.3317584-1-joey@tinyisr.com>

The Fast Ethernet PHYs present in the MT7628 SoCs require an
undocumented bit to be set before they can establish 100mbps links.

This commit adds the Kconfig option MEDIATEK_FE_SOC_PHY and the
corresponding driver mtk-fe-soc.c.

Signed-off-by: Joris Vaisvila <joey@tinyisr.com>
---
 drivers/net/phy/mediatek/Kconfig      | 10 +++++-
 drivers/net/phy/mediatek/Makefile     |  1 +
 drivers/net/phy/mediatek/mtk-fe-soc.c | 50 +++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/mediatek/mtk-fe-soc.c

diff --git a/drivers/net/phy/mediatek/Kconfig b/drivers/net/phy/mediatek/Kconfig
index bb7dc876271e..b6a51f38c358 100644
--- a/drivers/net/phy/mediatek/Kconfig
+++ b/drivers/net/phy/mediatek/Kconfig
@@ -21,8 +21,16 @@ config MEDIATEK_GE_PHY
 	  common operations with MediaTek SoC built-in Gigabit
 	  Ethernet PHYs.
 
+config MEDIATEK_FE_SOC_PHY
+	tristate "MediaTek SoC Fast Ethernet PHYs"
+	help
+	  Support for MediaTek MT7628 built-in Fast Ethernet PHYs.
+	  This driver only sets an initialization bit required for the PHY
+	  to establish 100 Mbps links. All other PHY operations are handled
+	  by the kernel's generic PHY code.
+
 config MEDIATEK_GE_SOC_PHY
-	tristate "MediaTek SoC Ethernet PHYs"
+	tristate "MediaTek SoC Gigabit Ethernet PHYs"
 	depends on ARM64 || COMPILE_TEST
 	depends on ARCH_AIROHA || (ARCH_MEDIATEK && NVMEM_MTK_EFUSE) || \
 		   COMPILE_TEST
diff --git a/drivers/net/phy/mediatek/Makefile b/drivers/net/phy/mediatek/Makefile
index ac57ecc799fc..6f9cacf7f906 100644
--- a/drivers/net/phy/mediatek/Makefile
+++ b/drivers/net/phy/mediatek/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_MEDIATEK_2P5GE_PHY)	+= mtk-2p5ge.o
+obj-$(CONFIG_MEDIATEK_FE_SOC_PHY)	+= mtk-fe-soc.o
 obj-$(CONFIG_MEDIATEK_GE_PHY)		+= mtk-ge.o
 obj-$(CONFIG_MEDIATEK_GE_SOC_PHY)	+= mtk-ge-soc.o
 obj-$(CONFIG_MTK_NET_PHYLIB)		+= mtk-phy-lib.o
diff --git a/drivers/net/phy/mediatek/mtk-fe-soc.c b/drivers/net/phy/mediatek/mtk-fe-soc.c
new file mode 100644
index 000000000000..317944411fbe
--- /dev/null
+++ b/drivers/net/phy/mediatek/mtk-fe-soc.c
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Driver for MT7628 Embedded Switch internal Fast Ethernet PHYs
+ */
+#include <linux/module.h>
+#include <linux/phy.h>
+
+#define MTK_FPHY_ID_MT7628	0x03a29410
+#define MTK_EXT_PAGE_ACCESS	0x1f
+
+static int mt7628_phy_read_page(struct phy_device *phydev)
+{
+	return __phy_read(phydev, MTK_EXT_PAGE_ACCESS);
+}
+
+static int mt7628_phy_write_page(struct phy_device *phydev, int page)
+{
+	return __phy_write(phydev, MTK_EXT_PAGE_ACCESS, page);
+}
+
+static int mt7628_phy_config_init(struct phy_device *phydev)
+{
+	/*
+	 * This undocumented bit is required for the PHYs to be able to
+	 * establish 100mbps links.
+	 */
+	return phy_write_paged(phydev, 0x8000, 30, BIT(13));
+}
+
+static struct phy_driver mtk_soc_fe_phy_driver[] = {
+	{
+		PHY_ID_MATCH_EXACT(MTK_FPHY_ID_MT7628),
+		.name = "MediaTek MT7628 PHY",
+		.config_init = mt7628_phy_config_init,
+		.read_page = mt7628_phy_read_page,
+		.write_page = mt7628_phy_write_page,
+	},
+};
+
+module_phy_driver(mtk_soc_fe_phy_driver);
+static const struct mdio_device_id __maybe_unused mtk_soc_fe_phy_tbl[] = {
+	{ PHY_ID_MATCH_EXACT(MTK_FPHY_ID_MT7628) },
+	{ }
+};
+
+MODULE_DESCRIPTION("MediaTek SoC Fast Ethernet PHY driver");
+MODULE_AUTHOR("Joris Vaisvila <joey@tinyisr.com>");
+MODULE_LICENSE("GPL");
+
+MODULE_DEVICE_TABLE(mdio, mtk_soc_fe_phy_tbl);
-- 
2.53.0


^ permalink raw reply related

* [PATCH net-next 1/4] dt-bindings: net: dsa: add MT7628 ESW
From: Joris Vaisvila @ 2026-03-26 20:44 UTC (permalink / raw)
  To: netdev
  Cc: horms, pabeni, kuba, edumazet, davem, olteanv, Andrew Lunn,
	devicetree, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Joris Vaisvila
In-Reply-To: <20260326204413.3317584-1-joey@tinyisr.com>

Add bindings for MT7628 SoC's Embedded Switch.

Signed-off-by: Joris Vaisvila <joey@tinyisr.com>
---
 .../bindings/net/dsa/mediatek,mt7628-esw.yaml | 101 ++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/mediatek,mt7628-esw.yaml

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7628-esw.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7628-esw.yaml
new file mode 100644
index 000000000000..d3c9df30ed5a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7628-esw.yaml
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/mediatek,mt7628-esw.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Mediatek MT7628 Embedded Ethernet Switch
+
+maintainers:
+  - Joris Vaisvila <joey@tinyisr.com>
+
+description:
+  The MT7628 SoC's built-in Ethernet Switch is a five port switch with
+  integrated 10/100 PHYs. The switch registers are directly mapped in the SoC's
+  memory. The switch has an internally connected 1G CPU port and 5 user ports
+  connected to the built-in Fast Ethernet PHYs.
+
+unevaluatedProperties: false
+
+allOf:
+  - $ref: dsa.yaml#/$defs/ethernet-ports
+
+properties:
+  compatible:
+    const: mediatek,mt7628-esw
+
+  reg:
+    maxItems: 1
+    description: MMIO address of the switch
+
+  resets:
+    items:
+      - description: Phandle of system reset controller with ESW reset index
+      - description: Phandle of system reset controller with EPHY reset index
+
+  reset-names:
+    items:
+      - const: esw
+      - const: ephy
+
+  mdio:
+    $ref: /schemas/net/mdio.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - resets
+  - reset-names
+
+examples:
+  - |
+    switch0: switch@10110000 {
+        reg = <0x10110000 0x8000>;
+
+        resets = <&sysc 23>, <&sysc 24>;
+        reset-names = "esw", "ephy";
+
+        compatible = "mediatek,mt7628-esw";
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@0 {
+                reg = <0>;
+                phy-mode = "internal";
+            };
+
+            port@1 {
+                reg = <1>;
+                phy-mode = "internal";
+            };
+
+            port@2 {
+                reg = <2>;
+                phy-mode = "internal";
+            };
+
+            port@3 {
+                reg = <3>;
+                phy-mode = "internal";
+            };
+
+            port@4 {
+                reg = <4>;
+                phy-mode = "internal";
+            };
+
+            port@6 {
+                reg = <6>;
+                ethernet = <&ethernet>;
+                phy-mode = "rgmii";
+
+                fixed-link {
+                    speed = <1000>;
+                    full-duplex;
+                };
+            };
+        };
+    };
-- 
2.53.0


^ permalink raw reply related

* [PATCH net-next 0/4] net: dsa: mt7628 embedded switch initial support
From: Joris Vaisvila @ 2026-03-26 20:44 UTC (permalink / raw)
  To: netdev
  Cc: horms, pabeni, kuba, edumazet, davem, olteanv, Andrew Lunn,
	devicetree, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Joris Vaisvila

Hello,

This patch series adds initial support for the MediaTek MT7628 Embedded
Switch.

The driver implements the basic functionality required to operate the
switch using DSA. The hardware provides five internal Fast Ethernet user
ports and one Gigabit port connected internally to the CPU MAC.

Bridge offloading is not yet supported.

Tested on an MT7628NN-based board.

Changes since RFC v3:
	- remove labels from DT binding
	- set ds->user_mii_bus if mdio node does not exist
Link: https://lore.kernel.org/netdev/20260321194340.2140783-1-joey@tinyisr.com

Thanks,
Joris


Joris Vaisvila (4):
  dt-bindings: net: dsa: add MT7628 ESW
  net: phy: mediatek: add phy driver for MT7628 built-in Fast Ethernet
    PHYs
  net: dsa: initial MT7628 tagging driver
  net: dsa: initial support for MT7628 embedded switch

 .../bindings/net/dsa/mediatek,mt7628-esw.yaml | 101 +++
 drivers/net/dsa/Kconfig                       |   7 +
 drivers/net/dsa/Makefile                      |   1 +
 drivers/net/dsa/mt7628.c                      | 637 ++++++++++++++++++
 drivers/net/phy/mediatek/Kconfig              |  10 +-
 drivers/net/phy/mediatek/Makefile             |   1 +
 drivers/net/phy/mediatek/mtk-fe-soc.c         |  50 ++
 include/net/dsa.h                             |   2 +
 net/dsa/Kconfig                               |   6 +
 net/dsa/Makefile                              |   1 +
 net/dsa/tag_mt7628.c                          |  92 +++
 11 files changed, 907 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/mediatek,mt7628-esw.yaml
 create mode 100644 drivers/net/dsa/mt7628.c
 create mode 100644 drivers/net/phy/mediatek/mtk-fe-soc.c
 create mode 100644 net/dsa/tag_mt7628.c

-- 
2.53.0


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox