1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

DrvAPI: Trivial mechanical conversions for various drivers

Mechanically convert the following drivers, with trivial changes:
* ipw(4)
* igc(4)
* enetc(4)
* malo(4)
* nfe(4)
* bxe(4)
* awg(4)
* otus(4)
* rtwn(4)
* bnxt(4)
* ath(4)

Sponsored by:	Juniper Networks, Inc.
This commit is contained in:
Justin Hibbits 2022-08-19 15:48:39 -04:00
parent 79422a716d
commit ec22a3a259
17 changed files with 49 additions and 48 deletions

View File

@ -442,7 +442,7 @@ awg_setup_rxfilter(struct awg_softc *sc)
val |= HASH_MULTICAST;
/* Write our unicast address */
eaddr = IF_LLADDR(ifp);
eaddr = if_getlladdr(ifp);
machi = (eaddr[5] << 8) | eaddr[4];
maclo = (eaddr[3] << 24) | (eaddr[2] << 16) | (eaddr[1] << 8) |
(eaddr[0] << 0);

View File

@ -242,7 +242,7 @@ ath_ioctl(struct ieee80211com *ic, u_long cmd, void *data)
switch (cmd) {
case SIOCGATHSTATS: {
struct ieee80211vap *vap;
struct ifnet *ifp;
if_t ifp;
const HAL_RATE_TABLE *rt;
/* NB: embed these numbers to get a consistent view */

View File

@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_llc.h>
#include <net/if_var.h>
#include <net80211/ieee80211_var.h>
#include <net80211/ieee80211_regdomain.h>

View File

@ -105,7 +105,7 @@ extern void ath_tx_update_tim(struct ath_softc *sc,
* if_ath.c and do the ath_start() call there. Once that's done,
* we can kill this.
*/
extern void ath_start(struct ifnet *ifp);
extern void ath_start(if_t ifp);
extern void ath_start_task(void *arg, int npending);
extern void ath_tx_dump(struct ath_softc *sc, struct ath_txq *txq);

View File

@ -290,7 +290,7 @@ ath_tdma_config(struct ath_softc *sc, struct ieee80211vap *vap)
/* XXX short preamble assumed */
/* XXX non-11n rate assumed */
sc->sc_tdmaguard = ath_hal_computetxtime(ah, sc->sc_currates,
vap->iv_ifp->if_mtu + IEEE80211_MAXOVERHEAD, rix, AH_TRUE,
if_getmtu(vap->iv_ifp) + IEEE80211_MAXOVERHEAD, rix, AH_TRUE,
AH_TRUE);
}

View File

@ -309,7 +309,7 @@ bnxt_mgmt_get_dev_info(struct cdev *dev, u_long cmd, caddr_t data,
}
if_t ifp = iflib_get_ifp(softc->ctx);
dev_info.nic_info.mtu = ifp->if_mtu;
dev_info.nic_info.mtu = if_getmtu(ifp);
memcpy(dev_info.nic_info.mac, softc->func.mac_addr, ETHER_ADDR_LEN);
if (pci_find_cap(softc->dev, PCIY_EXPRESS, &capreg)) {

View File

@ -1597,7 +1597,7 @@ bnxt_attach_post(if_ctx_t ctx)
bnxt_add_media_types(softc);
ifmedia_set(softc->media, IFM_ETHER | IFM_AUTO);
softc->scctx->isc_max_frame_size = ifp->if_mtu + ETHER_HDR_LEN +
softc->scctx->isc_max_frame_size = if_getmtu(ifp) + ETHER_HDR_LEN +
ETHER_CRC_LEN;
softc->rx_buf_size = min(softc->scctx->isc_max_frame_size, BNXT_PAGE_SIZE);
@ -2156,7 +2156,7 @@ bnxt_promisc_set(if_ctx_t ctx, int flags)
if_t ifp = iflib_get_ifp(ctx);
int rc;
if (ifp->if_flags & IFF_ALLMULTI ||
if (if_getflags(ifp) & IFF_ALLMULTI ||
if_llmaddr_count(ifp) > BNXT_MAX_MC_ADDRS)
softc->vnic_info.rx_mask |=
HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
@ -2164,7 +2164,7 @@ bnxt_promisc_set(if_ctx_t ctx, int flags)
softc->vnic_info.rx_mask &=
~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST;
if (ifp->if_flags & IFF_PROMISC)
if (if_getflags(ifp) & IFF_PROMISC)
softc->vnic_info.rx_mask |=
HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_PROMISCUOUS |
HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ANYVLAN_NONVLAN;

View File

@ -4392,7 +4392,7 @@ bxe_nic_unload(struct bxe_softc *sc,
* the user runs "ifconfig bxe media ..." or "ifconfig bxe mediaopt ...".
*/
static int
bxe_ifmedia_update(struct ifnet *ifp)
bxe_ifmedia_update(if_t ifp)
{
struct bxe_softc *sc = (struct bxe_softc *)if_getsoftc(ifp);
struct ifmedia *ifm;
@ -4425,7 +4425,7 @@ bxe_ifmedia_update(struct ifnet *ifp)
* Called by the OS to get the current media status (i.e. link, speed, etc.).
*/
static void
bxe_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr)
bxe_ifmedia_status(if_t ifp, struct ifmediareq *ifmr)
{
struct bxe_softc *sc = if_getsoftc(ifp);
@ -4441,7 +4441,7 @@ bxe_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr)
ifmr->ifm_active = IFM_ETHER;
/* Report link down if the driver isn't running. */
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) {
ifmr->ifm_active |= IFM_NONE;
BLOGD(sc, DBG_PHY, "in %s : nic still not loaded fully\n", __func__);
BLOGD(sc, DBG_PHY, "in %s : link_up (1) : %d\n",
@ -5753,7 +5753,7 @@ bxe_tx_mq_start_deferred(void *arg,
/* Multiqueue (TSS) dispatch routine. */
static int
bxe_tx_mq_start(struct ifnet *ifp,
bxe_tx_mq_start(if_t ifp,
struct mbuf *m)
{
struct bxe_softc *sc = if_getsoftc(ifp);
@ -5786,7 +5786,7 @@ bxe_tx_mq_start(struct ifnet *ifp,
}
static void
bxe_mq_flush(struct ifnet *ifp)
bxe_mq_flush(if_t ifp)
{
struct bxe_softc *sc = if_getsoftc(ifp);
struct bxe_fastpath *fp;
@ -19099,7 +19099,7 @@ bxe_add_cdev(struct bxe_softc *sc)
}
sc->ioctl_dev = make_dev(&bxe_cdevsw,
sc->ifp->if_dunit,
if_getdunit(sc->ifp),
UID_ROOT,
GID_WHEEL,
0600,
@ -19421,7 +19421,7 @@ bxe_eioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
#ifdef DEBUGNET
static void
bxe_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
bxe_debugnet_init(if_t ifp, int *nrxr, int *ncl, int *clsize)
{
struct bxe_softc *sc;
@ -19434,12 +19434,12 @@ bxe_debugnet_init(struct ifnet *ifp, int *nrxr, int *ncl, int *clsize)
}
static void
bxe_debugnet_event(struct ifnet *ifp __unused, enum debugnet_ev event __unused)
bxe_debugnet_event(if_t ifp __unused, enum debugnet_ev event __unused)
{
}
static int
bxe_debugnet_transmit(struct ifnet *ifp, struct mbuf *m)
bxe_debugnet_transmit(if_t ifp, struct mbuf *m)
{
struct bxe_softc *sc;
int error;
@ -19456,7 +19456,7 @@ bxe_debugnet_transmit(struct ifnet *ifp, struct mbuf *m)
}
static int
bxe_debugnet_poll(struct ifnet *ifp, int count)
bxe_debugnet_poll(if_t ifp, int count)
{
struct bxe_softc *sc;
int i;

View File

@ -581,7 +581,7 @@ enetc_get_hwaddr(struct enetc_softc *sc)
static void
enetc_set_hwaddr(struct enetc_softc *sc)
{
struct ifnet *ifp;
if_t ifp;
uint16_t high;
uint32_t low;
uint8_t *hwaddr;
@ -823,7 +823,7 @@ static void
enetc_setup_multicast(if_ctx_t ctx)
{
struct enetc_softc *sc;
struct ifnet *ifp;
if_t ifp;
uint64_t bitmap = 0;
uint8_t revid;
@ -905,7 +905,7 @@ enetc_init(if_ctx_t ctx)
{
struct enetc_softc *sc;
struct mii_data *miid;
struct ifnet *ifp;
if_t ifp;
uint16_t max_frame_length;
int baudrate;
@ -1335,7 +1335,7 @@ static uint64_t
enetc_get_counter(if_ctx_t ctx, ift_counter cnt)
{
struct enetc_softc *sc;
struct ifnet *ifp;
if_t ifp;
sc = iflib_get_softc(ctx);
ifp = iflib_get_ifp(ctx);
@ -1481,7 +1481,7 @@ enetc_media_change(if_t ifp)
struct enetc_softc *sc;
struct mii_data *miid;
sc = iflib_get_softc(ifp->if_softc);
sc = iflib_get_softc(if_getsoftc(ifp));
miid = device_get_softc(sc->miibus);
mii_mediachg(miid);
@ -1494,7 +1494,7 @@ enetc_media_status(if_t ifp, struct ifmediareq* ifmr)
struct enetc_softc *sc;
struct mii_data *miid;
sc = iflib_get_softc(ifp->if_softc);
sc = iflib_get_softc(if_getsoftc(ifp));
miid = device_get_softc(sc->miibus);
mii_pollstat(miid);
@ -1515,7 +1515,7 @@ enetc_fixed_media_status(if_t ifp, struct ifmediareq* ifmr)
{
struct enetc_softc *sc;
sc = iflib_get_softc(ifp->if_softc);
sc = iflib_get_softc(if_getsoftc(ifp));
ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
ifmr->ifm_active = sc->fixed_ifmedia.ifm_cur->ifm_media;

View File

@ -797,7 +797,7 @@ igc_if_init(if_ctx_t ctx)
{
struct igc_adapter *adapter = iflib_get_softc(ctx);
if_softc_ctx_t scctx = adapter->shared;
struct ifnet *ifp = iflib_get_ifp(ctx);
if_t ifp = iflib_get_ifp(ctx);
struct igc_tx_queue *tx_que;
int i;
@ -1079,7 +1079,7 @@ static int
igc_if_set_promisc(if_ctx_t ctx, int flags)
{
struct igc_adapter *adapter = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
if_t ifp = iflib_get_ifp(ctx);
u32 reg_rctl;
int mcnt = 0;
@ -1133,7 +1133,7 @@ static void
igc_if_multi_set(if_ctx_t ctx)
{
struct igc_adapter *adapter = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
if_t ifp = iflib_get_ifp(ctx);
u8 *mta; /* Multicast array memory */
u32 reg_rctl = 0;
int mcnt = 0;
@ -1762,7 +1762,7 @@ igc_initialize_rss_mapping(struct igc_adapter *adapter)
static int
igc_setup_interface(if_ctx_t ctx)
{
struct ifnet *ifp = iflib_get_ifp(ctx);
if_t ifp = iflib_get_ifp(ctx);
struct igc_adapter *adapter = iflib_get_softc(ctx);
if_softc_ctx_t scctx = adapter->shared;
@ -1991,7 +1991,7 @@ igc_initialize_receive_unit(if_ctx_t ctx)
{
struct igc_adapter *adapter = iflib_get_softc(ctx);
if_softc_ctx_t scctx = adapter->shared;
struct ifnet *ifp = iflib_get_ifp(ctx);
if_t ifp = iflib_get_ifp(ctx);
struct igc_hw *hw = &adapter->hw;
struct igc_rx_queue *que;
int i;
@ -2060,7 +2060,7 @@ igc_initialize_receive_unit(if_ctx_t ctx)
}
psize = scctx->isc_max_frame_size;
/* are we on a vlan? */
if (ifp->if_vlantrunk != NULL)
if (if_vlantrunkinuse(ifp))
psize += VLAN_TAG_SIZE;
IGC_WRITE_REG(&adapter->hw, IGC_RLPML, psize);
} else {
@ -2386,7 +2386,7 @@ static uint64_t
igc_if_get_counter(if_ctx_t ctx, ift_counter cnt)
{
struct igc_adapter *adapter = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
if_t ifp = iflib_get_ifp(ctx);
switch (cnt) {
case IFCOUNTER_COLLISIONS:
@ -2903,7 +2903,7 @@ static void
igc_print_debug_info(struct igc_adapter *adapter)
{
device_t dev = iflib_get_dev(adapter->ctx);
struct ifnet *ifp = iflib_get_ifp(adapter->ctx);
if_t ifp = iflib_get_ifp(adapter->ctx);
struct tx_ring *txr = &adapter->tx_queues->txr;
struct rx_ring *rxr = &adapter->rx_queues->rxr;

View File

@ -336,7 +336,7 @@ struct igc_rx_queue {
/* Our adapter structure */
struct igc_adapter {
struct ifnet *ifp;
if_t ifp;
struct igc_hw hw;
if_softc_ctx_t shared;

View File

@ -115,7 +115,7 @@ static struct ieee80211vap *ipw_vap_create(struct ieee80211com *,
static void ipw_vap_delete(struct ieee80211vap *);
static int ipw_dma_alloc(struct ipw_softc *);
static void ipw_release(struct ipw_softc *);
static void ipw_media_status(struct ifnet *, struct ifmediareq *);
static void ipw_media_status(if_t, struct ifmediareq *);
static int ipw_newstate(struct ieee80211vap *, enum ieee80211_state, int);
static uint16_t ipw_read_prom_word(struct ipw_softc *, uint8_t);
static uint16_t ipw_read_chanmask(struct ipw_softc *);
@ -833,9 +833,9 @@ ipw_cvtrate(int ipwrate)
* value here.
*/
static void
ipw_media_status(struct ifnet *ifp, struct ifmediareq *imr)
ipw_media_status(if_t ifp, struct ifmediareq *imr)
{
struct ieee80211vap *vap = ifp->if_softc;
struct ieee80211vap *vap = if_getsoftc(ifp);
struct ieee80211com *ic = vap->iv_ic;
struct ipw_softc *sc = ic->ic_softc;

View File

@ -1743,7 +1743,7 @@ malo_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
DPRINTF(sc, MALO_DEBUG_STATE,
"%s: %s(RUN): iv_flags 0x%08x bintvl %d bssid %s "
"capinfo 0x%04x chan %d associd 0x%x mode %d rate %d\n",
vap->iv_ifp->if_xname, __func__, vap->iv_flags,
if_name(vap->iv_ifp), __func__, vap->iv_flags,
ni->ni_intval, ether_sprintf(ni->ni_bssid), ni->ni_capinfo,
ieee80211_chan2ieee(ic, ic->ic_curchan),
ni->ni_associd, mode, tp->ucastrate);

View File

@ -104,7 +104,7 @@ struct nfe_hw_stats {
};
struct nfe_softc {
struct ifnet *nfe_ifp;
if_t nfe_ifp;
device_t nfe_dev;
uint16_t nfe_devid;
uint16_t nfe_revid;

View File

@ -174,7 +174,7 @@ void otus_sub_rxeof(struct otus_softc *, uint8_t *, int,
static int otus_tx(struct otus_softc *, struct ieee80211_node *,
struct mbuf *, struct otus_data *,
const struct ieee80211_bpf_params *);
int otus_ioctl(struct ifnet *, u_long, caddr_t);
int otus_ioctl(if_t, u_long, caddr_t);
int otus_set_multi(struct otus_softc *);
static int otus_updateedca(struct ieee80211com *);
static void otus_updateedca_locked(struct otus_softc *);

View File

@ -101,11 +101,11 @@ r12a_ioctl_net(struct ieee80211com *ic, u_long cmd, void *data)
IEEE80211_LOCK(ic); /* XXX */
TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
struct ifnet *ifp = vap->iv_ifp;
if_t ifp = vap->iv_ifp;
ifp->if_capenable &=
~(IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
ifp->if_capenable |= rxmask;
if_setcapenablebit(ifp, 0,
IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
if_setcapenablebit(ifp, rxmask, 0);
}
IEEE80211_UNLOCK(ic);
break;

View File

@ -111,14 +111,14 @@ void
r12a_vap_preattach(struct rtwn_softc *sc, struct ieee80211vap *vap)
{
struct r12a_softc *rs = sc->sc_priv;
struct ifnet *ifp = vap->iv_ifp;
if_t ifp = vap->iv_ifp;
ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6;
if_setcapabilities(ifp, IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6);
RTWN_LOCK(sc);
if (rs->rs_flags & R12A_RXCKSUM_EN)
ifp->if_capenable |= IFCAP_RXCSUM;
if_setcapenablebit(ifp, IFCAP_RXCSUM, 0);
if (rs->rs_flags & R12A_RXCKSUM6_EN)
ifp->if_capenable |= IFCAP_RXCSUM_IPV6;
if_setcapenablebit(ifp, IFCAP_RXCSUM_IPV6, 0);
RTWN_UNLOCK(sc);
}