Mechanically convert vnic to IfAPI

Reviewed by:	zlei
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37827
This commit is contained in:
Justin Hibbits 2022-08-17 16:42:35 -04:00
parent 0b2813768b
commit b9545c5794
6 changed files with 29 additions and 26 deletions

View File

@ -292,7 +292,7 @@ struct nicvf {
struct nicvf *pnicvf;
device_t dev;
struct ifnet * ifp;
if_t ifp;
struct sx core_sx;
struct ifmedia if_media;
uint32_t if_flags;

View File

@ -147,17 +147,17 @@ static int nicvf_setup_ifnet(struct nicvf *);
static int nicvf_setup_ifmedia(struct nicvf *);
static void nicvf_hw_addr_random(uint8_t *);
static int nicvf_if_ioctl(struct ifnet *, u_long, caddr_t);
static int nicvf_if_ioctl(if_t, u_long, caddr_t);
static void nicvf_if_init(void *);
static void nicvf_if_init_locked(struct nicvf *);
static int nicvf_if_transmit(struct ifnet *, struct mbuf *);
static void nicvf_if_qflush(struct ifnet *);
static uint64_t nicvf_if_getcounter(struct ifnet *, ift_counter);
static int nicvf_if_transmit(if_t, struct mbuf *);
static void nicvf_if_qflush(if_t);
static uint64_t nicvf_if_getcounter(if_t, ift_counter);
static int nicvf_stop_locked(struct nicvf *);
static void nicvf_media_status(struct ifnet *, struct ifmediareq *);
static int nicvf_media_change(struct ifnet *);
static void nicvf_media_status(if_t, struct ifmediareq *);
static int nicvf_media_change(if_t);
static void nicvf_tick_stats(void *);
@ -336,7 +336,7 @@ nicvf_hw_addr_random(uint8_t *hwaddr)
static int
nicvf_setup_ifnet(struct nicvf *nic)
{
struct ifnet *ifp;
if_t ifp;
ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
@ -418,7 +418,7 @@ nicvf_setup_ifmedia(struct nicvf *nic)
}
static int
nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
nicvf_if_ioctl(if_t ifp, u_long cmd, caddr_t data)
{
struct nicvf *nic;
struct rcv_queue *rq;
@ -571,7 +571,7 @@ static void
nicvf_if_init_locked(struct nicvf *nic)
{
struct queue_set *qs = nic->qs;
struct ifnet *ifp;
if_t ifp;
int qidx;
int err;
caddr_t if_addr;
@ -643,7 +643,7 @@ nicvf_if_init(void *if_softc)
}
static int
nicvf_if_transmit(struct ifnet *ifp, struct mbuf *mbuf)
nicvf_if_transmit(if_t ifp, struct mbuf *mbuf)
{
struct nicvf *nic = if_getsoftc(ifp);
struct queue_set *qs = nic->qs;
@ -699,7 +699,7 @@ nicvf_if_transmit(struct ifnet *ifp, struct mbuf *mbuf)
}
static void
nicvf_if_qflush(struct ifnet *ifp)
nicvf_if_qflush(if_t ifp)
{
struct nicvf *nic;
struct queue_set *qs;
@ -721,7 +721,7 @@ nicvf_if_qflush(struct ifnet *ifp)
}
static uint64_t
nicvf_if_getcounter(struct ifnet *ifp, ift_counter cnt)
nicvf_if_getcounter(if_t ifp, ift_counter cnt)
{
struct nicvf *nic;
struct nicvf_hw_stats *hw_stats;
@ -755,7 +755,7 @@ nicvf_if_getcounter(struct ifnet *ifp, ift_counter cnt)
}
static void
nicvf_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
nicvf_media_status(if_t ifp, struct ifmediareq *ifmr)
{
struct nicvf *nic = if_getsoftc(ifp);
@ -799,7 +799,7 @@ nicvf_media_status(struct ifnet *ifp, struct ifmediareq *ifmr)
}
static int
nicvf_media_change(struct ifnet *ifp __unused)
nicvf_media_change(if_t ifp __unused)
{
return (0);
@ -1523,7 +1523,7 @@ nicvf_allocate_net_interrupts(struct nicvf *nic)
static int
nicvf_stop_locked(struct nicvf *nic)
{
struct ifnet *ifp;
if_t ifp;
int qidx;
struct queue_set *qs = nic->qs;
union nic_mbx mbx = {};

View File

@ -732,7 +732,7 @@ static int
nicvf_cq_intr_handler(struct nicvf *nic, uint8_t cq_idx)
{
struct mbuf *mbuf;
struct ifnet *ifp;
if_t ifp;
int processed_cqe, tx_done = 0;
#ifdef DEBUG
int work_done = 0;
@ -831,7 +831,7 @@ nicvf_cq_intr_handler(struct nicvf *nic, uint8_t cq_idx)
while (!buf_ring_empty(cq->rx_br)) {
mbuf = buf_ring_dequeue_mc(cq->rx_br);
if (__predict_true(mbuf != NULL))
(*ifp->if_input)(ifp, mbuf);
if_input(ifp, mbuf);
}
return (cmp_err);
@ -987,7 +987,7 @@ int
nicvf_xmit_locked(struct snd_queue *sq)
{
struct nicvf *nic;
struct ifnet *ifp;
if_t ifp;
struct mbuf *next;
int err;
@ -1020,7 +1020,7 @@ nicvf_snd_task(void *arg, int pending)
{
struct snd_queue *sq = (struct snd_queue *)arg;
struct nicvf *nic;
struct ifnet *ifp;
if_t ifp;
int err;
nic = sq->nic;
@ -1296,7 +1296,7 @@ nicvf_rcv_queue_config(struct nicvf *nic, struct queue_set *qs,
union nic_mbx mbx = {};
struct rcv_queue *rq;
struct rq_cfg rq_cfg;
struct ifnet *ifp;
if_t ifp;
struct lro_ctrl *lro;
ifp = nic->ifp;

View File

@ -93,8 +93,8 @@ static int thunder_mdio_detach(device_t);
static int thunder_mdio_read(device_t, int, int);
static int thunder_mdio_write(device_t, int, int, int);
static int thunder_ifmedia_change_stub(struct ifnet *);
static void thunder_ifmedia_status_stub(struct ifnet *, struct ifmediareq *);
static int thunder_ifmedia_change_stub(if_t);
static void thunder_ifmedia_status_stub(if_t, struct ifmediareq *);
static int thunder_mdio_media_status(device_t, int, int *, int *, int *);
static int thunder_mdio_media_change(device_t, int, int, int, int);
@ -351,14 +351,14 @@ thunder_mdio_write(device_t dev, int phy, int reg, int data)
}
static int
thunder_ifmedia_change_stub(struct ifnet *ifp __unused)
thunder_ifmedia_change_stub(if_t ifp __unused)
{
/* Will never be called by if_media */
return (0);
}
static void
thunder_ifmedia_status_stub(struct ifnet *ifp __unused, struct ifmediareq
thunder_ifmedia_status_stub(if_t ifp __unused, struct ifmediareq
*ifmr __unused)
{
/* Will never be called by if_media */

View File

@ -34,11 +34,14 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/socket.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/fdt/simplebus.h>
#include <net/if.h>
#include <machine/bus.h>
#include <machine/resource.h>

View File

@ -44,7 +44,7 @@ enum thunder_mdio_mode {
struct phy_desc {
device_t miibus; /* One miibus per LMAC */
struct ifnet * ifp; /* Fake ifp to satisfy miibus */
if_t ifp; /* Fake ifp to satisfy miibus */
int lmacid; /* ID number of LMAC connected */
TAILQ_ENTRY(phy_desc) phy_desc_list;
};