svn commit: r276461 - projects/ifnet/sys/netinet
Adrian Chadd
adrian at freebsd.org
Wed Dec 31 16:43:21 UTC 2014
Hi,
I like the accessor macro methods for various bits here.
How about we stage out these simpleish changes into something that
lands in -HEAD sooner rather than later?
(There are discussions to be had about the attach API; I'm mostly
worried about how every new optional field may end up needing a KBI
change to do rather than right now where new optional fields end up
having defaults that the driver doesn't have to implement itself.)
-adrian
On 31 December 2014 at 01:52, Gleb Smirnoff <glebius at freebsd.org> wrote:
> Author: glebius
> Date: Wed Dec 31 09:52:57 2014
> New Revision: 276461
> URL: https://svnweb.freebsd.org/changeset/base/276461
>
> Log:
> - Mechanically convert access to different ifnet fields that moved to ifdriver
> to inline functions.
> - Other small changes to adopt to new ifnet world order.
>
> Sponsored by: Netflix
> Sponsored by: Nginx, Inc.
>
> Modified:
> projects/ifnet/sys/netinet/if_ether.c
> projects/ifnet/sys/netinet/in.c
> projects/ifnet/sys/netinet/ip_fastfwd.c
> projects/ifnet/sys/netinet/ip_output.c
> projects/ifnet/sys/netinet/sctp_bsd_addr.c
> projects/ifnet/sys/netinet/sctp_os_bsd.h
> projects/ifnet/sys/netinet/tcp_input.c
> projects/ifnet/sys/netinet/tcp_lro.c
> projects/ifnet/sys/netinet/tcp_subr.c
> projects/ifnet/sys/netinet/tcp_var.h
>
> Modified: projects/ifnet/sys/netinet/if_ether.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/if_ether.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/if_ether.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -254,12 +254,12 @@ arprequest(struct ifnet *ifp, const stru
> }
> }
> if (enaddr == NULL)
> - enaddr = carpaddr ? carpaddr : (u_char *)IF_LLADDR(ifp);
> + enaddr = carpaddr ? carpaddr : (u_char *)if_lladdr(ifp);
>
> if ((m = m_gethdr(M_NOWAIT, MT_DATA)) == NULL)
> return;
> m->m_len = sizeof(*ah) + 2 * sizeof(struct in_addr) +
> - 2 * ifp->if_addrlen;
> + 2 * if_addrlen(ifp);
> m->m_pkthdr.len = m->m_len;
> MH_ALIGN(m, m->m_len);
> ah = mtod(m, struct arphdr *);
> @@ -268,7 +268,7 @@ arprequest(struct ifnet *ifp, const stru
> mac_netinet_arp_send(ifp, m);
> #endif
> ah->ar_pro = htons(ETHERTYPE_IP);
> - ah->ar_hln = ifp->if_addrlen; /* hardware address length */
> + ah->ar_hln = if_addrlen(ifp); /* hardware address length */
> ah->ar_pln = sizeof(struct in_addr); /* protocol address length */
> ah->ar_op = htons(ARPOP_REQUEST);
> bcopy(enaddr, ar_sha(ah), ah->ar_hln);
> @@ -278,7 +278,7 @@ arprequest(struct ifnet *ifp, const stru
> sa.sa_len = 2;
> m->m_flags |= M_BCAST;
> m_clrprotoflags(m); /* Avoid confusing lower layers. */
> - (*ifp->if_output)(ifp, m, &sa, NULL);
> + if_output(ifp, m, &sa, NULL);
> ARPSTAT_INC(txrequests);
> }
>
> @@ -313,11 +313,10 @@ arpresolve(struct ifnet *ifp, int is_gw,
> if (m != NULL) {
> if (m->m_flags & M_BCAST) {
> /* broadcast */
> - (void)memcpy(desten,
> - ifp->if_broadcastaddr, ifp->if_addrlen);
> + memcpy(desten, ifp->if_broadcastaddr, if_addrlen(ifp));
> return (0);
> }
> - if (m->m_flags & M_MCAST && ifp->if_type != IFT_ARCNET) {
> + if (m->m_flags & M_MCAST && if_type(ifp) != IFT_ARCNET) {
> /* multicast */
> ETHER_MAP_IP_MULTICAST(&SIN(dst)->sin_addr, desten);
> return (0);
> @@ -345,7 +344,7 @@ retry:
>
> if ((la->la_flags & LLE_VALID) &&
> ((la->la_flags & LLE_STATIC) || la->la_expire > time_uptime)) {
> - bcopy(&la->ll_addr, desten, ifp->if_addrlen);
> + bcopy(&la->ll_addr, desten, if_addrlen(ifp));
> /*
> * If entry has an expiry time and it is approaching,
> * see if we need to send an ARP request within this
> @@ -556,10 +555,10 @@ in_arpinput(struct mbuf *m)
>
> if (ifp->if_bridge)
> bridged = 1;
> - if (ifp->if_type == IFT_BRIDGE)
> + if (if_type(ifp) == IFT_BRIDGE)
> is_bridge = 1;
>
> - req_len = arphdr_len2(ifp->if_addrlen, sizeof(struct in_addr));
> + req_len = arphdr_len2(if_addrlen(ifp), sizeof(struct in_addr));
> if (m->m_len < req_len && (m = m_pullup(m, req_len)) == NULL) {
> ARP_LOG(LOG_NOTICE, "runt packet -- m_pullup failed\n");
> return;
> @@ -577,8 +576,8 @@ in_arpinput(struct mbuf *m)
> }
>
> if (allow_multicast == 0 && ETHER_IS_MULTICAST(ar_sha(ah))) {
> - ARP_LOG(LOG_NOTICE, "%*D is multicast\n",
> - ifp->if_addrlen, (u_char *)ar_sha(ah), ":");
> + ARP_LOG(LOG_NOTICE, "%*D is multicast\n", if_addrlen(ifp),
> + (u_char *)ar_sha(ah), ":");
> goto drop;
> }
>
> @@ -617,7 +616,7 @@ in_arpinput(struct mbuf *m)
>
> #define BDG_MEMBER_MATCHES_ARP(addr, ifp, ia) \
> (ia->ia_ifp->if_bridge == ifp->if_softc && \
> - !bcmp(IF_LLADDR(ia->ia_ifp), IF_LLADDR(ifp), ifp->if_addrlen) && \
> + !bcmp(if_lladdr(ia->ia_ifp), if_lladdr(ifp), if_addrlen(ifp)) && \
> addr == ia->ia_addr.sin_addr.s_addr)
> /*
> * Check the case when bridge shares its MAC address with
> @@ -666,13 +665,13 @@ in_arpinput(struct mbuf *m)
> IN_IFADDR_RUNLOCK();
> match:
> if (!enaddr)
> - enaddr = (u_int8_t *)IF_LLADDR(ifp);
> + enaddr = (u_int8_t *)if_lladdr(ifp);
> carped = (ia->ia_ifa.ifa_carp != NULL);
> myaddr = ia->ia_addr.sin_addr;
> ifa_free(&ia->ia_ifa);
> - if (!bcmp(ar_sha(ah), enaddr, ifp->if_addrlen))
> + if (!bcmp(ar_sha(ah), enaddr, if_addrlen(ifp)))
> goto drop; /* it's from me, ignore it. */
> - if (!bcmp(ar_sha(ah), ifp->if_broadcastaddr, ifp->if_addrlen)) {
> + if (!bcmp(ar_sha(ah), ifp->if_broadcastaddr, if_addrlen(ifp))) {
> ARP_LOG(LOG_NOTICE, "link address is broadcast for IP address "
> "%s!\n", inet_ntoa(isaddr));
> goto drop;
> @@ -686,7 +685,7 @@ match:
> if (!bridged && !carped && isaddr.s_addr == myaddr.s_addr &&
> myaddr.s_addr != 0) {
> ARP_LOG(LOG_ERR, "%*D is using my IP address %s on %s!\n",
> - ifp->if_addrlen, (u_char *)ar_sha(ah), ":",
> + if_addrlen(ifp), (u_char *)ar_sha(ah), ":",
> inet_ntoa(isaddr), ifp->if_xname);
> itaddr = myaddr;
> ARPSTAT_INC(dupips);
> @@ -712,20 +711,20 @@ match:
> "but got reply from %*D on %s\n",
> inet_ntoa(isaddr),
> la->lle_tbl->llt_ifp->if_xname,
> - ifp->if_addrlen, (u_char *)ar_sha(ah), ":",
> + if_addrlen(ifp), (u_char *)ar_sha(ah), ":",
> ifp->if_xname);
> LLE_WUNLOCK(la);
> goto reply;
> }
> if ((la->la_flags & LLE_VALID) &&
> - bcmp(ar_sha(ah), &la->ll_addr, ifp->if_addrlen)) {
> + bcmp(ar_sha(ah), &la->ll_addr, if_addrlen(ifp))) {
> if (la->la_flags & LLE_STATIC) {
> LLE_WUNLOCK(la);
> if (log_arp_permanent_modify)
> ARP_LOG(LOG_ERR,
> "%*D attempts to modify "
> "permanent entry for %s on %s\n",
> - ifp->if_addrlen,
> + if_addrlen(ifp),
> (u_char *)ar_sha(ah), ":",
> inet_ntoa(isaddr), ifp->if_xname);
> goto reply;
> @@ -734,22 +733,21 @@ match:
> ARP_LOG(LOG_INFO, "%s moved from %*D "
> "to %*D on %s\n",
> inet_ntoa(isaddr),
> - ifp->if_addrlen,
> - (u_char *)&la->ll_addr, ":",
> - ifp->if_addrlen, (u_char *)ar_sha(ah), ":",
> - ifp->if_xname);
> + if_addrlen(ifp), (u_char *)&la->ll_addr,
> + ":", if_addrlen(ifp), (u_char *)ar_sha(ah),
> + ":", ifp->if_xname);
> }
> }
>
> - if (ifp->if_addrlen != ah->ar_hln) {
> + if (if_addrlen(ifp) != ah->ar_hln) {
> LLE_WUNLOCK(la);
> ARP_LOG(LOG_WARNING, "from %*D: addr len: new %d, "
> - "i/f %d (ignored)\n", ifp->if_addrlen,
> + "i/f %d (ignored)\n", if_addrlen(ifp),
> (u_char *) ar_sha(ah), ":", ah->ar_hln,
> - ifp->if_addrlen);
> + if_addrlen(ifp));
> goto drop;
> }
> - (void)memcpy(&la->ll_addr, ar_sha(ah), ifp->if_addrlen);
> + memcpy(&la->ll_addr, ar_sha(ah), if_addrlen(ifp));
> la->la_flags |= LLE_VALID;
>
> EVENTHANDLER_INVOKE(lle_event, la, LLENTRY_RESOLVED);
> @@ -786,7 +784,7 @@ match:
> m_hold->m_nextpkt = NULL;
> /* Avoid confusing lower layers. */
> m_clrprotoflags(m_hold);
> - (*ifp->if_output)(ifp, m_hold, &sa, NULL);
> + if_output(ifp, m_hold, &sa, NULL);
> }
> } else
> LLE_WUNLOCK(la);
> @@ -891,7 +889,7 @@ reply:
> sa.sa_family = AF_ARP;
> sa.sa_len = 2;
> m_clrprotoflags(m); /* Avoid confusing lower layers. */
> - (*ifp->if_output)(ifp, m, &sa, NULL);
> + if_output(ifp, m, &sa, NULL);
> ARPSTAT_INC(txreplies);
> return;
>
> @@ -910,7 +908,7 @@ arp_ifinit(struct ifnet *ifp, struct ifa
>
> if (ntohl(IA_SIN(ifa)->sin_addr.s_addr) != INADDR_ANY) {
> arprequest(ifp, &IA_SIN(ifa)->sin_addr,
> - &IA_SIN(ifa)->sin_addr, IF_LLADDR(ifp));
> + &IA_SIN(ifa)->sin_addr, if_lladdr(ifp));
> /*
> * interface address is considered static entry
> * because the output of the arp utility shows
>
> Modified: projects/ifnet/sys/netinet/in.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/in.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/in.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -232,9 +232,7 @@ in_control(struct socket *so, u_long cmd
> /* We no longer support that old commands. */
> return (EINVAL);
> default:
> - if (ifp->if_ioctl == NULL)
> - return (EOPNOTSUPP);
> - return ((*ifp->if_ioctl)(ifp, cmd, data));
> + return if_ioctl(ifp, cmd, data);
> }
>
> if (addr->sin_addr.s_addr != INADDR_ANY &&
> @@ -436,11 +434,9 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat
> * if this is its first address,
> * and to validate the address if necessary.
> */
> - if (ifp->if_ioctl != NULL) {
> - error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia);
> - if (error)
> - goto fail1;
> - }
> + error = if_ioctl(ifp, SIOCSIFADDR, (caddr_t)ia);
> + if (error != 0 && error != EOPNOTSUPP)
> + goto fail1;
>
> /*
> * Add route for the network.
> @@ -1026,7 +1022,7 @@ in_lltable_rtcheck(struct ifnet *ifp, u_
> */
> if (rt->rt_flags & RTF_GATEWAY) {
> if (!(rt->rt_flags & RTF_HOST) || !rt->rt_ifp ||
> - rt->rt_ifp->if_type != IFT_ETHER ||
> + if_type(rt->rt_ifp) != IFT_ETHER ||
> (rt->rt_ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) != 0 ||
> memcmp(rt->rt_gateway->sa_data, l3addr->sa_data,
> sizeof(in_addr_t)) != 0) {
> @@ -1126,8 +1122,9 @@ in_lltable_lookup(struct lltable *llt, u
> goto done;
> }
> lle->la_flags = flags & ~LLE_CREATE;
> - if ((flags & (LLE_CREATE | LLE_IFADDR)) == (LLE_CREATE | LLE_IFADDR)) {
> - bcopy(IF_LLADDR(ifp), &lle->ll_addr, ifp->if_addrlen);
> + if ((flags & (LLE_CREATE | LLE_IFADDR)) ==
> + (LLE_CREATE | LLE_IFADDR)) {
> + bcopy(if_lladdr(ifp), &lle->ll_addr, if_addrlen(ifp));
> lle->la_flags |= (LLE_VALID | LLE_STATIC);
> }
>
> @@ -1213,13 +1210,14 @@ in_lltable_dump(struct lltable *llt, str
> sdl->sdl_family = AF_LINK;
> sdl->sdl_len = sizeof(*sdl);
> sdl->sdl_index = ifp->if_index;
> - sdl->sdl_type = ifp->if_type;
> + sdl->sdl_type = if_type(ifp);
> if ((lle->la_flags & LLE_VALID) == LLE_VALID) {
> - sdl->sdl_alen = ifp->if_addrlen;
> - bcopy(&lle->ll_addr, LLADDR(sdl), ifp->if_addrlen);
> + sdl->sdl_alen = if_addrlen(ifp);
> + bcopy(&lle->ll_addr, LLADDR(sdl),
> + if_addrlen(ifp));
> } else {
> sdl->sdl_alen = 0;
> - bzero(LLADDR(sdl), ifp->if_addrlen);
> + bzero(LLADDR(sdl), if_addrlen(ifp));
> }
>
> arpc.rtm.rtm_rmx.rmx_expire =
>
> Modified: projects/ifnet/sys/netinet/ip_fastfwd.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/ip_fastfwd.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/ip_fastfwd.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -531,8 +531,7 @@ passout:
> * Send off the packet via outgoing interface
> */
> IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL);
> - error = (*ifp->if_output)(ifp, m,
> - (struct sockaddr *)dst, &ro);
> + error = if_output(ifp, m, (struct sockaddr *)dst, &ro);
> } else {
> /*
> * Handle EMSGSIZE with icmp reply needfrag for TCP MTU discovery
> @@ -563,8 +562,8 @@ passout:
> m_clrprotoflags(m);
>
> IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL);
> - error = (*ifp->if_output)(ifp, m,
> - (struct sockaddr *)dst, &ro);
> + error = if_output(ifp, m,
> + (struct sockaddr *)dst, &ro);
> if (error)
> break;
> } while ((m = m0) != NULL);
>
> Modified: projects/ifnet/sys/netinet/ip_output.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/ip_output.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/ip_output.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -624,8 +624,7 @@ passout:
> */
> m_clrprotoflags(m);
> IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL);
> - error = (*ifp->if_output)(ifp, m,
> - (const struct sockaddr *)gw, ro);
> + error = if_output(ifp, m, (const struct sockaddr *)gw, ro);
> goto done;
> }
>
> @@ -660,7 +659,7 @@ passout:
> m_clrprotoflags(m);
>
> IP_PROBE(send, NULL, NULL, ip, ifp, ip, NULL);
> - error = (*ifp->if_output)(ifp, m,
> + error = if_output(ifp, m,
> (const struct sockaddr *)gw, ro);
> } else
> m_freem(m);
>
> Modified: projects/ifnet/sys/netinet/sctp_bsd_addr.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/sctp_bsd_addr.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/sctp_bsd_addr.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$");
> #include <netinet/sctp_indata.h>
> #include <sys/unistd.h>
>
> +#define if_addrlist if_addrhead
> +#define if_list if_link
> +
> /* Declare all of our malloc named types */
> MALLOC_DEFINE(SCTP_M_MAP, "sctp_map", "sctp asoc map descriptor");
> MALLOC_DEFINE(SCTP_M_STRMI, "sctp_stri", "sctp stream in array");
> @@ -150,7 +153,7 @@ sctp_is_desired_interface_type(struct if
> int result;
>
> /* check the interface type to see if it's one we care about */
> - switch (ifn->if_type) {
> + switch (if_type(ifn)) {
> case IFT_ETHER:
> case IFT_ISO88023:
> case IFT_ISO88024:
> @@ -256,7 +259,7 @@ sctp_init_ifns_for_vrf(int vrfid)
> sctp_ifa = sctp_add_addr_to_vrf(vrfid,
> (void *)ifn,
> ifn->if_index,
> - ifn->if_type,
> + if_type(ifn),
> ifn->if_xname,
> (void *)ifa,
> ifa->ifa_addr,
> @@ -336,8 +339,9 @@ sctp_addr_change(struct ifaddr *ifa, int
> return;
> }
> if (cmd == RTM_ADD) {
> - (void)sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID, (void *)ifa->ifa_ifp,
> - ifa->ifa_ifp->if_index, ifa->ifa_ifp->if_type, ifa->ifa_ifp->if_xname,
> + (void)sctp_add_addr_to_vrf(SCTP_DEFAULT_VRFID,
> + (void *)ifa->ifa_ifp, ifa->ifa_ifp->if_index,
> + if_type(ifa->ifa_ifp), ifa->ifa_ifp->if_xname,
> (void *)ifa, ifa->ifa_addr, ifa_flags, 1);
> } else {
>
>
> Modified: projects/ifnet/sys/netinet/sctp_os_bsd.h
> ==============================================================================
> --- projects/ifnet/sys/netinet/sctp_os_bsd.h Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/sctp_os_bsd.h Wed Dec 31 09:52:57 2014 (r276461)
> @@ -212,7 +212,7 @@ MALLOC_DECLARE(SCTP_M_MCORE);
> #define SCTP_INIT_VRF_TABLEID(vrf)
>
> #define SCTP_IFN_IS_IFT_LOOP(ifn) ((ifn)->ifn_type == IFT_LOOP)
> -#define SCTP_ROUTE_IS_REAL_LOOP(ro) ((ro)->ro_rt && (ro)->ro_rt->rt_ifa && (ro)->ro_rt->rt_ifa->ifa_ifp && (ro)->ro_rt->rt_ifa->ifa_ifp->if_type == IFT_LOOP)
> +#define SCTP_ROUTE_IS_REAL_LOOP(ro) ((ro)->ro_rt && (ro)->ro_rt->rt_ifa && (ro)->ro_rt->rt_ifa->ifa_ifp && if_type((ro)->ro_rt->rt_ifa->ifa_ifp) == IFT_LOOP)
>
> /*
> * Access to IFN's to help with src-addr-selection
>
> Modified: projects/ifnet/sys/netinet/tcp_input.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/tcp_input.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/tcp_input.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -3540,7 +3540,6 @@ tcp_mss(struct tcpcb *tp, int offer)
>
> KASSERT(tp != NULL, ("%s: tp == NULL", __func__));
>
> - bzero(&cap, sizeof(cap));
> tcp_mss_update(tp, offer, -1, &metrics, &cap);
>
> mss = tp->t_maxseg;
> @@ -3586,11 +3585,11 @@ tcp_mss(struct tcpcb *tp, int offer)
> SOCKBUF_UNLOCK(&so->so_rcv);
>
> /* Check the interface for TSO capabilities. */
> - if (cap.ifcap & CSUM_TSO) {
> + if (cap.hwassist & CSUM_TSO) {
> tp->t_flags |= TF_TSO;
> - tp->t_tsomax = cap.tsomax;
> - tp->t_tsomaxsegcount = cap.tsomaxsegcount;
> - tp->t_tsomaxsegsize = cap.tsomaxsegsize;
> + tp->t_tsomax = cap.tsomax->tsomax_bytes;
> + tp->t_tsomaxsegcount = cap.tsomax->tsomax_segcount;
> + tp->t_tsomaxsegsize = cap.tsomax->tsomax_segsize;
> }
> }
>
>
> Modified: projects/ifnet/sys/netinet/tcp_lro.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/tcp_lro.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/tcp_lro.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -298,7 +298,7 @@ tcp_lro_flush(struct lro_ctrl *lc, struc
> #endif
> }
>
> - (*lc->ifp->if_input)(lc->ifp, le->m_head);
> + if_input(lc->ifp, le->m_head);
> lc->lro_queued += le->append_cnt + 1;
> lc->lro_flushed++;
> bzero(le, sizeof(*le));
>
> Modified: projects/ifnet/sys/netinet/tcp_subr.c
> ==============================================================================
> --- projects/ifnet/sys/netinet/tcp_subr.c Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/tcp_subr.c Wed Dec 31 09:52:57 2014 (r276461)
> @@ -1807,13 +1807,11 @@ tcp_maxmtu(struct in_conninfo *inc, stru
>
> /* Report additional interface capabilities. */
> if (cap != NULL) {
> - if (ifp->if_capenable & IFCAP_TSO4 &&
> - ifp->if_hwassist & CSUM_TSO) {
> - cap->ifcap |= CSUM_TSO;
> - cap->tsomax = ifp->if_hw_tsomax;
> - cap->tsomaxsegcount = ifp->if_hw_tsomaxsegcount;
> - cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize;
> - }
> + if (ifp->if_capenable & IFCAP_TSO4) {
> + cap->hwassist = ifp->if_hwassist;
> + cap->tsomax = ifp->if_tsomax;
> + } else
> + bzero(cap, sizeof(struct tcp_ifcap));
> }
> RTFREE(sro.ro_rt);
> }
> @@ -1848,13 +1846,11 @@ tcp_maxmtu6(struct in_conninfo *inc, str
>
> /* Report additional interface capabilities. */
> if (cap != NULL) {
> - if (ifp->if_capenable & IFCAP_TSO6 &&
> - ifp->if_hwassist & CSUM_TSO) {
> - cap->ifcap |= CSUM_TSO;
> - cap->tsomax = ifp->if_hw_tsomax;
> - cap->tsomaxsegcount = ifp->if_hw_tsomaxsegcount;
> - cap->tsomaxsegsize = ifp->if_hw_tsomaxsegsize;
> - }
> + if (ifp->if_capenable & IFCAP_TSO6) {
> + cap->hwassist = ifp->if_hwassist;
> + cap->tsomax = ifp->if_tsomax;
> + } else
> + bzero(cap, sizeof(struct tcp_ifcap));
> }
> RTFREE(sro6.ro_rt);
> }
>
> Modified: projects/ifnet/sys/netinet/tcp_var.h
> ==============================================================================
> --- projects/ifnet/sys/netinet/tcp_var.h Wed Dec 31 09:51:35 2014 (r276460)
> +++ projects/ifnet/sys/netinet/tcp_var.h Wed Dec 31 09:52:57 2014 (r276461)
> @@ -332,11 +332,12 @@ struct hc_metrics_lite { /* must stay in
> * Used by tcp_maxmtu() to communicate interface specific features
> * and limits at the time of connection setup.
> */
> +#ifndef _NET_IF_H_
> +struct iftsomax;
> +#endif
> struct tcp_ifcap {
> - int ifcap;
> - u_int tsomax;
> - u_int tsomaxsegcount;
> - u_int tsomaxsegsize;
> + uint64_t hwassist;
> + struct iftsomax *tsomax;
> };
>
> #ifndef _NETINET_IN_PCB_H_
>
More information about the svn-src-projects
mailing list