mirror of https://github.com/F-Stack/f-stack.git
Merge pull request #867 from liujinhui-job/add_loopback_support
add tcp/udp loopback support, we can send packet through lo dev
This commit is contained in:
commit
6b9e2d694f
|
@ -977,6 +977,14 @@ out:
|
|||
#endif
|
||||
}
|
||||
|
||||
void inline
|
||||
ff_swi_net_excute(void)
|
||||
{
|
||||
struct netisr_workstream *nwsp = DPCPU_ID_PTR(0, nws);
|
||||
|
||||
return swi_net((void*)nwsp);
|
||||
}
|
||||
|
||||
static int
|
||||
netisr_queue_workstream(struct netisr_workstream *nwsp, u_int proto,
|
||||
struct netisr_work *npwp, struct mbuf *m, int *dosignalp)
|
||||
|
|
|
@ -1512,6 +1512,11 @@ in_pcbconnect_setup(struct inpcb *inp, struct sockaddr *nam,
|
|||
cred);
|
||||
if (error)
|
||||
return (error);
|
||||
/* Note:
|
||||
* LOOPBACK not support rss.
|
||||
*/
|
||||
if ((ifp->if_softc == NULL) && (ifp->if_flags & IFF_LOOPBACK))
|
||||
break;
|
||||
rss = ff_rss_check(ifp->if_softc, faddr.s_addr, laddr.s_addr,
|
||||
fport, lport);
|
||||
if (rss) {
|
||||
|
|
|
@ -51,6 +51,9 @@ FF_INET6=1
|
|||
FF_TCPHPTS=1
|
||||
FF_EXTRA_TCP_STACKS=1
|
||||
|
||||
# TCP/UDP loopback.
|
||||
#FF_LOOPBACK_SUPPORT=1
|
||||
|
||||
include ${TOPDIR}/mk/kern.pre.mk
|
||||
|
||||
ifneq ($(shell pkg-config --exists libdpdk && echo 0),0)
|
||||
|
@ -143,6 +146,11 @@ HOST_CFLAGS+= -DIPSEC
|
|||
CFLAGS+= -DIPSEC
|
||||
endif
|
||||
|
||||
ifdef FF_LOOPBACK_SUPPORT
|
||||
HOST_CFLAGS+= -DFF_LOOPBACK_SUPPORT
|
||||
CFLAGS+= -DFF_LOOPBACK_SUPPORT
|
||||
endif
|
||||
|
||||
HOST_C= ${CC} -c $(HOST_CFLAGS) ${HOST_INCLUDES} ${WERROR} ${PROF} $<
|
||||
|
||||
|
||||
|
|
|
@ -63,3 +63,4 @@ ff_pthread_create
|
|||
ff_pthread_join
|
||||
pcurthread
|
||||
ff_dpdk_raw_packet_send
|
||||
ff_swi_net_excute
|
||||
|
|
|
@ -2167,7 +2167,9 @@ main_loop(void *arg)
|
|||
}
|
||||
|
||||
process_msg_ring(qconf->proc_id, pkts_burst);
|
||||
|
||||
#ifdef FF_LOOPBACK_SUPPORT
|
||||
ff_swi_net_excute();
|
||||
#endif
|
||||
div_tsc = rte_rdtsc();
|
||||
|
||||
if (likely(lr->loop != NULL && (!idle || cur_tsc - usch_tsc >= drain_tsc))) {
|
||||
|
|
|
@ -78,5 +78,7 @@ int ff_in_pcbladdr(uint16_t family, void *faddr, uint16_t fport, void *laddr);
|
|||
int ff_rss_check(void *softc, uint32_t saddr, uint32_t daddr,
|
||||
uint16_t sport, uint16_t dport);
|
||||
|
||||
void ff_swi_net_excute(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue