Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 2024 19:29:35 GMT
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1eaecc214ea2 - main - qlnx: Convert recent changes to IfAPI
Message-ID:  <202411131929.4ADJTZIb033484@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=1eaecc214ea2bfde84f4194c1d0e20b18117343f

commit 1eaecc214ea2bfde84f4194c1d0e20b18117343f
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2024-11-08 20:22:11 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2024-11-13 19:30:59 +0000

    qlnx: Convert recent changes to IfAPI
    
    Sponsored by:   Juniper Networks, Inc.
    Reviewed by:    zlei
    Differential Revision: https://reviews.freebsd.org/D47533
---
 sys/dev/qlnx/qlnxe/qlnx_os.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c
index 49d3f20aa0c2..a984908abf34 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -2624,6 +2624,7 @@ static int
 qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
 {
 	int		ret = 0, mask;
+	int		flags;
 	struct ifreq	*ifr = (struct ifreq *)data;
 #ifdef INET
 	struct ifaddr	*ifa = (struct ifaddr *)data;
@@ -2677,15 +2678,16 @@ qlnx_ioctl(if_t ifp, u_long cmd, caddr_t data)
 		QL_DPRINT4(ha, "SIOCSIFFLAGS (0x%lx)\n", cmd);
 
 		QLNX_LOCK(ha);
+		flags = if_getflags(ifp);
 
-		if (if_getflags(ifp) & IFF_UP) {
+		if (flags & IFF_UP) {
 			if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
-				if ((if_getflags(ifp) ^ ha->if_flags) &
+				if ((flags ^ ha->if_flags) &
 					IFF_PROMISC) {
-					ret = qlnx_set_promisc(ha, ifp->if_flags & IFF_PROMISC);
+					ret = qlnx_set_promisc(ha, flags & IFF_PROMISC);
 				} else if ((if_getflags(ifp) ^ ha->if_flags) &
 					IFF_ALLMULTI) {
-					ret = qlnx_set_allmulti(ha, ifp->if_flags & IFF_ALLMULTI);
+					ret = qlnx_set_allmulti(ha, flags & IFF_ALLMULTI);
 				}
 			} else {
 				ha->max_frame_size = if_getmtu(ifp) +
@@ -7055,12 +7057,14 @@ qlnx_set_rx_mode(qlnx_host_t *ha)
 {
 	int	rc = 0;
 	uint8_t	filter;
-	const struct ifnet *ifp = ha->ifp;
+	const if_t ifp = ha->ifp;
+	const struct ifaddr *ifa;
 	struct sockaddr_dl *sdl;
 
-	if (ifp->if_type == IFT_ETHER && ifp->if_addr != NULL &&
-			ifp->if_addr->ifa_addr != NULL) {
-		sdl = (struct sockaddr_dl *) ifp->if_addr->ifa_addr;
+	ifa = if_getifaddr(ifp);
+	if (if_gettype(ifp) == IFT_ETHER && ifa != NULL &&
+			ifa->ifa_addr != NULL) {
+		sdl = (struct sockaddr_dl *) ifa->ifa_addr;
 
 		rc = qlnx_set_ucast_rx_mac(ha, ECORE_FILTER_REPLACE, LLADDR(sdl));
 	} else {
@@ -7077,10 +7081,10 @@ qlnx_set_rx_mode(qlnx_host_t *ha)
 			ECORE_ACCEPT_MCAST_MATCHED |
 			ECORE_ACCEPT_BCAST;
 
-	if (qlnx_vf_device(ha) == 0 || (ha->ifp->if_flags & IFF_PROMISC)) {
+	if (qlnx_vf_device(ha) == 0 || (if_getflags(ha->ifp) & IFF_PROMISC)) {
 		filter |= ECORE_ACCEPT_UCAST_UNMATCHED;
 		filter |= ECORE_ACCEPT_MCAST_UNMATCHED;
-	} else if (ha->ifp->if_flags & IFF_ALLMULTI) {
+	} else if (if_getflags(ha->ifp) & IFF_ALLMULTI) {
 		filter |= ECORE_ACCEPT_MCAST_UNMATCHED;
 	}
 	ha->filter = filter;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202411131929.4ADJTZIb033484>