Add the folowing set accessor functions for recently-added members of ifnet
structure: if_gethwtsomax(), if_sethwtsomax() - if_hw_tsomax if_gethwtsomaxsegcount(), if_sethwtsomaxsegcount() - if_hw_tsomaxsegcount if_gethwtsomaxsegsize(), if_sethwtsomaxsegsize() - if_hw_tsomaxsegsize Update em and vnic drivers which had already been coverted to use accessor functions for the other ifnet structure members. Reviewed by: erj Approved by: sjg (mentor) Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D8544
This commit is contained in:
parent
b38b22b0b2
commit
d0b2cad1ca
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313019
@ -2481,10 +2481,10 @@ em_setup_interface(if_ctx_t ctx)
|
|||||||
INIT_DEBUGOUT("em_setup_interface: begin");
|
INIT_DEBUGOUT("em_setup_interface: begin");
|
||||||
|
|
||||||
/* TSO parameters */
|
/* TSO parameters */
|
||||||
ifp->if_hw_tsomax = IP_MAXPACKET;
|
if_sethwtsomax(ifp, IP_MAXPACKET);
|
||||||
/* Take m_pullup(9)'s in em_xmit() w/ TSO into acount. */
|
/* Take m_pullup(9)'s in em_xmit() w/ TSO into acount. */
|
||||||
ifp->if_hw_tsomaxsegcount = EM_MAX_SCATTER - 5;
|
if_sethwtsomaxsegcount(ifp, EM_MAX_SCATTER - 5);
|
||||||
ifp->if_hw_tsomaxsegsize = EM_TSO_SEG_SIZE;
|
if_sethwtsomaxsegsize(ifp, EM_TSO_SEG_SIZE);
|
||||||
|
|
||||||
/* Single Queue */
|
/* Single Queue */
|
||||||
if (adapter->tx_num_queues == 1) {
|
if (adapter->tx_num_queues == 1) {
|
||||||
|
@ -370,9 +370,9 @@ nicvf_setup_ifnet(struct nicvf *nic)
|
|||||||
/* TSO */
|
/* TSO */
|
||||||
if_setcapabilitiesbit(ifp, IFCAP_TSO4, 0);
|
if_setcapabilitiesbit(ifp, IFCAP_TSO4, 0);
|
||||||
/* TSO parameters */
|
/* TSO parameters */
|
||||||
ifp->if_hw_tsomax = NICVF_TSO_MAXSIZE;
|
if_sethwtsomax(ifp, NICVF_TSO_MAXSIZE);
|
||||||
ifp->if_hw_tsomaxsegcount = NICVF_TSO_NSEGS;
|
if_sethwtsomaxsegcount(ifp, NICVF_TSO_NSEGS);
|
||||||
ifp->if_hw_tsomaxsegsize = MCLBYTES;
|
if_sethwtsomaxsegsize(ifp, MCLBYTES);
|
||||||
}
|
}
|
||||||
/* IP/TCP/UDP HW checksums */
|
/* IP/TCP/UDP HW checksums */
|
||||||
if_setcapabilitiesbit(ifp, IFCAP_HWCSUM, 0);
|
if_setcapabilitiesbit(ifp, IFCAP_HWCSUM, 0);
|
||||||
@ -453,7 +453,7 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
#if defined(INET) || defined(INET6)
|
#if defined(INET) || defined(INET6)
|
||||||
/* Avoid reinitialization unless it's necessary */
|
/* Avoid reinitialization unless it's necessary */
|
||||||
if (avoid_reset) {
|
if (avoid_reset) {
|
||||||
ifp->if_flags |= IFF_UP;
|
if_setflagbits(ifp, IFF_UP, 0);
|
||||||
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING))
|
||||||
nicvf_if_init(nic);
|
nicvf_if_init(nic);
|
||||||
#ifdef INET
|
#ifdef INET
|
||||||
@ -482,8 +482,8 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
NICVF_CORE_LOCK(nic);
|
NICVF_CORE_LOCK(nic);
|
||||||
if (if_getflags(ifp) & IFF_UP) {
|
if (if_getflags(ifp) & IFF_UP) {
|
||||||
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
|
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
|
||||||
flags = ifp->if_flags ^ nic->if_flags;
|
flags = if_getflags(ifp) ^ nic->if_flags;
|
||||||
if ((nic->if_flags & ifp->if_flags) &
|
if ((nic->if_flags & if_getflags(ifp)) &
|
||||||
IFF_PROMISC) {
|
IFF_PROMISC) {
|
||||||
/* Change promiscous mode */
|
/* Change promiscous mode */
|
||||||
#if 0
|
#if 0
|
||||||
@ -492,7 +492,7 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((nic->if_flags ^ ifp->if_flags) &
|
if ((nic->if_flags ^ if_getflags(ifp)) &
|
||||||
IFF_ALLMULTI) {
|
IFF_ALLMULTI) {
|
||||||
/* Change multicasting settings */
|
/* Change multicasting settings */
|
||||||
#if 0
|
#if 0
|
||||||
@ -506,7 +506,7 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
} else if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
|
} else if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
|
||||||
nicvf_stop_locked(nic);
|
nicvf_stop_locked(nic);
|
||||||
|
|
||||||
nic->if_flags = ifp->if_flags;
|
nic->if_flags = if_getflags(ifp);
|
||||||
NICVF_CORE_UNLOCK(nic);
|
NICVF_CORE_UNLOCK(nic);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -528,24 +528,24 @@ nicvf_if_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCSIFCAP:
|
case SIOCSIFCAP:
|
||||||
mask = ifp->if_capenable ^ ifr->ifr_reqcap;
|
mask = if_getcapenable(ifp) ^ ifr->ifr_reqcap;
|
||||||
if (mask & IFCAP_VLAN_MTU) {
|
if (mask & IFCAP_VLAN_MTU) {
|
||||||
/* No work to do except acknowledge the change took. */
|
/* No work to do except acknowledge the change took. */
|
||||||
ifp->if_capenable ^= IFCAP_VLAN_MTU;
|
if_togglecapenable(ifp, IFCAP_VLAN_MTU);
|
||||||
}
|
}
|
||||||
if (mask & IFCAP_TXCSUM)
|
if (mask & IFCAP_TXCSUM)
|
||||||
ifp->if_capenable ^= IFCAP_TXCSUM;
|
if_togglecapenable(ifp, IFCAP_TXCSUM);
|
||||||
if (mask & IFCAP_RXCSUM)
|
if (mask & IFCAP_RXCSUM)
|
||||||
ifp->if_capenable ^= IFCAP_RXCSUM;
|
if_togglecapenable(ifp, IFCAP_RXCSUM);
|
||||||
if ((mask & IFCAP_TSO4) && nic->hw_tso)
|
if ((mask & IFCAP_TSO4) && nic->hw_tso)
|
||||||
ifp->if_capenable ^= IFCAP_TSO4;
|
if_togglecapenable(ifp, IFCAP_TSO4);
|
||||||
if (mask & IFCAP_LRO) {
|
if (mask & IFCAP_LRO) {
|
||||||
/*
|
/*
|
||||||
* Lock the driver for a moment to avoid
|
* Lock the driver for a moment to avoid
|
||||||
* mismatch in per-queue settings.
|
* mismatch in per-queue settings.
|
||||||
*/
|
*/
|
||||||
NICVF_CORE_LOCK(nic);
|
NICVF_CORE_LOCK(nic);
|
||||||
ifp->if_capenable ^= IFCAP_LRO;
|
if_togglecapenable(ifp, IFCAP_LRO);
|
||||||
if ((if_getdrvflags(nic->ifp) & IFF_DRV_RUNNING) != 0) {
|
if ((if_getdrvflags(nic->ifp) & IFF_DRV_RUNNING) != 0) {
|
||||||
/*
|
/*
|
||||||
* Now disable LRO for subsequent packets.
|
* Now disable LRO for subsequent packets.
|
||||||
|
45
sys/net/if.c
45
sys/net/if.c
@ -4103,6 +4103,51 @@ if_vlancap(if_t ifh)
|
|||||||
VLAN_CAPABILITIES(ifp);
|
VLAN_CAPABILITIES(ifp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
if_sethwtsomax(if_t ifp, u_int if_hw_tsomax)
|
||||||
|
{
|
||||||
|
|
||||||
|
((struct ifnet *)ifp)->if_hw_tsomax = if_hw_tsomax;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount)
|
||||||
|
{
|
||||||
|
|
||||||
|
((struct ifnet *)ifp)->if_hw_tsomaxsegcount = if_hw_tsomaxsegcount;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize)
|
||||||
|
{
|
||||||
|
|
||||||
|
((struct ifnet *)ifp)->if_hw_tsomaxsegsize = if_hw_tsomaxsegsize;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
u_int
|
||||||
|
if_gethwtsomax(if_t ifp)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (((struct ifnet *)ifp)->if_hw_tsomax);
|
||||||
|
}
|
||||||
|
|
||||||
|
u_int
|
||||||
|
if_gethwtsomaxsegcount(if_t ifp)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (((struct ifnet *)ifp)->if_hw_tsomaxsegcount);
|
||||||
|
}
|
||||||
|
|
||||||
|
u_int
|
||||||
|
if_gethwtsomaxsegsize(if_t ifp)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (((struct ifnet *)ifp)->if_hw_tsomaxsegsize);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
if_setinitfn(if_t ifp, void (*init_fn)(void *))
|
if_setinitfn(if_t ifp, void (*init_fn)(void *))
|
||||||
{
|
{
|
||||||
|
@ -658,6 +658,12 @@ int if_getflags(if_t ifp);
|
|||||||
int if_sendq_empty(if_t ifp);
|
int if_sendq_empty(if_t ifp);
|
||||||
int if_setsendqready(if_t ifp);
|
int if_setsendqready(if_t ifp);
|
||||||
int if_setsendqlen(if_t ifp, int tx_desc_count);
|
int if_setsendqlen(if_t ifp, int tx_desc_count);
|
||||||
|
int if_sethwtsomax(if_t ifp, u_int if_hw_tsomax);
|
||||||
|
int if_sethwtsomaxsegcount(if_t ifp, u_int if_hw_tsomaxsegcount);
|
||||||
|
int if_sethwtsomaxsegsize(if_t ifp, u_int if_hw_tsomaxsegsize);
|
||||||
|
u_int if_gethwtsomax(if_t ifp);
|
||||||
|
u_int if_gethwtsomaxsegcount(if_t ifp);
|
||||||
|
u_int if_gethwtsomaxsegsize(if_t ifp);
|
||||||
int if_input(if_t ifp, struct mbuf* sendmp);
|
int if_input(if_t ifp, struct mbuf* sendmp);
|
||||||
int if_sendq_prepend(if_t ifp, struct mbuf *m);
|
int if_sendq_prepend(if_t ifp, struct mbuf *m);
|
||||||
struct mbuf *if_dequeue(if_t ifp);
|
struct mbuf *if_dequeue(if_t ifp);
|
||||||
|
Loading…
Reference in New Issue
Block a user