From nobody Tue Feb 07 19:18:10 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PBCZq58MJz3nbZP; Tue, 7 Feb 2023 19:18:11 +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 4PBCZq1J63z4VRQ; Tue, 7 Feb 2023 19:18:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675797491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ok5nms28YXAHmhgd85UP/DJn0S4aryidz6lVb7ik6+I=; b=hYuCny4KBvWVrfMM3oa5Fnl3bpTuTif63uFGB1FnrFP2DEnx7EuP9yRgEy5zgE/1xNS+44 /r/YWjSdlECbAPETkS+Zbt16uWAiudeYORpmdfyWRn/th3ITy0ZuQ7f+amS2i7coWl8xN0 JXDkvmfl5DLNe+0/3BIqd9A01fV2rDqf1MV/uTmCSZme+Degq2iliLFHoAQzskGVSaLxtU 1fIOoahf/j89gfaQWq1oIbUAaQGNE5+yxCWaBxIygDJ2gOOquqd8KRMN+1jS0TptKlVOXF t4gtvulBpGdBQsgmho+FBJLEueQImlY5YvezGZrWeU9A9sMwjrGlHhHwoa/kyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675797491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ok5nms28YXAHmhgd85UP/DJn0S4aryidz6lVb7ik6+I=; b=aK0V364n4SO5zhpFQ7uzyH/muCIePOMThhMS8cnmcvbDPr2t9LdtiFRbQisOoU8mxna1Bv +GqsnHTadyp32JkT1JcGP35h00UjAVCUOFyiYANOExoOXg1Ue0dqIKv3qqsJ6EhAUR0ybi zKfclDHDvtlX6HkHHZDC8Dlr+A4IdjaGMKqBtyQojGsOywO8uFlqAqd9PALrf7UcxUX2Y1 XneeNVcsoPVw4W5ruaji52pXKe0nKB60JuqHFTGhzP+1NC1b2AyG7HFwPqy+vhZ9gNyGDf VIvxNdfvzsUaZ8OlfDCQm1WoXCusdIs7QrVZRw2JnuS0FOoLg90TM1ZNRTSm/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675797491; a=rsa-sha256; cv=none; b=hRgSMv0o5ViPv1PHptby8zkvUBmVuF93/cxiS7X5HSoOac6WbbNNx3rRfbviim433VkFkj L0I7wbedWRQoAHhopvscBU45kJJcZfMCdDF4Zr1di9N2rQnleTomEHDFBwkI5kTHSvIRIQ bksMKYW1n8brJpMkTLlLHlvjvIlUDzhkvwjJTxBhsHsbxAX2u8aZMZpc0vIR7CcbJh7Ele qkDJ2oziO/BjqnRrBWnTEgyb9tnLHtPGIKsrF1CAjDB92mI9gZFiQMyRYCVEDtVji4vIRi oNzNEQAI+TY9IlXYZp+Edx0MI3uWP+X2udh+eXSk3QX7gDQFnk1TtxTrS3hOGw== 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 4PBCZq070yzSnW; Tue, 7 Feb 2023 19:18:11 +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 317JIAUp049789; Tue, 7 Feb 2023 19:18:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 317JIAtS049788; Tue, 7 Feb 2023 19:18:10 GMT (envelope-from git) Date: Tue, 7 Feb 2023 19:18:10 GMT Message-Id: <202302071918.317JIAtS049788@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: 0b2813768bae - main - Mechanically convert mlx4(4) to IfAPI List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b2813768bae1177b7369d67b7639d530f547b47 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=0b2813768bae1177b7369d67b7639d530f547b47 commit 0b2813768bae1177b7369d67b7639d530f547b47 Author: Justin Hibbits AuthorDate: 2022-08-17 20:30:39 +0000 Commit: Justin Hibbits CommitDate: 2023-02-07 19:16:11 +0000 Mechanically convert mlx4(4) to IfAPI Reviewed by: hselasky, zlei Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D37823 --- sys/dev/mlx4/mlx4_en/en.h | 38 +++--- sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c | 226 +++++++++++++++---------------- sys/dev/mlx4/mlx4_en/mlx4_en_port.c | 4 +- sys/dev/mlx4/mlx4_en/mlx4_en_resources.c | 4 +- sys/dev/mlx4/mlx4_en/mlx4_en_rx.c | 22 +-- sys/dev/mlx4/mlx4_en/mlx4_en_tx.c | 18 +-- sys/dev/mlx4/mlx4_ib/mlx4_ib.h | 2 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_ah.c | 2 +- sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c | 24 ++-- sys/dev/mlx4/mlx4_ib/mlx4_ib_qp.c | 2 +- 10 files changed, 171 insertions(+), 171 deletions(-) diff --git a/sys/dev/mlx4/mlx4_en/en.h b/sys/dev/mlx4/mlx4_en/en.h index 440b9a340221..a29b40ddaf10 100644 --- a/sys/dev/mlx4/mlx4_en/en.h +++ b/sys/dev/mlx4/mlx4_en/en.h @@ -392,7 +392,7 @@ struct mlx4_en_cq { struct mlx4_hwq_resources wqres; int ring; spinlock_t lock; - struct ifnet *dev; + if_t dev; /* Per-core Tx cq processing support */ struct timer_list timer; int size; @@ -452,7 +452,7 @@ struct mlx4_en_dev { struct mlx4_dev *dev; struct pci_dev *pdev; struct mutex state_lock; - struct ifnet *pndev[MLX4_MAX_PORTS + 1]; + if_t pndev[MLX4_MAX_PORTS + 1]; u32 port_cnt; bool device_up; struct mlx4_en_profile profile; @@ -543,7 +543,7 @@ struct en_port { struct mlx4_en_priv { struct mlx4_en_dev *mdev; struct mlx4_en_port_profile *prof; - struct ifnet *dev; + if_t dev; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; struct mlx4_en_port_state port_state; spinlock_t stats_lock; @@ -662,9 +662,9 @@ struct mlx4_mac_entry { }; static inline void * -mlx4_netdev_priv(const struct ifnet *dev) +mlx4_netdev_priv(const if_t dev) { - return (dev->if_softc); + return (if_getsoftc(dev)); } static inline struct mlx4_cqe *mlx4_en_get_cqe(u8 *buf, int idx, int cqe_sz) @@ -716,7 +716,7 @@ static inline bool mlx4_en_cq_lock_poll(struct mlx4_en_cq *cq) int rc = true; spin_lock_bh(&cq->poll_lock); if ((cq->state & MLX4_CQ_LOCKED)) { - struct ifnet *dev = cq->dev; + if_t dev = cq->dev; struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring]; @@ -785,12 +785,12 @@ static inline bool mlx4_en_cq_busy_polling(struct mlx4_en_cq *cq) #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) -void mlx4_en_destroy_netdev(struct ifnet *dev); +void mlx4_en_destroy_netdev(if_t dev); int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, struct mlx4_en_port_profile *prof); -int mlx4_en_start_port(struct ifnet *dev); -void mlx4_en_stop_port(struct ifnet *dev); +int mlx4_en_start_port(if_t dev); +void mlx4_en_stop_port(if_t dev); void mlx4_en_free_resources(struct mlx4_en_priv *priv); int mlx4_en_alloc_resources(struct mlx4_en_priv *priv); @@ -806,10 +806,10 @@ int mlx4_en_set_cq_moder(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq); int mlx4_en_arm_cq(struct mlx4_en_priv *priv, struct mlx4_en_cq *cq); void mlx4_en_tx_irq(struct mlx4_cq *mcq); -u16 mlx4_en_select_queue(struct ifnet *dev, struct mbuf *mb); +u16 mlx4_en_select_queue(if_t dev, struct mbuf *mb); int mlx4_en_xmit(struct mlx4_en_priv *priv, int tx_ind, struct mbuf **mbp); -int mlx4_en_transmit(struct ifnet *dev, struct mbuf *m); +int mlx4_en_transmit(if_t dev, struct mbuf *m); int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring **pring, u32 size, u16 stride, int node, int queue_idx); @@ -821,7 +821,7 @@ int mlx4_en_activate_tx_ring(struct mlx4_en_priv *priv, void mlx4_en_deactivate_tx_ring(struct mlx4_en_priv *priv, struct mlx4_en_tx_ring *ring); void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev); -void mlx4_en_qflush(struct ifnet *dev); +void mlx4_en_qflush(if_t dev); int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring **pring, @@ -833,7 +833,7 @@ void mlx4_en_rx_que(void *context, int pending); int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv); void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring); -int mlx4_en_process_rx_cq(struct ifnet *dev, +int mlx4_en_process_rx_cq(if_t dev, struct mlx4_en_cq *cq, int budget); void mlx4_en_poll_tx_cq(unsigned long data); @@ -843,7 +843,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, void mlx4_en_sqp_event(struct mlx4_qp *qp, enum mlx4_event event); int mlx4_en_map_buffer(struct mlx4_buf *buf); void mlx4_en_unmap_buffer(struct mlx4_buf *buf); -void mlx4_en_calc_rx_buf(struct ifnet *dev); +void mlx4_en_calc_rx_buf(if_t dev); const u32 *mlx4_en_get_rss_key(struct mlx4_en_priv *priv, u16 *keylen); u8 mlx4_en_get_rss_mask(struct mlx4_en_priv *priv); @@ -851,7 +851,7 @@ int mlx4_en_config_rss_steer(struct mlx4_en_priv *priv); void mlx4_en_release_rss_steer(struct mlx4_en_priv *priv); int mlx4_en_create_drop_qp(struct mlx4_en_priv *priv); void mlx4_en_destroy_drop_qp(struct mlx4_en_priv *priv); -int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring); +int mlx4_en_free_tx_buf(if_t dev, struct mlx4_en_tx_ring *ring); void mlx4_en_rx_irq(struct mlx4_cq *mcq); int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv); @@ -869,7 +869,7 @@ extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_ops; extern const struct dcbnl_rtnl_ops mlx4_en_dcbnl_pfc_ops; #endif -int mlx4_en_setup_tc(struct ifnet *dev, u8 up); +int mlx4_en_setup_tc(if_t dev, u8 up); #ifdef CONFIG_RFS_ACCEL void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv, @@ -877,7 +877,7 @@ void mlx4_en_cleanup_filters(struct mlx4_en_priv *priv, #endif #define MLX4_EN_NUM_SELF_TEST 5 -void mlx4_en_ex_selftest(struct ifnet *dev, u32 *flags, u64 *buf); +void mlx4_en_ex_selftest(if_t dev, u32 *flags, u64 *buf); void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev); /* @@ -889,7 +889,7 @@ void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev); u64 mlx4_en_get_cqe_ts(struct mlx4_cqe *cqe); /* Functions for caching and restoring statistics */ -int mlx4_en_get_sset_count(struct ifnet *dev, int sset); +int mlx4_en_get_sset_count(if_t dev, int sset); void mlx4_en_restore_ethtool_stats(struct mlx4_en_priv *priv, u64 *data); @@ -932,7 +932,7 @@ enum { { \ if ((priv)->registered) \ printk(level "%s: %s: " format, DRV_NAME, \ - (priv)->dev->if_xname, ## arg); \ + if_name((priv)->dev), ## arg); \ else \ printk(level "%s: %s: Port %d: " format, \ DRV_NAME, dev_name(&(priv)->mdev->pdev->dev), \ diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c index bae22317574b..c26afc0099b5 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_netdev.c @@ -64,7 +64,7 @@ static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv); static int mlx4_en_low_latency_recv(struct napi_struct *napi) { struct mlx4_en_cq *cq = container_of(napi, struct mlx4_en_cq, napi); - struct ifnet *dev = cq->dev; + if_t dev = cq->dev; struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_rx_ring *rx_ring = priv->rx_ring[cq->ring]; int done; @@ -288,7 +288,7 @@ mlx4_en_filter_find(struct mlx4_en_priv *priv, __be32 src_ip, __be32 dst_ip, } static int -mlx4_en_filter_rfs(struct ifnet *net_dev, const struct sk_buff *skb, +mlx4_en_filter_rfs(if_t net_dev, const struct sk_buff *skb, u16 rxq_index, u32 flow_id) { struct mlx4_en_priv *priv = mlx4_netdev_priv(net_dev); @@ -400,7 +400,7 @@ static void mlx4_en_filter_rfs_expire(struct mlx4_en_priv *priv) } #endif -static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid) +static void mlx4_en_vlan_rx_add_vid(void *arg, if_t dev, u16 vid) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -427,7 +427,7 @@ static void mlx4_en_vlan_rx_add_vid(void *arg, struct ifnet *dev, u16 vid) } -static void mlx4_en_vlan_rx_kill_vid(void *arg, struct ifnet *dev, u16 vid) +static void mlx4_en_vlan_rx_kill_vid(void *arg, if_t dev, u16 vid) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -558,15 +558,15 @@ static int mlx4_en_get_qp(struct mlx4_en_priv *priv) int index = 0; int err = 0; int *qpn = &priv->base_qpn; - u64 mac = mlx4_mac_to_u64(IF_LLADDR(priv->dev)); + u64 mac = mlx4_mac_to_u64(if_getlladdr(priv->dev)); en_dbg(DRV, priv, "Registering MAC: %pM for adding\n", - IF_LLADDR(priv->dev)); + if_getlladdr(priv->dev)); index = mlx4_register_mac(dev, priv->port, mac); if (index < 0) { err = index; en_err(priv, "Failed adding MAC: %pM\n", - IF_LLADDR(priv->dev)); + if_getlladdr(priv->dev)); return err; } @@ -594,9 +594,9 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv) int qpn = priv->base_qpn; if (dev->caps.steering_mode == MLX4_STEERING_MODE_A0) { - u64 mac = mlx4_mac_to_u64(IF_LLADDR(priv->dev)); + u64 mac = mlx4_mac_to_u64(if_getlladdr(priv->dev)); en_dbg(DRV, priv, "Registering MAC: %pM for deleting\n", - IF_LLADDR(priv->dev)); + if_getlladdr(priv->dev)); mlx4_unregister_mac(dev, priv->port, mac); } else { en_dbg(DRV, priv, "Releasing qp: port %d, qpn %d\n", @@ -606,7 +606,7 @@ static void mlx4_en_put_qp(struct mlx4_en_priv *priv) } } -static void mlx4_en_clear_uclist(struct ifnet *dev) +static void mlx4_en_clear_uclist(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_addr_list *tmp, *uc_to_del; @@ -635,7 +635,7 @@ static u_int mlx4_copy_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) return (1); } -static void mlx4_en_cache_uclist(struct ifnet *dev) +static void mlx4_en_cache_uclist(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); @@ -643,7 +643,7 @@ static void mlx4_en_cache_uclist(struct ifnet *dev) if_foreach_lladdr(dev, mlx4_copy_addr, priv); } -static void mlx4_en_clear_mclist(struct ifnet *dev) +static void mlx4_en_clear_mclist(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_addr_list *tmp, *mc_to_del; @@ -671,7 +671,7 @@ static u_int mlx4_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) return (1); } -static void mlx4_en_cache_mclist(struct ifnet *dev) +static void mlx4_en_cache_mclist(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); @@ -728,7 +728,7 @@ static void update_addr_list_flags(struct mlx4_en_priv *priv, } } -static void mlx4_en_set_rx_mode(struct ifnet *dev) +static void mlx4_en_set_rx_mode(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); @@ -842,7 +842,7 @@ static void mlx4_en_clear_promisc_mode(struct mlx4_en_priv *priv, } static void mlx4_en_do_multicast(struct mlx4_en_priv *priv, - struct ifnet *dev, + if_t dev, struct mlx4_en_dev *mdev) { struct mlx4_en_addr_list *addr_list, *tmp; @@ -854,7 +854,7 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *priv, * Enable/disable the multicast filter according to * IFF_ALLMULTI and IFF_PROMISC: */ - if (dev->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) { + if (if_getflags(dev) & (IFF_ALLMULTI | IFF_PROMISC)) { err = mlx4_SET_MCAST_FLTR(mdev->dev, priv->port, 0, 0, MLX4_MCAST_DISABLE); if (err) @@ -977,7 +977,7 @@ static void mlx4_en_do_multicast(struct mlx4_en_priv *priv, } static void mlx4_en_do_unicast(struct mlx4_en_priv *priv, - struct ifnet *dev, + if_t dev, struct mlx4_en_dev *mdev) { struct mlx4_en_addr_list *addr_list, *tmp; @@ -1011,7 +1011,7 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work) struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, rx_mode_task); struct mlx4_en_dev *mdev = priv->mdev; - struct ifnet *dev = priv->dev; + if_t dev = priv->dev; mutex_lock(&mdev->state_lock); if (!mdev->device_up) { @@ -1026,8 +1026,8 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work) if (priv->port_state.link_state) { priv->last_link_state = MLX4_DEV_EVENT_PORT_UP; /* update netif baudrate */ - priv->dev->if_baudrate = - IF_Mbps(priv->port_state.link_speed); + if_setbaudrate(priv->dev, + IF_Mbps(priv->port_state.link_speed)); /* Important note: the following call for if_link_state_change * is needed for interface up scenario (start port, link state * change) */ @@ -1040,7 +1040,7 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work) mlx4_en_do_unicast(priv, dev, mdev); /* Promsicuous mode: disable all filters */ - if ((dev->if_flags & IFF_PROMISC) || + if ((if_getflags(dev) & IFF_PROMISC) || (priv->flags & MLX4_EN_FLAG_FORCE_PROMISC)) { mlx4_en_set_promisc_mode(priv, mdev); } else if (priv->flags & MLX4_EN_FLAG_PROMISC) { @@ -1085,7 +1085,7 @@ static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv) priv->tx_usecs = MLX4_EN_TX_COAL_TIME; en_dbg(INTR, priv, "Default coalesing params for mtu: %u - " "rx_frames:%d rx_usecs:%d\n", - (unsigned)priv->dev->if_mtu, priv->rx_frames, priv->rx_usecs); + (unsigned)if_getmtu(priv->dev), priv->rx_frames, priv->rx_usecs); /* Setup cq moderation params */ for (i = 0; i < priv->rx_ring_num; i++) { @@ -1236,7 +1236,7 @@ static void mlx4_en_linkstate(struct work_struct *work) en_info(priv, "Link Down\n"); if_link_state_change(priv->dev, LINK_STATE_DOWN); /* update netif baudrate */ - priv->dev->if_baudrate = 0; + if_setbaudrate(priv->dev, 0); /* make sure the port is up before notifying the OS. * This is tricky since we get here on INIT_PORT and @@ -1247,8 +1247,8 @@ static void mlx4_en_linkstate(struct work_struct *work) } else if (priv->port_up && (linkstate == MLX4_DEV_EVENT_PORT_UP)){ if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) en_info(priv, "Query port failed\n"); - priv->dev->if_baudrate = - IF_Mbps(priv->port_state.link_speed); + if_setbaudrate(priv->dev, + IF_Mbps(priv->port_state.link_speed)); en_info(priv, "Link Up\n"); if_link_state_change(priv->dev, LINK_STATE_UP); } @@ -1258,7 +1258,7 @@ static void mlx4_en_linkstate(struct work_struct *work) } -int mlx4_en_start_port(struct ifnet *dev) +int mlx4_en_start_port(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1284,7 +1284,7 @@ int mlx4_en_start_port(struct ifnet *dev) INIT_LIST_HEAD(&priv->ethtool_list); /* Calculate Rx buf size */ - dev->if_mtu = min(dev->if_mtu, priv->max_mtu); + if_setmtu(dev, min(if_getmtu(dev), priv->max_mtu)); mlx4_en_calc_rx_buf(dev); en_dbg(DRV, priv, "Rx buf size:%d\n", priv->rx_mb_size); @@ -1420,8 +1420,7 @@ int mlx4_en_start_port(struct ifnet *dev) priv->port_up = true; /* Enable the queues. */ - dev->if_drv_flags &= ~IFF_DRV_OACTIVE; - dev->if_drv_flags |= IFF_DRV_RUNNING; + if_setdrvflagbits(dev, IFF_DRV_RUNNING, IFF_DRV_OACTIVE); #ifdef CONFIG_DEBUG_FS mlx4_en_create_debug_files(priv); #endif @@ -1451,7 +1450,7 @@ cq_err: } -void mlx4_en_stop_port(struct ifnet *dev) +void mlx4_en_stop_port(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1560,7 +1559,7 @@ void mlx4_en_stop_port(struct ifnet *dev) callout_stop(&priv->watchdog_timer); - dev->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + if_setdrvflagbits(dev, 0, IFF_DRV_RUNNING | IFF_DRV_OACTIVE); } static void mlx4_en_restart(struct work_struct *work) @@ -1568,7 +1567,7 @@ static void mlx4_en_restart(struct work_struct *work) struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, watchdog_task); struct mlx4_en_dev *mdev = priv->mdev; - struct ifnet *dev = priv->dev; + if_t dev = priv->dev; struct mlx4_en_tx_ring *ring; int i; @@ -1601,7 +1600,7 @@ reset: mutex_unlock(&mdev->state_lock); } -static void mlx4_en_clear_stats(struct ifnet *dev) +static void mlx4_en_clear_stats(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1635,7 +1634,7 @@ static void mlx4_en_open(void* arg) struct mlx4_en_priv *priv; struct mlx4_en_dev *mdev; - struct ifnet *dev; + if_t dev; int err = 0; priv = arg; @@ -1760,7 +1759,7 @@ struct en_port_attribute en_port_attr_##_name = __ATTR_RO(_name) #define EN_PORT_ATTR(_name, _mode, _show, _store) \ struct en_port_attribute en_port_attr_##_name = __ATTR(_name, _mode, _show, _store) -void mlx4_en_destroy_netdev(struct ifnet *dev) +void mlx4_en_destroy_netdev(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -1815,14 +1814,14 @@ void mlx4_en_destroy_netdev(struct ifnet *dev) } -static int mlx4_en_change_mtu(struct ifnet *dev, int new_mtu) +static int mlx4_en_change_mtu(if_t dev, int new_mtu) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; int err = 0; en_dbg(DRV, priv, "Change MTU called - current:%u new:%u\n", - (unsigned)dev->if_mtu, (unsigned)new_mtu); + (unsigned)if_getmtu(dev), (unsigned)new_mtu); if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) { en_err(priv, "Bad MTU size:%d, max %u.\n", new_mtu, @@ -1830,8 +1829,8 @@ static int mlx4_en_change_mtu(struct ifnet *dev, int new_mtu) return -EPERM; } mutex_lock(&mdev->state_lock); - dev->if_mtu = new_mtu; - if (dev->if_drv_flags & IFF_DRV_RUNNING) { + if_setmtu(dev, new_mtu); + if (if_getdrvflags(dev) & IFF_DRV_RUNNING) { if (!mdev->device_up) { /* NIC is probably restarting - let watchdog task reset * * the port */ @@ -1886,11 +1885,11 @@ static int mlx4_en_calc_media(struct mlx4_en_priv *priv) return (active); } -static void mlx4_en_media_status(struct ifnet *dev, struct ifmediareq *ifmr) +static void mlx4_en_media_status(if_t dev, struct ifmediareq *ifmr) { struct mlx4_en_priv *priv; - priv = dev->if_softc; + priv = if_getsoftc(dev); ifmr->ifm_status = IFM_AVALID; if (priv->last_link_state != MLX4_DEV_EVENT_PORT_DOWN) ifmr->ifm_status |= IFM_ACTIVE; @@ -1899,7 +1898,7 @@ static void mlx4_en_media_status(struct ifnet *dev, struct ifmediareq *ifmr) return; } -static int mlx4_en_media_change(struct ifnet *dev) +static int mlx4_en_media_change(if_t dev) { struct mlx4_en_priv *priv; struct ifmedia *ifm; @@ -1907,7 +1906,7 @@ static int mlx4_en_media_change(struct ifnet *dev) int txpause; int error; - priv = dev->if_softc; + priv = if_getsoftc(dev); ifm = &priv->media; rxpause = txpause = 0; error = 0; @@ -1946,7 +1945,7 @@ static int mlx4_en_media_change(struct ifnet *dev) return (error); } -static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data) +static int mlx4_en_ioctl(if_t dev, u_long command, caddr_t data) { struct mlx4_en_priv *priv; struct mlx4_en_dev *mdev; @@ -1960,7 +1959,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data) error = 0; mask = 0; - priv = dev->if_softc; + priv = if_getsoftc(dev); /* check if detaching */ if (priv == NULL || priv->gone != 0) @@ -1974,8 +1973,8 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data) error = -mlx4_en_change_mtu(dev, ifr->ifr_mtu); break; case SIOCSIFFLAGS: - if (dev->if_flags & IFF_UP) { - if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0) { + if (if_getflags(dev) & IFF_UP) { + if ((if_getdrvflags(dev) & IFF_DRV_RUNNING) == 0) { mutex_lock(&mdev->state_lock); mlx4_en_start_port(dev); mutex_unlock(&mdev->state_lock); @@ -1984,7 +1983,7 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data) } } else { mutex_lock(&mdev->state_lock); - if (dev->if_drv_flags & IFF_DRV_RUNNING) { + if (if_getdrvflags(dev) & IFF_DRV_RUNNING) { mlx4_en_stop_port(dev); if_link_state_change(dev, LINK_STATE_DOWN); } @@ -2001,67 +2000,67 @@ static int mlx4_en_ioctl(struct ifnet *dev, u_long command, caddr_t data) break; case SIOCSIFCAP: mutex_lock(&mdev->state_lock); - mask = ifr->ifr_reqcap ^ dev->if_capenable; + mask = ifr->ifr_reqcap ^ if_getcapenable(dev); if (mask & IFCAP_TXCSUM) { - dev->if_capenable ^= IFCAP_TXCSUM; - dev->if_hwassist ^= (CSUM_TCP | CSUM_UDP | CSUM_IP); + if_togglecapenable(dev, IFCAP_TXCSUM); + if_togglehwassist(dev, CSUM_TCP | CSUM_UDP | CSUM_IP); - if (IFCAP_TSO4 & dev->if_capenable && - !(IFCAP_TXCSUM & dev->if_capenable)) { + if (IFCAP_TSO4 & if_getcapenable(dev) && + !(IFCAP_TXCSUM & if_getcapenable(dev))) { mask &= ~IFCAP_TSO4; - dev->if_capenable &= ~IFCAP_TSO4; - dev->if_hwassist &= ~CSUM_IP_TSO; + if_setcapenablebit(dev, 0, IFCAP_TSO4); + if_sethwassistbits(dev, 0, CSUM_IP_TSO); if_printf(dev, "tso4 disabled due to -txcsum.\n"); } } if (mask & IFCAP_TXCSUM_IPV6) { - dev->if_capenable ^= IFCAP_TXCSUM_IPV6; - dev->if_hwassist ^= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + if_togglecapenable(dev, IFCAP_TXCSUM_IPV6); + if_togglehwassist(dev, (CSUM_UDP_IPV6 | CSUM_TCP_IPV6)); - if (IFCAP_TSO6 & dev->if_capenable && - !(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) { + if (IFCAP_TSO6 & if_getcapenable(dev) && + !(IFCAP_TXCSUM_IPV6 & if_getcapenable(dev))) { mask &= ~IFCAP_TSO6; - dev->if_capenable &= ~IFCAP_TSO6; - dev->if_hwassist &= ~CSUM_IP6_TSO; + if_setcapenablebit(dev, 0, IFCAP_TSO6); + if_sethwassistbits(dev, 0, CSUM_IP6_TSO); if_printf(dev, "tso6 disabled due to -txcsum6.\n"); } } if (mask & IFCAP_RXCSUM) - dev->if_capenable ^= IFCAP_RXCSUM; + if_togglecapenable(dev, IFCAP_RXCSUM); if (mask & IFCAP_RXCSUM_IPV6) - dev->if_capenable ^= IFCAP_RXCSUM_IPV6; + if_togglecapenable(dev, IFCAP_RXCSUM_IPV6); if (mask & IFCAP_TSO4) { - if (!(IFCAP_TSO4 & dev->if_capenable) && - !(IFCAP_TXCSUM & dev->if_capenable)) { + if (!(IFCAP_TSO4 & if_getcapenable(dev)) && + !(IFCAP_TXCSUM & if_getcapenable(dev))) { if_printf(dev, "enable txcsum first.\n"); error = EAGAIN; goto out; } - dev->if_capenable ^= IFCAP_TSO4; - dev->if_hwassist ^= CSUM_IP_TSO; + if_togglecapenable(dev, IFCAP_TSO4); + if_togglehwassist(dev, CSUM_IP_TSO); } if (mask & IFCAP_TSO6) { - if (!(IFCAP_TSO6 & dev->if_capenable) && - !(IFCAP_TXCSUM_IPV6 & dev->if_capenable)) { + if (!(IFCAP_TSO6 & if_getcapenable(dev)) && + !(IFCAP_TXCSUM_IPV6 & if_getcapenable(dev))) { if_printf(dev, "enable txcsum6 first.\n"); error = EAGAIN; goto out; } - dev->if_capenable ^= IFCAP_TSO6; - dev->if_hwassist ^= CSUM_IP6_TSO; + if_togglecapenable(dev, IFCAP_TSO6); + if_togglehwassist(dev, CSUM_IP6_TSO); } if (mask & IFCAP_LRO) - dev->if_capenable ^= IFCAP_LRO; + if_togglecapenable(dev, IFCAP_LRO); if (mask & IFCAP_VLAN_HWTAGGING) - dev->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if_togglecapenable(dev, IFCAP_VLAN_HWTAGGING); if (mask & IFCAP_VLAN_HWFILTER) - dev->if_capenable ^= IFCAP_VLAN_HWFILTER; + if_togglecapenable(dev, IFCAP_VLAN_HWFILTER); if (mask & IFCAP_WOL_MAGIC) - dev->if_capenable ^= IFCAP_WOL_MAGIC; - if (dev->if_drv_flags & IFF_DRV_RUNNING) + if_togglecapenable(dev, IFCAP_WOL_MAGIC); + if (if_getdrvflags(dev) & IFF_DRV_RUNNING) mlx4_en_start_port(dev); out: mutex_unlock(&mdev->state_lock); @@ -2135,8 +2134,9 @@ out: int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, struct mlx4_en_port_profile *prof) { - struct ifnet *dev; + if_t dev; struct mlx4_en_priv *priv; + uint32_t hwassist; uint8_t dev_addr[ETHER_ADDR_LEN]; int err; int i; @@ -2148,16 +2148,16 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, kfree(priv); return -ENOMEM; } - dev->if_softc = priv; + if_setsoftc(dev, priv); if_initname(dev, "mlxen", (device_get_unit( mdev->pdev->dev.bsddev) * MLX4_MAX_PORTS) + port - 1); - dev->if_mtu = ETHERMTU; - dev->if_init = mlx4_en_open; - dev->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - dev->if_ioctl = mlx4_en_ioctl; - dev->if_transmit = mlx4_en_transmit; - dev->if_qflush = mlx4_en_qflush; - dev->if_snd.ifq_maxlen = prof->tx_ring_size; + if_setmtu(dev, ETHERMTU); + if_setinitfn(dev, mlx4_en_open); + if_setflags(dev, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); + if_setioctlfn(dev, mlx4_en_ioctl); + if_settransmitfn(dev, mlx4_en_transmit); + if_setqflushfn(dev, mlx4_en_qflush); + if_setsendqlen(dev, prof->tx_ring_size); /* * Initialize driver private data @@ -2251,30 +2251,30 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, /* * Set driver features */ - dev->if_capabilities |= IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6; - dev->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING; - dev->if_capabilities |= IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWFILTER; - dev->if_capabilities |= IFCAP_LINKSTATE | IFCAP_JUMBO_MTU; - dev->if_capabilities |= IFCAP_LRO; - dev->if_capabilities |= IFCAP_HWSTATS; + if_setcapabilitiesbit(dev, IFCAP_HWCSUM | IFCAP_HWCSUM_IPV6 | + IFCAP_VLAN_MTU | IFCAP_VLAN_HWTAGGING | + IFCAP_VLAN_HWCSUM | IFCAP_VLAN_HWFILTER | + IFCAP_LINKSTATE | IFCAP_JUMBO_MTU | + IFCAP_LRO | IFCAP_HWSTATS, 0); if (mdev->LSO_support) - dev->if_capabilities |= IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO; + if_setcapabilitiesbit(dev, IFCAP_TSO4 | IFCAP_TSO6 | IFCAP_VLAN_HWTSO, 0); /* set TSO limits so that we don't have to drop TX packets */ - dev->if_hw_tsomax = MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* hdr */; - dev->if_hw_tsomaxsegcount = MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */; - dev->if_hw_tsomaxsegsize = MLX4_EN_TX_MAX_MBUF_SIZE; + if_sethwtsomax(dev, MLX4_EN_TX_MAX_PAYLOAD_SIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) /* hdr */); + if_sethwtsomaxsegcount(dev, MLX4_EN_TX_MAX_MBUF_FRAGS - 1 /* hdr */); + if_sethwtsomaxsegsize(dev, MLX4_EN_TX_MAX_MBUF_SIZE); - dev->if_capenable = dev->if_capabilities; + if_setcapenable(dev, if_getcapabilities(dev)); - dev->if_hwassist = 0; - if (dev->if_capenable & (IFCAP_TSO4 | IFCAP_TSO6)) - dev->if_hwassist |= CSUM_TSO; - if (dev->if_capenable & IFCAP_TXCSUM) - dev->if_hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); - if (dev->if_capenable & IFCAP_TXCSUM_IPV6) - dev->if_hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + hwassist = 0; + if (if_getcapenable(dev) & (IFCAP_TSO4 | IFCAP_TSO6)) + hwassist |= CSUM_TSO; + if (if_getcapenable(dev) & IFCAP_TXCSUM) + hwassist |= (CSUM_TCP | CSUM_UDP | CSUM_IP); + if (if_getcapenable(dev) & IFCAP_TXCSUM_IPV6) + hwassist |= (CSUM_UDP_IPV6 | CSUM_TCP_IPV6); + if_sethwassist(dev, hwassist); /* Register for VLAN events */ @@ -2315,7 +2315,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); - priv->rx_mb_size = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; + priv->rx_mb_size = if_getmtu(dev) + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN; err = mlx4_SET_PORT_general(mdev->dev, priv->port, priv->rx_mb_size, prof->tx_pause, prof->tx_ppp, @@ -2346,7 +2346,7 @@ out: return err; } -static int mlx4_en_set_ring_size(struct ifnet *dev, +static int mlx4_en_set_ring_size(if_t dev, int rx_size, int tx_size) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); @@ -2420,7 +2420,7 @@ static int mlx4_en_set_tx_ring_size(SYSCTL_HANDLER_ARGS) return (error); } -static int mlx4_en_get_module_info(struct ifnet *dev, +static int mlx4_en_get_module_info(if_t dev, struct ethtool_modinfo *modinfo) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); @@ -2467,7 +2467,7 @@ static int mlx4_en_get_module_info(struct ifnet *dev, return 0; } -static int mlx4_en_get_module_eeprom(struct ifnet *dev, +static int mlx4_en_get_module_eeprom(if_t dev, struct ethtool_eeprom *ee, u8 *data) { @@ -2651,7 +2651,7 @@ static int mlx4_en_set_rx_ppp(SYSCTL_HANDLER_ARGS) static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv) { - struct ifnet *dev; + if_t dev; struct sysctl_ctx_list *ctx; struct sysctl_oid *node; struct sysctl_oid_list *node_list; @@ -2664,7 +2664,7 @@ static void mlx4_en_sysctl_conf(struct mlx4_en_priv *priv) sysctl_ctx_init(ctx); priv->conf_sysctl = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw), - OID_AUTO, dev->if_xname, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + OID_AUTO, if_name(dev), CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "mlx4 10gig ethernet"); node = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(priv->conf_sysctl), OID_AUTO, "conf", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Configuration"); @@ -2892,7 +2892,7 @@ static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv) #ifdef DEBUGNET static void -mlx4_en_debugnet_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize) +mlx4_en_debugnet_init(if_t dev, int *nrxr, int *ncl, int *clsize) { struct mlx4_en_priv *priv; @@ -2905,12 +2905,12 @@ mlx4_en_debugnet_init(struct ifnet *dev, int *nrxr, int *ncl, int *clsize) } static void -mlx4_en_debugnet_event(struct ifnet *dev, enum debugnet_ev event) +mlx4_en_debugnet_event(if_t dev, enum debugnet_ev event) { } static int -mlx4_en_debugnet_transmit(struct ifnet *dev, struct mbuf *m) +mlx4_en_debugnet_transmit(if_t dev, struct mbuf *m) { struct mlx4_en_priv *priv; int err; @@ -2927,7 +2927,7 @@ mlx4_en_debugnet_transmit(struct ifnet *dev, struct mbuf *m) } static int -mlx4_en_debugnet_poll(struct ifnet *dev, int count) +mlx4_en_debugnet_poll(if_t dev, int count) { struct mlx4_en_priv *priv; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c index 89193c68a055..b2368cc8672d 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_port.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_port.c @@ -149,7 +149,7 @@ static u64 en_stats_adder(__be64 *start, __be64 *next, int num) return ret; } -static void mlx4_en_fold_software_stats(struct ifnet *dev) +static void mlx4_en_fold_software_stats(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_dev *mdev = priv->mdev; @@ -187,7 +187,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset) struct mlx4_counter tmp_vport_stats; struct mlx4_en_stat_out_mbox *mlx4_en_stats; struct mlx4_en_stat_out_flow_control_mbox *flowstats; - struct ifnet *dev = mdev->pndev[port]; + if_t dev = mdev->pndev[port]; struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_en_vport_stats *vport_stats = &priv->vport_stats; struct mlx4_cmd_mailbox *mailbox; diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c b/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c index 5d5508eebebf..e984d156098d 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_resources.c @@ -43,7 +43,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, int user_prio, struct mlx4_qp_context *context) { struct mlx4_en_dev *mdev = priv->mdev; - struct ifnet *dev = priv->dev; + if_t dev = priv->dev; memset(context, 0, sizeof *context); context->flags = cpu_to_be32(7 << 16 | rss << MLX4_RSS_QPC_FLAG_OFFSET); @@ -76,7 +76,7 @@ void mlx4_en_fill_qp_context(struct mlx4_en_priv *priv, int size, int stride, context->cqn_send = cpu_to_be32(cqn); context->cqn_recv = cpu_to_be32(cqn); context->db_rec_addr = cpu_to_be64(priv->res.db.dma << 2); - if (!(dev->if_capabilities & IFCAP_VLAN_HWCSUM)) + if (!(if_getcapabilities(dev) & IFCAP_VLAN_HWCSUM)) context->param3 |= cpu_to_be32(1 << 30); } diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c index 56e8711c6599..5baae707413d 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_rx.c @@ -338,14 +338,14 @@ void mlx4_en_set_num_rx_rings(struct mlx4_en_dev *mdev) } } -void mlx4_en_calc_rx_buf(struct ifnet *dev) +void mlx4_en_calc_rx_buf(if_t dev) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); - int eff_mtu = dev->if_mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN + + int eff_mtu = if_getmtu(dev) + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN + MLX4_NET_IP_ALIGN; if (eff_mtu > MJUM16BYTES) { - en_err(priv, "MTU(%u) is too big\n", (unsigned)dev->if_mtu); + en_err(priv, "MTU(%u) is too big\n", (unsigned)if_getmtu(dev)); eff_mtu = MJUM16BYTES; } else if (eff_mtu > MJUM9BYTES) { eff_mtu = MJUM16BYTES; @@ -502,9 +502,9 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) #ifdef INET /* Configure lro mngr */ - if (priv->dev->if_capenable & IFCAP_LRO) { + if (if_getcapenable(priv->dev) & IFCAP_LRO) { if (tcp_lro_init(&ring->lro)) - priv->dev->if_capenable &= ~IFCAP_LRO; + if_setcapenablebit(priv->dev, 0, IFCAP_LRO); else ring->lro.ifp = priv->dev; } @@ -735,7 +735,7 @@ mlx4_en_rss_hash(__be16 status, int udp_rss) * The following calc ensures that when factor==1, it means we are aligned to 64B * and we get the real cqe data*/ #define CQE_FACTOR_INDEX(index, factor) (((index) << (factor)) + (factor)) -int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) +int mlx4_en_process_rx_cq(if_t dev, struct mlx4_en_cq *cq, int budget) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); struct mlx4_cqe *cqe; @@ -806,7 +806,7 @@ int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) mb->m_pkthdr.ether_vtag = be16_to_cpu(cqe->sl_vid); mb->m_flags |= M_VLANTAG; } - if (likely(dev->if_capenable & + if (likely(if_getcapenable(dev) & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) && (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) && (cqe->checksum == cpu_to_be16(0xffff))) { @@ -823,7 +823,7 @@ int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) */ #ifdef INET if (mlx4_en_can_lro(cqe->status) && - (dev->if_capenable & IFCAP_LRO)) { + (if_getcapenable(dev) & IFCAP_LRO)) { if (ring->lro.lro_cnt != 0 && tcp_lro_rx(&ring->lro, mb, 0) == 0) goto next; @@ -838,7 +838,7 @@ int mlx4_en_process_rx_cq(struct ifnet *dev, struct mlx4_en_cq *cq, int budget) } /* Push it up the stack */ - dev->if_input(dev, mb); + if_input(dev, mb); next: ++cons_index; @@ -866,7 +866,7 @@ out: /* Rx CQ polling - called by NAPI */ static int mlx4_en_poll_rx_cq(struct mlx4_en_cq *cq, int budget) { - struct ifnet *dev = cq->dev; + if_t dev = cq->dev; struct epoch_tracker et; int done; @@ -912,7 +912,7 @@ void mlx4_en_rx_que(void *context, int pending) while (mlx4_en_poll_rx_cq(cq, MLX4_EN_RX_BUDGET) == MLX4_EN_RX_BUDGET); NET_EPOCH_EXIT(et); - mlx4_en_arm_cq(cq->dev->if_softc, cq); + mlx4_en_arm_cq(if_getsoftc(cq->dev), cq); } diff --git a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c index 7cff1a224e9a..ee8ed0da240d 100644 --- a/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c +++ b/sys/dev/mlx4/mlx4_en/mlx4_en_tx.c @@ -308,7 +308,7 @@ done: return (tx_info->nr_txbb); } -int mlx4_en_free_tx_buf(struct ifnet *dev, struct mlx4_en_tx_ring *ring) +int mlx4_en_free_tx_buf(if_t dev, struct mlx4_en_tx_ring *ring) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); int cnt = 0; @@ -344,7 +344,7 @@ mlx4_en_tx_ring_is_full(struct mlx4_en_tx_ring *ring) return (wqs < (HEADROOM + (2 * MLX4_EN_TX_WQE_MAX_WQEBBS))); } -static int mlx4_en_process_tx_cq(struct ifnet *dev, +static int mlx4_en_process_tx_cq(if_t dev, struct mlx4_en_cq *cq) { struct mlx4_en_priv *priv = mlx4_netdev_priv(dev); @@ -604,7 +604,7 @@ static void hashrandom_init(void *arg) } SYSINIT(hashrandom_init, SI_SUB_RANDOM, SI_ORDER_ANY, &hashrandom_init, NULL); *** 199 LINES SKIPPED ***