Convert TOE routing lookups to the new routing KPI.
Reviewed by: np Differential Revision: https://reviews.freebsd.org/D24388
This commit is contained in:
parent
8f6c0a08d8
commit
8d6708ba80
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360191
@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/if_types.h>
|
||||
#include <net/if_vlan_var.h>
|
||||
#include <net/route.h>
|
||||
#include <net/route/nhop.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_pcb.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -226,13 +227,13 @@ act_open_cpl_size(struct adapter *sc, int isipv6)
|
||||
* rtalloc1, RT_UNLOCK on rt.
|
||||
*/
|
||||
int
|
||||
t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt,
|
||||
t4_connect(struct toedev *tod, struct socket *so, struct nhop_object *nh,
|
||||
struct sockaddr *nam)
|
||||
{
|
||||
struct adapter *sc = tod->tod_softc;
|
||||
struct toepcb *toep = NULL;
|
||||
struct wrqe *wr = NULL;
|
||||
struct ifnet *rt_ifp = rt->rt_ifp;
|
||||
struct ifnet *rt_ifp = nh->nh_ifp;
|
||||
struct vi_info *vi;
|
||||
int qid_atid, rc, isipv6;
|
||||
struct inpcb *inp = sotoinpcb(so);
|
||||
@ -277,7 +278,7 @@ t4_connect(struct toedev *tod, struct socket *so, struct rtentry *rt,
|
||||
DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM);
|
||||
|
||||
toep->l2te = t4_l2t_get(vi->pi, rt_ifp,
|
||||
rt->rt_flags & RTF_GATEWAY ? rt->rt_gateway : nam);
|
||||
nh->nh_flags & NHF_GATEWAY ? &nh->gw_sa : nam);
|
||||
if (toep->l2te == NULL)
|
||||
DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM);
|
||||
|
||||
|
@ -370,7 +370,7 @@ int add_tid_to_history(struct adapter *, u_int);
|
||||
/* t4_connect.c */
|
||||
void t4_init_connect_cpl_handlers(void);
|
||||
void t4_uninit_connect_cpl_handlers(void);
|
||||
int t4_connect(struct toedev *, struct socket *, struct rtentry *,
|
||||
int t4_connect(struct toedev *, struct socket *, struct nhop_object *,
|
||||
struct sockaddr *);
|
||||
void act_open_failure_cleanup(struct adapter *, u_int, u_int);
|
||||
|
||||
|
@ -41,8 +41,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/route.h>
|
||||
#include <net/route/nhop.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_pcb.h>
|
||||
#include <netinet/in_fib.h>
|
||||
#include <netinet6/in6_fib.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netinet/tcp_offload.h>
|
||||
#define TCPOUTFLAGS
|
||||
@ -60,7 +63,8 @@ tcp_offload_connect(struct socket *so, struct sockaddr *nam)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
struct toedev *tod;
|
||||
struct rtentry *rt;
|
||||
struct nhop_object *nh;
|
||||
struct epoch_tracker et;
|
||||
int error = EOPNOTSUPP;
|
||||
|
||||
INP_WLOCK_ASSERT(sotoinpcb(so));
|
||||
@ -70,13 +74,20 @@ tcp_offload_connect(struct socket *so, struct sockaddr *nam)
|
||||
if (registered_toedevs == 0)
|
||||
return (error);
|
||||
|
||||
rt = rtalloc1(nam, 0, 0);
|
||||
if (rt)
|
||||
RT_UNLOCK(rt);
|
||||
else
|
||||
NET_EPOCH_ENTER(et);
|
||||
nh = NULL;
|
||||
if (nam->sa_family == AF_INET)
|
||||
nh = fib4_lookup(0, ((struct sockaddr_in *)nam)->sin_addr,
|
||||
NHR_NONE, 0, 0);
|
||||
else if (nam->sa_family == AF_INET6)
|
||||
nh = fib6_lookup(0, &((struct sockaddr_in6 *)nam)->sin6_addr,
|
||||
NHR_NONE, 0, 0);
|
||||
if (nh == NULL) {
|
||||
NET_EPOCH_EXIT(et);
|
||||
return (EHOSTUNREACH);
|
||||
}
|
||||
|
||||
ifp = rt->rt_ifp;
|
||||
ifp = nh->nh_ifp;
|
||||
|
||||
if (nam->sa_family == AF_INET && !(ifp->if_capenable & IFCAP_TOE4))
|
||||
goto done;
|
||||
@ -85,9 +96,9 @@ tcp_offload_connect(struct socket *so, struct sockaddr *nam)
|
||||
|
||||
tod = TOEDEV(ifp);
|
||||
if (tod != NULL)
|
||||
error = tod->tod_connect(tod, so, rt, nam);
|
||||
error = tod->tod_connect(tod, so, nh, nam);
|
||||
done:
|
||||
RTFREE(rt);
|
||||
NET_EPOCH_EXIT(et);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ static eventhandler_tag lle_event_eh;
|
||||
|
||||
static int
|
||||
toedev_connect(struct toedev *tod __unused, struct socket *so __unused,
|
||||
struct rtentry *rt __unused, struct sockaddr *nam __unused)
|
||||
struct nhop_object *nh __unused, struct sockaddr *nam __unused)
|
||||
{
|
||||
|
||||
return (ENOTSUP);
|
||||
@ -138,7 +138,7 @@ toedev_l2_update(struct toedev *tod __unused, struct ifnet *ifp __unused,
|
||||
|
||||
static void
|
||||
toedev_route_redirect(struct toedev *tod __unused, struct ifnet *ifp __unused,
|
||||
struct rtentry *rt0 __unused, struct rtentry *rt1 __unused)
|
||||
struct nhop_object *nh0 __unused, struct nhop_object *nh1 __unused)
|
||||
{
|
||||
|
||||
return;
|
||||
|
@ -41,6 +41,7 @@ struct tcpopt;
|
||||
struct tcphdr;
|
||||
struct in_conninfo;
|
||||
struct tcp_info;
|
||||
struct nhop_object;
|
||||
struct ktls_session;
|
||||
|
||||
struct toedev {
|
||||
@ -51,7 +52,7 @@ struct toedev {
|
||||
* Active open. If a failure occurs, it is reported back by the driver
|
||||
* via toe_connect_failed.
|
||||
*/
|
||||
int (*tod_connect)(struct toedev *, struct socket *, struct rtentry *,
|
||||
int (*tod_connect)(struct toedev *, struct socket *, struct nhop_object *,
|
||||
struct sockaddr *);
|
||||
|
||||
/* Passive open. */
|
||||
@ -95,7 +96,7 @@ struct toedev {
|
||||
|
||||
/* XXX. Route has been redirected. */
|
||||
void (*tod_route_redirect)(struct toedev *, struct ifnet *,
|
||||
struct rtentry *, struct rtentry *);
|
||||
struct nhop_object *, struct nhop_object *);
|
||||
|
||||
/* Syncache interaction. */
|
||||
void (*tod_syncache_added)(struct toedev *, void *);
|
||||
|
Loading…
Reference in New Issue
Block a user