Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146203729
D37817.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
13 KB
Referenced Files
None
Subscribers
None
D37817.id.diff
View Options
diff --git a/sys/dev/sfxge/sfxge.h b/sys/dev/sfxge/sfxge.h
--- a/sys/dev/sfxge/sfxge.h
+++ b/sys/dev/sfxge/sfxge.h
@@ -270,7 +270,7 @@
struct sx softc_lock;
char softc_lock_name[SFXGE_LOCK_NAME_MAX];
enum sfxge_softc_state init_state;
- struct ifnet *ifnet;
+ if_t ifnet;
unsigned int if_flags;
struct sysctl_oid *stats_node;
#if EFSYS_OPT_QSTATS
@@ -338,7 +338,7 @@
#define SFXGE_LINK_UP(sc) \
((sc)->port.link_mode != EFX_LINK_DOWN && \
(sc)->port.link_mode != EFX_LINK_UNKNOWN)
-#define SFXGE_RUNNING(sc) ((sc)->ifnet->if_drv_flags & IFF_DRV_RUNNING)
+#define SFXGE_RUNNING(sc) (if_getdrvflags((sc)->ifnet) & IFF_DRV_RUNNING)
#define SFXGE_PARAM(_name) "hw.sfxge." #_name
@@ -404,7 +404,7 @@
efx_link_mode_t mode);
extern int sfxge_mac_filter_set(struct sfxge_softc *sc);
extern int sfxge_port_ifmedia_init(struct sfxge_softc *sc);
-extern uint64_t sfxge_get_counter(struct ifnet *ifp, ift_counter c);
+extern uint64_t sfxge_get_counter(if_t ifp, ift_counter c);
#define SFXGE_MAX_MTU (9 * 1024)
diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c
--- a/sys/dev/sfxge/sfxge.c
+++ b/sys/dev/sfxge/sfxge.c
@@ -256,8 +256,7 @@
sc->init_state = SFXGE_STARTED;
/* Tell the stack we're running. */
- sc->ifnet->if_drv_flags |= IFF_DRV_RUNNING;
- sc->ifnet->if_drv_flags &= ~IFF_DRV_OACTIVE;
+ if_setdrvflagbits(sc->ifnet, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
return (0);
@@ -321,7 +320,7 @@
efx_nic_fini(sc->enp);
- sc->ifnet->if_drv_flags &= ~IFF_DRV_RUNNING;
+ if_setdrvflagbits(sc->ifnet, 0, IFF_DRV_RUNNING);
}
static int
@@ -384,7 +383,7 @@
}
static int
-sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data)
+sfxge_if_ioctl(if_t ifp, unsigned long command, caddr_t data)
{
struct sfxge_softc *sc;
struct ifreq *ifr;
@@ -392,52 +391,52 @@
int error;
ifr = (struct ifreq *)data;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
error = 0;
switch (command) {
case SIOCSIFFLAGS:
SFXGE_ADAPTER_LOCK(sc);
- if (ifp->if_flags & IFF_UP) {
- if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
- if ((ifp->if_flags ^ sc->if_flags) &
+ if (if_getflags(ifp) & IFF_UP) {
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
+ if ((if_getflags(ifp) ^ sc->if_flags) &
(IFF_PROMISC | IFF_ALLMULTI)) {
sfxge_mac_filter_set(sc);
}
} else
sfxge_start(sc);
} else
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
sfxge_stop(sc);
- sc->if_flags = ifp->if_flags;
+ sc->if_flags = if_getflags(ifp);
SFXGE_ADAPTER_UNLOCK(sc);
break;
case SIOCSIFMTU:
- if (ifr->ifr_mtu == ifp->if_mtu) {
+ if (ifr->ifr_mtu == if_getmtu(ifp)) {
/* Nothing to do */
error = 0;
} else if (ifr->ifr_mtu > SFXGE_MAX_MTU) {
error = EINVAL;
- } else if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
- ifp->if_mtu = ifr->ifr_mtu;
+ } else if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) {
+ if_setmtu(ifp, ifr->ifr_mtu);
error = 0;
} else {
/* Restart required */
SFXGE_ADAPTER_LOCK(sc);
sfxge_stop(sc);
- ifp->if_mtu = ifr->ifr_mtu;
+ if_setmtu(ifp, ifr->ifr_mtu);
error = sfxge_start(sc);
SFXGE_ADAPTER_UNLOCK(sc);
if (error != 0) {
- ifp->if_flags &= ~IFF_UP;
- ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+ if_setflagbits(ifp, 0, IFF_UP);
+ if_setdrvflagbits(ifp, 0, IFF_DRV_RUNNING);
if_down(ifp);
}
}
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
- if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
sfxge_mac_filter_set(sc);
break;
case SIOCSIFCAP:
@@ -448,7 +447,7 @@
SFXGE_ADAPTER_LOCK(sc);
/* Capabilities to be changed in accordance with request */
- capchg_mask = ifp->if_capenable ^ reqcap;
+ capchg_mask = if_getcapenable(ifp) ^ reqcap;
/*
* The networking core already rejects attempts to
@@ -456,11 +455,11 @@
* to reject attempts to disable capabilities that we
* can't (yet) disable.
*/
- KASSERT((reqcap & ~ifp->if_capabilities) == 0,
+ KASSERT((reqcap & ~if_getcapabilities(ifp)) == 0,
("Unsupported capabilities 0x%x requested 0x%x vs "
"supported 0x%x",
- reqcap & ~ifp->if_capabilities,
- reqcap , ifp->if_capabilities));
+ reqcap & ~if_getcapabilities(ifp),
+ reqcap , if_getcapabilities(ifp)));
if (capchg_mask & SFXGE_CAP_FIXED) {
error = EINVAL;
SFXGE_ADAPTER_UNLOCK(sc);
@@ -484,9 +483,9 @@
}
if (reqcap & IFCAP_TXCSUM) {
- ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP);
+ if_sethwassistbits(ifp, (CSUM_IP | CSUM_TCP | CSUM_UDP), 0);
} else {
- ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP);
+ if_sethwassistbits(ifp, 0, (CSUM_IP | CSUM_TCP | CSUM_UDP));
if (reqcap & IFCAP_TSO4) {
reqcap &= ~IFCAP_TSO4;
if_printf(ifp,
@@ -494,9 +493,9 @@
}
}
if (reqcap & IFCAP_TXCSUM_IPV6) {
- ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
+ if_sethwassistbits(ifp, (CSUM_TCP_IPV6 | CSUM_UDP_IPV6), 0);
} else {
- ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
+ if_sethwassistbits(ifp, 0, (CSUM_TCP_IPV6 | CSUM_UDP_IPV6));
if (reqcap & IFCAP_TSO6) {
reqcap &= ~IFCAP_TSO6;
if_printf(ifp,
@@ -512,7 +511,7 @@
* but both bits are set in IPv4 and IPv6 mbufs.
*/
- ifp->if_capenable = reqcap;
+ if_setcapenable(ifp, reqcap);
SFXGE_ADAPTER_UNLOCK(sc);
break;
@@ -567,9 +566,9 @@
}
static void
-sfxge_ifnet_fini(struct ifnet *ifp)
+sfxge_ifnet_fini(if_t ifp)
{
- struct sfxge_softc *sc = ifp->if_softc;
+ struct sfxge_softc *sc = if_getsoftc(ifp);
SFXGE_ADAPTER_LOCK(sc);
sfxge_stop(sc);
@@ -581,7 +580,7 @@
}
static int
-sfxge_ifnet_init(struct ifnet *ifp, struct sfxge_softc *sc)
+sfxge_ifnet_init(if_t ifp, struct sfxge_softc *sc)
{
const efx_nic_cfg_t *encp = efx_nic_cfg_get(sc->enp);
device_t dev;
@@ -591,35 +590,35 @@
sc->ifnet = ifp;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
- ifp->if_init = sfxge_if_init;
- ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
- ifp->if_ioctl = sfxge_if_ioctl;
+ if_setinitfn(ifp, sfxge_if_init);
+ if_setsoftc(ifp, sc);
+ if_setflags(ifp, IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST);
+ if_setioctlfn(ifp, sfxge_if_ioctl);
- ifp->if_capabilities = SFXGE_CAP;
- ifp->if_capenable = SFXGE_CAP_ENABLE;
- ifp->if_hw_tsomax = SFXGE_TSO_MAX_SIZE;
- ifp->if_hw_tsomaxsegcount = SFXGE_TX_MAPPING_MAX_SEG;
- ifp->if_hw_tsomaxsegsize = PAGE_SIZE;
+ if_setcapabilities(ifp, SFXGE_CAP);
+ if_setcapenable(ifp, SFXGE_CAP_ENABLE);
+ if_sethwtsomax(ifp, SFXGE_TSO_MAX_SIZE);
+ if_sethwtsomaxsegcount(ifp, SFXGE_TX_MAPPING_MAX_SEG);
+ if_sethwtsomaxsegsize(ifp, PAGE_SIZE);
#ifdef SFXGE_LRO
- ifp->if_capabilities |= IFCAP_LRO;
- ifp->if_capenable |= IFCAP_LRO;
+ if_setcapabilitiesbit(ifp, IFCAP_LRO, 0);
+ if_setcapenablebit(ifp, IFCAP_LRO, 0);
#endif
if (encp->enc_hw_tx_insert_vlan_enabled) {
- ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING;
- ifp->if_capenable |= IFCAP_VLAN_HWTAGGING;
+ if_setcapabilitiesbit(ifp, IFCAP_VLAN_HWTAGGING, 0);
+ if_setcapenablebit(ifp, IFCAP_VLAN_HWTAGGING, 0);
}
- ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO |
- CSUM_TCP_IPV6 | CSUM_UDP_IPV6;
+ if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO |
+ CSUM_TCP_IPV6 | CSUM_UDP_IPV6, 0);
ether_ifattach(ifp, encp->enc_mac_addr);
- ifp->if_transmit = sfxge_if_transmit;
- ifp->if_qflush = sfxge_if_qflush;
+ if_settransmitfn(ifp, sfxge_if_transmit);
+ if_setqflushfn(ifp, sfxge_if_qflush);
- ifp->if_get_counter = sfxge_get_counter;
+ if_setgetcounterfn(ifp, sfxge_get_counter);
DBGPRINT(sc->dev, "ifmedia_init");
if ((rc = sfxge_port_ifmedia_init(sc)) != 0)
@@ -1076,7 +1075,7 @@
sfxge_attach(device_t dev)
{
struct sfxge_softc *sc;
- struct ifnet *ifp;
+ if_t ifp;
int error;
sc = device_get_softc(dev);
diff --git a/sys/dev/sfxge/sfxge_port.c b/sys/dev/sfxge/sfxge_port.c
--- a/sys/dev/sfxge/sfxge_port.c
+++ b/sys/dev/sfxge/sfxge_port.c
@@ -102,9 +102,9 @@
}
uint64_t
-sfxge_get_counter(struct ifnet *ifp, ift_counter c)
+sfxge_get_counter(if_t ifp, ift_counter c)
{
- struct sfxge_softc *sc = ifp->if_softc;
+ struct sfxge_softc *sc = if_getsoftc(ifp);
uint64_t *mac_stats;
uint64_t val;
@@ -327,7 +327,7 @@
/* Push link state update to the OS */
link_state = (SFXGE_LINK_UP(sc) ? LINK_STATE_UP : LINK_STATE_DOWN);
- sc->ifnet->if_baudrate = sfxge_link_baudrate[port->link_mode];
+ if_setbaudrate(sc->ifnet, sfxge_link_baudrate[port->link_mode]);
if_link_state_change(sc->ifnet, link_state);
}
@@ -373,7 +373,7 @@
static int
sfxge_mac_multicast_list_set(struct sfxge_softc *sc)
{
- struct ifnet *ifp = sc->ifnet;
+ if_t ifp = sc->ifnet;
struct sfxge_port *port = &sc->port;
int rc = 0;
@@ -400,21 +400,21 @@
static int
sfxge_mac_filter_set_locked(struct sfxge_softc *sc)
{
- struct ifnet *ifp = sc->ifnet;
+ if_t ifp = sc->ifnet;
struct sfxge_port *port = &sc->port;
boolean_t all_mulcst;
int rc;
mtx_assert(&port->lock, MA_OWNED);
- all_mulcst = !!(ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI));
+ all_mulcst = !!(if_getflags(ifp) & (IFF_PROMISC | IFF_ALLMULTI));
rc = sfxge_mac_multicast_list_set(sc);
/* Fallback to all multicast if cannot set multicast list */
if (rc != 0)
all_mulcst = B_TRUE;
- rc = efx_mac_filter_set(sc->enp, !!(ifp->if_flags & IFF_PROMISC),
+ rc = efx_mac_filter_set(sc->enp, !!(if_getflags(ifp) & IFF_PROMISC),
(port->mcast_count > 0), all_mulcst, B_TRUE);
return (rc);
@@ -483,7 +483,7 @@
{
uint8_t mac_addr[ETHER_ADDR_LEN];
struct epoch_tracker et;
- struct ifnet *ifp = sc->ifnet;
+ if_t ifp = sc->ifnet;
struct sfxge_port *port;
efx_nic_t *enp;
size_t pdu;
@@ -507,7 +507,7 @@
goto fail;
/* Set the SDU */
- pdu = EFX_MAC_PDU(ifp->if_mtu);
+ pdu = EFX_MAC_PDU(if_getmtu(ifp));
if ((rc = efx_mac_pdu_set(enp, pdu)) != 0)
goto fail2;
@@ -517,8 +517,7 @@
/* Set the unicast address */
NET_EPOCH_ENTER(et);
- bcopy(LLADDR((struct sockaddr_dl *)ifp->if_addr->ifa_addr),
- mac_addr, sizeof(mac_addr));
+ bcopy(if_getlladdr(ifp), mac_addr, sizeof(mac_addr));
NET_EPOCH_EXIT(et);
if ((rc = efx_mac_addr_set(enp, mac_addr)) != 0)
goto fail4;
@@ -860,13 +859,13 @@
};
static void
-sfxge_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
+sfxge_media_status(if_t ifp, struct ifmediareq *ifmr)
{
struct sfxge_softc *sc;
efx_phy_media_type_t medium_type;
efx_link_mode_t mode;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
SFXGE_ADAPTER_LOCK(sc);
ifmr->ifm_status = IFM_AVALID;
@@ -976,14 +975,14 @@
}
static int
-sfxge_media_change(struct ifnet *ifp)
+sfxge_media_change(if_t ifp)
{
struct sfxge_softc *sc;
struct ifmedia_entry *ifm;
int rc;
uint32_t phy_cap_mask;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
ifm = sc->media.ifm_cur;
SFXGE_ADAPTER_LOCK(sc);
diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c
--- a/sys/dev/sfxge/sfxge_rx.c
+++ b/sys/dev/sfxge/sfxge_rx.c
@@ -324,11 +324,11 @@
static void __sfxge_rx_deliver(struct sfxge_softc *sc, struct mbuf *m)
{
- struct ifnet *ifp = sc->ifnet;
+ if_t ifp = sc->ifnet;
m->m_pkthdr.rcvif = ifp;
m->m_pkthdr.csum_data = 0xffff;
- ifp->if_input(ifp, m);
+ if_input(ifp, m);
}
static void
@@ -812,7 +812,7 @@
sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop)
{
struct sfxge_softc *sc = rxq->sc;
- int if_capenable = sc->ifnet->if_capenable;
+ int if_capenable = if_getcapenable(sc->ifnet);
int lro_enabled = if_capenable & IFCAP_LRO;
unsigned int index;
struct sfxge_evq *evq __diagused;
@@ -1094,7 +1094,7 @@
return (rc);
encp = efx_nic_cfg_get(sc->enp);
- sc->rx_buffer_size = EFX_MAC_PDU(sc->ifnet->if_mtu);
+ sc->rx_buffer_size = EFX_MAC_PDU(if_getmtu(sc->ifnet));
/* Calculate the receive packet buffer size. */
sc->rx_prefix_size = encp->enc_rx_prefix_size;
diff --git a/sys/dev/sfxge/sfxge_tx.h b/sys/dev/sfxge/sfxge_tx.h
--- a/sys/dev/sfxge/sfxge_tx.h
+++ b/sys/dev/sfxge/sfxge_tx.h
@@ -244,7 +244,7 @@
extern void sfxge_tx_stop(struct sfxge_softc *sc);
extern void sfxge_tx_qcomplete(struct sfxge_txq *txq, struct sfxge_evq *evq);
extern void sfxge_tx_qflush_done(struct sfxge_txq *txq);
-extern void sfxge_if_qflush(struct ifnet *ifp);
-extern int sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m);
+extern void sfxge_if_qflush(if_t ifp);
+extern int sfxge_if_transmit(if_t ifp, struct mbuf *m);
#endif
diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c
--- a/sys/dev/sfxge/sfxge_tx.c
+++ b/sys/dev/sfxge/sfxge_tx.c
@@ -780,12 +780,12 @@
}
void
-sfxge_if_qflush(struct ifnet *ifp)
+sfxge_if_qflush(if_t ifp)
{
struct sfxge_softc *sc;
unsigned int i;
- sc = ifp->if_softc;
+ sc = if_getsoftc(ifp);
for (i = 0; i < sc->txq_count; i++)
sfxge_tx_qdpl_flush(sc->txq[i]);
@@ -872,13 +872,13 @@
* TX start -- called by the stack.
*/
int
-sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m)
+sfxge_if_transmit(if_t ifp, struct mbuf *m)
{
struct sfxge_softc *sc;
struct sfxge_txq *txq;
int rc;
- sc = (struct sfxge_softc *)ifp->if_softc;
+ sc = (struct sfxge_softc *)if_getsoftc(ifp);
/*
* Transmit may be called when interface is up from the kernel
@@ -888,7 +888,7 @@
* point of view, but already down from the kernel point of
* view. I.e. Rx when interface shutdown is in progress.
*/
- KASSERT((ifp->if_flags & IFF_UP) || (sc->if_flags & IFF_UP),
+ KASSERT((if_getflags(ifp) & IFF_UP) || (sc->if_flags & IFF_UP),
("interface not up"));
/* Pick the desired transmit queue. */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 1, 5:47 PM (10 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29121440
Default Alt Text
D37817.id.diff (13 KB)
Attached To
Mode
D37817: Mechanically convert sfxge(4) to DrvAPI
Attached
Detach File
Event Timeline
Log In to Comment