From owner-dev-commits-src-branches@freebsd.org Sun Jul 18 00:36:41 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E46E165F479; Sun, 18 Jul 2021 00:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GS5dP3f5cz4RXr; Sun, 18 Jul 2021 00:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 999341A327; Sun, 18 Jul 2021 00:36:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16I0acpr049385; Sun, 18 Jul 2021 00:36:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16I0acqE049384; Sun, 18 Jul 2021 00:36:38 GMT (envelope-from git) Date: Sun, 18 Jul 2021 00:36:38 GMT Message-Id: <202107180036.16I0acqE049384@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: ddecc06c9940 - stable/13 - LinuxKPI/OFED/mlx4: cleanup netdevice.h some more MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ddecc06c9940e1e9b14278c22f605655263a693f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 00:36:42 -0000 The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=ddecc06c9940e1e9b14278c22f605655263a693f commit ddecc06c9940e1e9b14278c22f605655263a693f Author: Bjoern A. Zeeb AuthorDate: 2021-05-26 12:27:26 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-07-18 00:35:02 +0000 LinuxKPI/OFED/mlx4: cleanup netdevice.h some more This removes all unused bits from linux/netdevice.h and migrates two inline functions into the mlx4 and ofed code respectively. This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines in netdevice.h. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky, kib Differential Revision: https://reviews.freebsd.org/D30461 (cherry picked from commit c35034b338eb4de6fb42fd855865bce21c81a225) --- .../linuxkpi/common/include/linux/netdevice.h | 64 ---------------------- sys/dev/mlx4/mlx4_en/en.h | 6 ++ sys/ofed/drivers/infiniband/core/ib_addr.c | 1 - sys/ofed/drivers/infiniband/core/ib_cma.c | 1 - sys/ofed/include/rdma/ib_addr.h | 2 +- sys/ofed/include/rdma/ib_addr_freebsd.h | 15 +++++ sys/ofed/include/rdma/ib_sa.h | 1 + 7 files changed, 23 insertions(+), 67 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h index 9ec76d9b90ef..07c111cc4fc9 100644 --- a/sys/compat/linuxkpi/common/include/linux/netdevice.h +++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h @@ -40,10 +40,6 @@ #include #include -#include -#include -#include -#include #include #include @@ -57,21 +53,6 @@ #define net_device ifnet -static inline struct ifnet * -dev_get_by_index(struct vnet *vnet, int if_index) -{ - struct epoch_tracker et; - struct ifnet *retval; - - NET_EPOCH_ENTER(et); - CURVNET_SET(vnet); - retval = ifnet_byindex_ref(if_index); - CURVNET_RESTORE(); - NET_EPOCH_EXIT(et); - - return (retval); -} - #define dev_hold(d) if_ref(d) #define dev_put(d) if_rele(d) #define dev_net(d) ((d)->if_vnet) @@ -79,56 +60,11 @@ dev_get_by_index(struct vnet *vnet, int if_index) #define net_eq(a,b) ((a) == (b)) #define netif_running(dev) !!((dev)->if_drv_flags & IFF_DRV_RUNNING) -#define netif_oper_up(dev) !!((dev)->if_flags & IFF_UP) #define netif_carrier_ok(dev) ((dev)->if_link_state == LINK_STATE_UP) -static inline void * -netdev_priv(const struct net_device *dev) -{ - return (dev->if_softc); -} - #define rtnl_lock() #define rtnl_unlock() -static inline int -dev_mc_delete(struct net_device *dev, void *addr, int alen, int all) -{ - struct sockaddr_dl sdl; - - if (alen > sizeof(sdl.sdl_data)) - return (-EINVAL); - memset(&sdl, 0, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_alen = alen; - memcpy(&sdl.sdl_data, addr, alen); - - return -if_delmulti(dev, (struct sockaddr *)&sdl); -} - -static inline int -dev_mc_del(struct net_device *dev, void *addr) -{ - return (dev_mc_delete(dev, addr, 6, 0)); -} - -static inline int -dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly) -{ - struct sockaddr_dl sdl; - - if (alen > sizeof(sdl.sdl_data)) - return (-EINVAL); - memset(&sdl, 0, sizeof(sdl)); - sdl.sdl_len = sizeof(sdl); - sdl.sdl_family = AF_LINK; - sdl.sdl_alen = alen; - memcpy(&sdl.sdl_data, addr, alen); - - return -if_addmulti(dev, (struct sockaddr *)&sdl, NULL); -} - /* According to linux::ipoib_main.c. */ struct netdev_notifier_info { struct net_device *dev; diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h index e7a02f02c8b7..e63027bc9dc0 100644 --- a/sys/dev/mlx4/mlx4_en/en.h +++ b/sys/dev/mlx4/mlx4_en/en.h @@ -654,6 +654,12 @@ struct mlx4_mac_entry { u64 reg_id; }; +static inline void * +netdev_priv(const struct net_device *dev) +{ + return (dev->if_softc); +} + static inline struct mlx4_cqe *mlx4_en_get_cqe(u8 *buf, int idx, int cqe_sz) { return (struct mlx4_cqe *)(buf + idx * cqe_sz); diff --git a/sys/ofed/drivers/infiniband/core/ib_addr.c b/sys/ofed/drivers/infiniband/core/ib_addr.c index f8c1cb180af8..ef5e264577e0 100644 --- a/sys/ofed/drivers/infiniband/core/ib_addr.c +++ b/sys/ofed/drivers/infiniband/core/ib_addr.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c index 717d7c70e9de..7c03841d51d7 100644 --- a/sys/ofed/drivers/infiniband/core/ib_cma.c +++ b/sys/ofed/drivers/infiniband/core/ib_cma.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/ofed/include/rdma/ib_addr.h b/sys/ofed/include/rdma/ib_addr.h index 052fc636f617..535e6c2b3b14 100644 --- a/sys/ofed/include/rdma/ib_addr.h +++ b/sys/ofed/include/rdma/ib_addr.h @@ -49,7 +49,7 @@ #include #include #include -#include +#include struct rdma_addr_client { atomic_t refcount; diff --git a/sys/ofed/include/rdma/ib_addr_freebsd.h b/sys/ofed/include/rdma/ib_addr_freebsd.h index 5ce5f2f8a5ed..79b7231875ec 100644 --- a/sys/ofed/include/rdma/ib_addr_freebsd.h +++ b/sys/ofed/include/rdma/ib_addr_freebsd.h @@ -92,4 +92,19 @@ ip6_ifp_find(struct vnet *vnet, struct in6_addr addr, uint16_t scope_id) } #endif +static inline struct ifnet * +dev_get_by_index(struct vnet *vnet, int if_index) +{ + struct epoch_tracker et; + struct ifnet *retval; + + NET_EPOCH_ENTER(et); + CURVNET_SET(vnet); + retval = ifnet_byindex_ref(if_index); + CURVNET_RESTORE(); + NET_EPOCH_EXIT(et); + + return (retval); +} + #endif /* _RDMA_IB_ADDR_FREEBSD_H */ diff --git a/sys/ofed/include/rdma/ib_sa.h b/sys/ofed/include/rdma/ib_sa.h index 28e9a7887cab..beea96a02e1a 100644 --- a/sys/ofed/include/rdma/ib_sa.h +++ b/sys/ofed/include/rdma/ib_sa.h @@ -43,6 +43,7 @@ #include #include +#include #include #include