Re: remove unused definition in if_vxlan.c

2022-04-02 Thread Theo de Raadt
Not now.

The ABI/API is locked for the upcoming release.

Denis Fondras  wrote:

> VXLANMTU appears nowhere else in the codebase.
> 
> OK to remove it ?
> 
> 
> Index: if_vxlan.c
> ===
> RCS file: /cvs/src/sys/net/if_vxlan.c,v
> retrieving revision 1.90
> diff -u -p -r1.90 if_vxlan.c
> --- if_vxlan.c26 Feb 2022 04:46:34 -  1.90
> +++ if_vxlan.c2 Apr 2022 15:17:49 -
> @@ -67,8 +67,6 @@
>  /*
>   * The protocol.
>   */
> -
> -#define VXLANMTU 1492
>  #define VXLAN_PORT   4789
>  
>  struct vxlan_header {
> 



remove unused definition in if_vxlan.c

2022-04-02 Thread Denis Fondras
VXLANMTU appears nowhere else in the codebase.

OK to remove it ?


Index: if_vxlan.c
===
RCS file: /cvs/src/sys/net/if_vxlan.c,v
retrieving revision 1.90
diff -u -p -r1.90 if_vxlan.c
--- if_vxlan.c  26 Feb 2022 04:46:34 -  1.90
+++ if_vxlan.c  2 Apr 2022 15:17:49 -
@@ -67,8 +67,6 @@
 /*
  * The protocol.
  */
-
-#define VXLANMTU   1492
 #define VXLAN_PORT 4789
 
 struct vxlan_header {



Re: ure(4): add support for RTL8156B

2022-04-02 Thread Kevin Lo
On Sat, Apr 02, 2022 at 04:04:24PM +0100, Stuart Henderson wrote:
> On 2022/04/02 15:47, Stuart Henderson wrote:
> > It doesn't, but this fixes it:
> > 
> > Index: if_ure.c
> > ===
> > RCS file: /cvs/src/sys/dev/usb/if_ure.c,v
> > retrieving revision 1.29
> > diff -u -p -r1.29 if_ure.c
> > --- if_ure.c2 Apr 2022 12:22:56 -   1.29
> > +++ if_ure.c2 Apr 2022 14:46:50 -
> > @@ -2142,7 +2142,7 @@ ure_encap_txpkt(struct mbuf *m, char *bu
> >  
> >  #if NVLAN > 0
> > if (m->m_flags & M_VLANTAG)
> > -   cflags |= swap16(m->m_pkthdr.ether_vtag | URE_TXPKT_VLAN_TAG);
> > +   cflags |= URE_TXPKT_VLAN_TAG | swap16(m->m_pkthdr.ether_vtag);
> >  #endif
> >  
> > txhdr.ure_pktlen = htole32(m->m_pkthdr.len | URE_TXPKT_TX_FS |
> > 
> 
> And here's equivalent code in Realtek's Linux driver:
> 
>  2059 static inline void rtl_tx_vlan_tag(struct tx_desc *desc, struct sk_buff 
> *skb)
>  2060 {
>  2061 if (skb_vlan_tag_present(skb)) {
>  2062 u32 opts2;
>  2063 
>  2064 opts2 = TX_VLAN_TAG | swab16(skb_vlan_tag_get(skb));
>  2065 desc->opts2 |= cpu_to_le32(opts2);
>  2066 }
>  2067 } 

Good catch! Thanks.  I shouldn't work on vacation.



Re: ure(4): add support for RTL8156B

2022-04-02 Thread Mark Kettenis
> Date: Sat, 2 Apr 2022 15:47:17 +0100
> From: Stuart Henderson 
> 
> On 2022/04/02 18:14, Kevin Lo wrote:
> > On Fri, Apr 01, 2022 at 06:09:26PM +0100, Stuart Henderson wrote:
> > > 
> > > On 2022/04/01 17:13, Stuart Henderson wrote:
> > > > On 2022/04/01 10:26, Gerhard Roth wrote:
> > > > > On 4/1/22 07:41, Kevin Lo wrote:
> > > > > > 
> > > > > > ure0: RTL8153 (0x5c10), address 00:e0:4c:xx:xx:xx
> > > > > > rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > > > 
> > > > > > ure0: RTL8153B (0x6010), address f4:28:53:xx:xx:xx
> > > > > > rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > > > 
> > > > > > ure0 at uhub0 port 4 configuration 1 interface 0 "Planex USB 
> > > > > > 10/100/1G/2.5G LAN" rev 2.10/30.00 addr 5
> > > > > > ure0: RTL8156 (0x7030), address 1c:c0:35:xx:xx:xx
> > > > > > 
> > > > > 
> > > > > 
> > > > > You can add another one to the list that works just fine with your
> > > > > patch:
> > > > > 
> > > > > ure0 at uhub1 port 1 configuration 1 interface 0 "Realtek USB 
> > > > > 10/100/1000 LAN" rev 3.00/30.00 addr 2
> > > > > ure0: RTL8153 (0x5c30), address 00:13:3b:xx:xx:xx
> > > > > rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > 
> > > > No new issues seen on RTL8153B:
> > > > 
> > > > ure0 at uhub0 port 15 configuration 1 interface 0 "Realtek USB 
> > > > 10/100/1000 LAN" rev 3.00/31.00 addr 10
> > > > ure0: RTL8153B (0x6010), address 00:e0:4c:38:2b:0f
> > > > rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > 
> > > > I have also tested with vlan and discovered an existing issue,
> > > > it seems that vlan transmission is not working correctly: no tag
> > > > is sent on the outgoing packet. Reception appears to be ok.
> > > > This occurs with the previous code too so it is not a regression.
> > > > 
> > > 
> > > Tx works ok if I disable hw tagging.
> > 
> > Thanks for the findings.  Does it help if you replace the line [1] with
> > "reg |= URE_CPCR_RX_VLAN | 0x80;" ?
> > 
> > [1] https://github.com/openbsd/src/blob/master/sys/dev/usb/if_ure.c#L724
> > 
> 
> It doesn't, but this fixes it:

That fix looks correct to me given how the various byte swaps are done
in this driver.

> Index: if_ure.c
> ===
> RCS file: /cvs/src/sys/dev/usb/if_ure.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 if_ure.c
> --- if_ure.c  2 Apr 2022 12:22:56 -   1.29
> +++ if_ure.c  2 Apr 2022 14:46:50 -
> @@ -2142,7 +2142,7 @@ ure_encap_txpkt(struct mbuf *m, char *bu
>  
>  #if NVLAN > 0
>   if (m->m_flags & M_VLANTAG)
> - cflags |= swap16(m->m_pkthdr.ether_vtag | URE_TXPKT_VLAN_TAG);
> + cflags |= URE_TXPKT_VLAN_TAG | swap16(m->m_pkthdr.ether_vtag);
>  #endif
>  
>   txhdr.ure_pktlen = htole32(m->m_pkthdr.len | URE_TXPKT_TX_FS |
> 
> 



Re: ure(4): add support for RTL8156B

2022-04-02 Thread Stuart Henderson
On 2022/04/02 15:47, Stuart Henderson wrote:
> It doesn't, but this fixes it:
> 
> Index: if_ure.c
> ===
> RCS file: /cvs/src/sys/dev/usb/if_ure.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 if_ure.c
> --- if_ure.c  2 Apr 2022 12:22:56 -   1.29
> +++ if_ure.c  2 Apr 2022 14:46:50 -
> @@ -2142,7 +2142,7 @@ ure_encap_txpkt(struct mbuf *m, char *bu
>  
>  #if NVLAN > 0
>   if (m->m_flags & M_VLANTAG)
> - cflags |= swap16(m->m_pkthdr.ether_vtag | URE_TXPKT_VLAN_TAG);
> + cflags |= URE_TXPKT_VLAN_TAG | swap16(m->m_pkthdr.ether_vtag);
>  #endif
>  
>   txhdr.ure_pktlen = htole32(m->m_pkthdr.len | URE_TXPKT_TX_FS |
> 

And here's equivalent code in Realtek's Linux driver:

 2059 static inline void rtl_tx_vlan_tag(struct tx_desc *desc, struct sk_buff 
*skb)
 2060 {
 2061 if (skb_vlan_tag_present(skb)) {
 2062 u32 opts2;
 2063 
 2064 opts2 = TX_VLAN_TAG | swab16(skb_vlan_tag_get(skb));
 2065 desc->opts2 |= cpu_to_le32(opts2);
 2066 }
 2067 } 



Re: ure(4): add support for RTL8156B

2022-04-02 Thread Stuart Henderson
On 2022/04/02 18:14, Kevin Lo wrote:
> On Fri, Apr 01, 2022 at 06:09:26PM +0100, Stuart Henderson wrote:
> > 
> > On 2022/04/01 17:13, Stuart Henderson wrote:
> > > On 2022/04/01 10:26, Gerhard Roth wrote:
> > > > On 4/1/22 07:41, Kevin Lo wrote:
> > > > > 
> > > > > ure0: RTL8153 (0x5c10), address 00:e0:4c:xx:xx:xx
> > > > > rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > > 
> > > > > ure0: RTL8153B (0x6010), address f4:28:53:xx:xx:xx
> > > > > rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > > 
> > > > > ure0 at uhub0 port 4 configuration 1 interface 0 "Planex USB 
> > > > > 10/100/1G/2.5G LAN" rev 2.10/30.00 addr 5
> > > > > ure0: RTL8156 (0x7030), address 1c:c0:35:xx:xx:xx
> > > > > 
> > > > 
> > > > 
> > > > You can add another one to the list that works just fine with your
> > > > patch:
> > > > 
> > > > ure0 at uhub1 port 1 configuration 1 interface 0 "Realtek USB 
> > > > 10/100/1000 LAN" rev 3.00/30.00 addr 2
> > > > ure0: RTL8153 (0x5c30), address 00:13:3b:xx:xx:xx
> > > > rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > 
> > > No new issues seen on RTL8153B:
> > > 
> > > ure0 at uhub0 port 15 configuration 1 interface 0 "Realtek USB 
> > > 10/100/1000 LAN" rev 3.00/31.00 addr 10
> > > ure0: RTL8153B (0x6010), address 00:e0:4c:38:2b:0f
> > > rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > 
> > > I have also tested with vlan and discovered an existing issue,
> > > it seems that vlan transmission is not working correctly: no tag
> > > is sent on the outgoing packet. Reception appears to be ok.
> > > This occurs with the previous code too so it is not a regression.
> > > 
> > 
> > Tx works ok if I disable hw tagging.
> 
> Thanks for the findings.  Does it help if you replace the line [1] with
> "reg |= URE_CPCR_RX_VLAN | 0x80;" ?
> 
> [1] https://github.com/openbsd/src/blob/master/sys/dev/usb/if_ure.c#L724
> 

It doesn't, but this fixes it:

Index: if_ure.c
===
RCS file: /cvs/src/sys/dev/usb/if_ure.c,v
retrieving revision 1.29
diff -u -p -r1.29 if_ure.c
--- if_ure.c2 Apr 2022 12:22:56 -   1.29
+++ if_ure.c2 Apr 2022 14:46:50 -
@@ -2142,7 +2142,7 @@ ure_encap_txpkt(struct mbuf *m, char *bu
 
 #if NVLAN > 0
if (m->m_flags & M_VLANTAG)
-   cflags |= swap16(m->m_pkthdr.ether_vtag | URE_TXPKT_VLAN_TAG);
+   cflags |= URE_TXPKT_VLAN_TAG | swap16(m->m_pkthdr.ether_vtag);
 #endif
 
txhdr.ure_pktlen = htole32(m->m_pkthdr.len | URE_TXPKT_TX_FS |



Re: ure(4): add support for RTL8156B

2022-04-02 Thread Kevin Lo
On Fri, Apr 01, 2022 at 06:09:26PM +0100, Stuart Henderson wrote:
> 
> On 2022/04/01 17:13, Stuart Henderson wrote:
> > On 2022/04/01 10:26, Gerhard Roth wrote:
> > > On 4/1/22 07:41, Kevin Lo wrote:
> > > > 
> > > > ure0: RTL8153 (0x5c10), address 00:e0:4c:xx:xx:xx
> > > > rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > 
> > > > ure0: RTL8153B (0x6010), address f4:28:53:xx:xx:xx
> > > > rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0
> > > > 
> > > > ure0 at uhub0 port 4 configuration 1 interface 0 "Planex USB 
> > > > 10/100/1G/2.5G LAN" rev 2.10/30.00 addr 5
> > > > ure0: RTL8156 (0x7030), address 1c:c0:35:xx:xx:xx
> > > > 
> > > 
> > > 
> > > You can add another one to the list that works just fine with your
> > > patch:
> > > 
> > > ure0 at uhub1 port 1 configuration 1 interface 0 "Realtek USB 10/100/1000 
> > > LAN" rev 3.00/30.00 addr 2
> > > ure0: RTL8153 (0x5c30), address 00:13:3b:xx:xx:xx
> > > rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
> > 
> > No new issues seen on RTL8153B:
> > 
> > ure0 at uhub0 port 15 configuration 1 interface 0 "Realtek USB 10/100/1000 
> > LAN" rev 3.00/31.00 addr 10
> > ure0: RTL8153B (0x6010), address 00:e0:4c:38:2b:0f
> > rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0
> > 
> > I have also tested with vlan and discovered an existing issue,
> > it seems that vlan transmission is not working correctly: no tag
> > is sent on the outgoing packet. Reception appears to be ok.
> > This occurs with the previous code too so it is not a regression.
> > 
> 
> Tx works ok if I disable hw tagging.

Thanks for the findings.  Does it help if you replace the line [1] with
"reg |= URE_CPCR_RX_VLAN | 0x80;" ?

[1] https://github.com/openbsd/src/blob/master/sys/dev/usb/if_ure.c#L724



Re: ure(4): add support for RTL8156B

2022-04-02 Thread Stuart Henderson
Which ic though, just 8153B? I guess it would have worked with some 
variants or it wouldn't have been enabled originally?


--
 Sent from a phone, apologies for poor formatting.

On 2 April 2022 02:26:05 David Gwynne  wrote:


On 2 Apr 2022, at 03:09, Stuart Henderson  wrote:

On 2022/04/01 17:13, Stuart Henderson wrote:

On 2022/04/01 10:26, Gerhard Roth wrote:

On 4/1/22 07:41, Kevin Lo wrote:


ure0: RTL8153 (0x5c10), address 00:e0:4c:xx:xx:xx
rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0

ure0: RTL8153B (0x6010), address f4:28:53:xx:xx:xx
rgephy1 at ure0 phy 0: RTL8251 PHY, rev. 0

ure0 at uhub0 port 4 configuration 1 interface 0 "Planex USB 10/100/1G/2.5G 
LAN" rev 2.10/30.00 addr 5

ure0: RTL8156 (0x7030), address 1c:c0:35:xx:xx:xx



You can add another one to the list that works just fine with your
patch:

ure0 at uhub1 port 1 configuration 1 interface 0 "Realtek USB 10/100/1000 
LAN" rev 3.00/30.00 addr 2

ure0: RTL8153 (0x5c30), address 00:13:3b:xx:xx:xx
rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0


No new issues seen on RTL8153B:

ure0 at uhub0 port 15 configuration 1 interface 0 "Realtek USB 10/100/1000 
LAN" rev 3.00/31.00 addr 10

ure0: RTL8153B (0x6010), address 00:e0:4c:38:2b:0f
rgephy0 at ure0 phy 0: RTL8251 PHY, rev. 0

I have also tested with vlan and discovered an existing issue,
it seems that vlan transmission is not working correctly: no tag
is sent on the outgoing packet. Reception appears to be ok.
This occurs with the previous code too so it is not a regression.


Tx works ok if I disable hw tagging.


that's a no brainer fix, commit it please.




Re: building a -current kernel fails on 7.0

2022-04-02 Thread Theo Buehler
On Sat, Apr 02, 2022 at 11:16:55AM +0200, Matthieu Herrb wrote:
> Hi,
> 
> I'm not sure if upgrade by building the system from sources is
> supposed to be supported or not.

I don't think it is supported. I think it's only expected to work from
reasonably recent snapshots.

> Anyways, for some reason I tried to build à -current kernel on a 7.0
> system, but, unless I've some other stuff set wrong it fails:
> 
> error: unknown warning option '-Wno-unused-but-set-variablé; did you
> mean '-Wno-unused-const-variablé? [-Werror,-Wunknown-warning-option]
> *** Error 1 in /usr/src/sys/arch/amd64/compile/GENERIC.MP
> (Makefile:1955 'assym.h')

-Wunused-but-set-variable was introduced with clang 13. It needed to be
disabled to keep -Werror. Due to that a kernel won't build with clang 11.

commit b59965a81ab3e54f1683aa69b9c9ad35ad99dd7e
Author: patrick 
Date:   Fri Dec 17 14:59:21 2021 +

Disable a few warning flags that were introduced and enabled by default
with LLVM 13.

> 
> -- 
> Matthieu Herrb
> 



building a -current kernel fails on 7.0

2022-04-02 Thread Matthieu Herrb
Hi,

I'm not sure if upgrade by building the system from sources is
supposed to be supported or not.

Anyways, for some reason I tried to build à -current kernel on a 7.0
system, but, unless I've some other stuff set wrong it fails:

error: unknown warning option '-Wno-unused-but-set-variablé; did you
mean '-Wno-unused-const-variablé? [-Werror,-Wunknown-warning-option]
*** Error 1 in /usr/src/sys/arch/amd64/compile/GENERIC.MP
(Makefile:1955 'assym.h')

-- 
Matthieu Herrb