Thu Apr 18 16:29:48 2024 UTC (21d)
Pull up following revision(s) (requested by andvar in ticket #661):

	sys/dev/pci/if_mcx.c: revision 1.27

mcx(4): enforce full-duplex mark in mcx_media_status(), when link is up.

LACP protocol requires full-duplex to be enabled for lagg(4) to work,
however mcx(4) was not setting this capability making it to fail.

Fixes PR kern/58124.  OK'd by msaitoh@


(martin)
diff -r1.25.4.1 -r1.25.4.2 src/sys/dev/pci/if_mcx.c

cvs diff -r1.25.4.1 -r1.25.4.2 src/sys/dev/pci/if_mcx.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_mcx.c 2023/11/03 08:59:29 1.25.4.1
+++ src/sys/dev/pci/if_mcx.c 2024/04/18 16:29:47 1.25.4.2
@@ -1,39 +1,39 @@ @@ -1,39 +1,39 @@
1/* $NetBSD: if_mcx.c,v 1.25.4.1 2023/11/03 08:59:29 martin Exp $ */ 1/* $NetBSD: if_mcx.c,v 1.25.4.2 2024/04/18 16:29:47 martin Exp $ */
2/* $OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */ 2/* $OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2017 David Gwynne <dlg@openbsd.org> 5 * Copyright (c) 2017 David Gwynne <dlg@openbsd.org>
6 * Copyright (c) 2019 Jonathan Matthew <jmatthew@openbsd.org> 6 * Copyright (c) 2019 Jonathan Matthew <jmatthew@openbsd.org>
7 * 7 *
8 * Permission to use, copy, modify, and distribute this software for any 8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above 9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies. 10 * copyright notice and this permission notice appear in all copies.
11 * 11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 */ 19 */
20 20
21#ifdef _KERNEL_OPT 21#ifdef _KERNEL_OPT
22#include "opt_net_mpsafe.h" 22#include "opt_net_mpsafe.h"
23#endif 23#endif
24 24
25#include <sys/cdefs.h> 25#include <sys/cdefs.h>
26__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.25.4.1 2023/11/03 08:59:29 martin Exp $"); 26__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.25.4.2 2024/04/18 16:29:47 martin Exp $");
27 27
28#include <sys/param.h> 28#include <sys/param.h>
29#include <sys/systm.h> 29#include <sys/systm.h>
30#include <sys/sockio.h> 30#include <sys/sockio.h>
31#include <sys/mbuf.h> 31#include <sys/mbuf.h>
32#include <sys/kernel.h> 32#include <sys/kernel.h>
33#include <sys/socket.h> 33#include <sys/socket.h>
34#include <sys/device.h> 34#include <sys/device.h>
35#include <sys/pool.h> 35#include <sys/pool.h>
36#include <sys/queue.h> 36#include <sys/queue.h>
37#include <sys/callout.h> 37#include <sys/callout.h>
38#include <sys/workqueue.h> 38#include <sys/workqueue.h>
39#include <sys/atomic.h> 39#include <sys/atomic.h>
@@ -8062,27 +8062,27 @@ mcx_media_status(struct ifnet *ifp, stru @@ -8062,27 +8062,27 @@ mcx_media_status(struct ifnet *ifp, stru
8062 const struct mcx_eth_proto_capability *cap; 8062 const struct mcx_eth_proto_capability *cap;
8063 if (!ISSET(proto_oper, 1U << i)) 8063 if (!ISSET(proto_oper, 1U << i))
8064 continue; 8064 continue;
8065 8065
8066 cap = &mcx_eth_cap_map[i]; 8066 cap = &mcx_eth_cap_map[i];
8067 8067
8068 if (cap->cap_media != 0) 8068 if (cap->cap_media != 0)
8069 media_oper = cap->cap_media; 8069 media_oper = cap->cap_media;
8070 } 8070 }
8071 8071
8072 ifmr->ifm_status = IFM_AVALID; 8072 ifmr->ifm_status = IFM_AVALID;
8073 if (proto_oper != 0) { 8073 if (proto_oper != 0) {
8074 ifmr->ifm_status |= IFM_ACTIVE; 8074 ifmr->ifm_status |= IFM_ACTIVE;
8075 ifmr->ifm_active = IFM_ETHER | IFM_AUTO | media_oper; 8075 ifmr->ifm_active = IFM_ETHER | IFM_FDX | IFM_AUTO | media_oper;
8076 /* txpause, rxpause, duplex? */ 8076 /* txpause, rxpause, duplex? */
8077 } 8077 }
8078} 8078}
8079 8079
8080static int 8080static int
8081mcx_media_change(struct ifnet *ifp) 8081mcx_media_change(struct ifnet *ifp)
8082{ 8082{
8083 struct mcx_softc *sc = (struct mcx_softc *)ifp->if_softc; 8083 struct mcx_softc *sc = (struct mcx_softc *)ifp->if_softc;
8084 struct mcx_reg_ptys ptys; 8084 struct mcx_reg_ptys ptys;
8085 struct mcx_reg_paos paos; 8085 struct mcx_reg_paos paos;
8086 uint32_t media; 8086 uint32_t media;
8087 int i, error; 8087 int i, error;
8088 8088