wip2
This commit is contained in:
parent
955b0dfe73
commit
5edb6063aa
42
Makefile
42
Makefile
|
@ -1,14 +1,14 @@
|
|||
DPDK_PATH = dpdk
|
||||
INC = -I./inc -I$(DPDK_PATH)/build/include
|
||||
INC = -I./inc -I/usr/local/include
|
||||
CFLAGS = -g -Wall -std=gnu11 -D_GNU_SOURCE $(INC) -mssse3
|
||||
LDFLAGS = -T base/base.ld -no-pie
|
||||
LDFLAGS = -T base/base.ld -no-pie -Wl,-rpath=/usr/local/lib/gcc10
|
||||
LD = gcc
|
||||
CC = gcc
|
||||
AR = ar
|
||||
SPARSE = sparse
|
||||
# uncomment to autodetect MLX5
|
||||
# MLX5=$(shell lspci | grep 'ConnectX-5' || echo "")
|
||||
MLX4=$(shell lspci | grep 'ConnectX-3' || echo "")
|
||||
# MLX4=$(shell lspci | grep 'ConnectX-3' || echo "")
|
||||
|
||||
CHECKFLAGS = -D__CHECKER__ -Waddress-space
|
||||
|
||||
|
@ -58,19 +58,29 @@ test_obj = $(test_src:.c=.o)
|
|||
test_targets = $(basename $(test_src))
|
||||
|
||||
# dpdk libs
|
||||
DPDK_LIBS= -L$(DPDK_PATH)/build/lib
|
||||
DPDK_LIBS += -Wl,-whole-archive -lrte_pmd_e1000 -Wl,-no-whole-archive
|
||||
DPDK_LIBS += -Wl,-whole-archive -lrte_pmd_ixgbe -Wl,-no-whole-archive
|
||||
DPDK_LIBS += -Wl,-whole-archive -lrte_mempool_ring -Wl,-no-whole-archive
|
||||
DPDK_LIBS += -ldpdk
|
||||
DPDK_LIBS += -lrte_eal
|
||||
DPDK_LIBS += -lrte_ethdev
|
||||
DPDK_LIBS += -lrte_hash
|
||||
DPDK_LIBS += -lrte_mbuf
|
||||
DPDK_LIBS += -lrte_mempool
|
||||
DPDK_LIBS += -lrte_mempool
|
||||
DPDK_LIBS += -lrte_mempool_stack
|
||||
DPDK_LIBS += -lrte_ring
|
||||
DPDK_LIBS = -L/usr/local/lib -lrte_telemetry -lrte_bpf -lrte_flow_classify \
|
||||
-lrte_pipeline -lrte_table -lrte_port -lrte_fib -lrte_ipsec \
|
||||
-lrte_stack -lrte_security -lrte_sched -lrte_reorder -lrte_rib \
|
||||
-lrte_rcu -lrte_rawdev -lrte_pdump -lrte_member -lrte_lpm \
|
||||
-lrte_latencystats -lrte_jobstats -lrte_ip_frag -lrte_gso -lrte_gro \
|
||||
-lrte_eventdev -lrte_efd -lrte_distributor -lrte_cryptodev \
|
||||
-lrte_compressdev -lrte_cfgfile -lrte_bitratestats -lrte_bbdev \
|
||||
-lrte_acl -lrte_timer -lrte_hash -lrte_metrics -lrte_cmdline \
|
||||
-lrte_pci -lrte_ethdev -lrte_meter -lrte_net -lrte_mbuf -lrte_mempool -lrte_mempool_stack \
|
||||
-lrte_ring -lrte_eal -lrte_kvargs
|
||||
#DPDK_LIBS= -L$(DPDK_PATH)/build/lib
|
||||
#DPDK_LIBS += -Wl,-whole-archive -lrte_pmd_e1000 -Wl,-no-whole-archive
|
||||
#DPDK_LIBS += -Wl,-whole-archive -lrte_pmd_ixgbe -Wl,-no-whole-archive
|
||||
#DPDK_LIBS += -Wl,-whole-archive -lrte_mempool_ring -Wl,-no-whole-archive
|
||||
#DPDK_LIBS += -ldpdk
|
||||
#DPDK_LIBS += -lrte_eal
|
||||
#DPDK_LIBS += -lrte_ethdev
|
||||
#DPDK_LIBS += -lrte_hash
|
||||
#DPDK_LIBS += -lrte_mbuf
|
||||
#DPDK_LIBS += -lrte_mempool
|
||||
#DPDK_LIBS += -lrte_mempool_ring
|
||||
#DPDK_LIBS += -lrte_mempool_stack
|
||||
#DPDK_LIBS += -lrte_ring
|
||||
# additional libs for running with Mellanox NICs
|
||||
ifneq ($(MLX5),)
|
||||
DPDK_LIBS += -lrte_pmd_mlx5 -libverbs -lmlx5 -lmnl
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <base/limits.h>
|
||||
|
@ -27,7 +28,8 @@ struct thread_spec {
|
|||
struct queue_spec txcmdq;
|
||||
shmptr_t q_ptrs;
|
||||
pid_t tid;
|
||||
int32_t park_efd;
|
||||
int16_t park_efd;
|
||||
int16_t park_efd_kern;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -144,7 +144,7 @@ int dp_clients_init(void)
|
|||
/* initialize the hash table for mapping MACs to runtimes */
|
||||
hash_params.name = "mac_to_proc_hash_table";
|
||||
hash_params.entries = MAC_TO_PROC_ENTRIES;
|
||||
hash_params.key_len = ETHER_ADDR_LEN;
|
||||
hash_params.key_len = ETH_ADDR_LEN;
|
||||
hash_params.hash_func = rte_jhash;
|
||||
hash_params.hash_func_init_val = 0;
|
||||
hash_params.socket_id = rte_socket_id();
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
static const struct rte_eth_conf port_conf_default = {
|
||||
.rxmode = {
|
||||
.max_rx_pkt_len = ETHER_MAX_LEN,
|
||||
.max_rx_pkt_len = ETH_MAX_LEN,
|
||||
.offloads = DEV_RX_OFFLOAD_IPV4_CKSUM,
|
||||
.mq_mode = ETH_MQ_RX_RSS | ETH_MQ_RX_RSS_FLAG,
|
||||
},
|
||||
|
@ -124,7 +124,7 @@ static inline int dpdk_port_init(uint8_t port, struct rte_mempool *mbuf_pool)
|
|||
return retval;
|
||||
|
||||
/* Display the port MAC address. */
|
||||
struct ether_addr addr;
|
||||
struct rte_ether_addr addr;
|
||||
rte_eth_macaddr_get(port, &addr);
|
||||
log_info("dpdk: port %u MAC: %02" PRIx8 " %02" PRIx8 " %02" PRIx8
|
||||
" %02" PRIx8 " %02" PRIx8 " %02" PRIx8 "",
|
||||
|
|
|
@ -86,8 +86,8 @@ static bool rx_send_pkt_to_runtime(struct proc *p, struct rx_net_hdr *hdr)
|
|||
|
||||
static void rx_one_pkt(struct rte_mbuf *buf)
|
||||
{
|
||||
struct ether_hdr *ptr_mac_hdr;
|
||||
struct ether_addr *ptr_dst_addr;
|
||||
struct rte_ether_hdr *ptr_mac_hdr;
|
||||
struct rte_ether_addr *ptr_dst_addr;
|
||||
struct rx_net_hdr *net_hdr;
|
||||
int i, ret;
|
||||
|
||||
|
@ -100,7 +100,7 @@ static void rx_one_pkt(struct rte_mbuf *buf)
|
|||
ptr_dst_addr->addr_bytes[4], ptr_dst_addr->addr_bytes[5]);
|
||||
|
||||
/* handle unicast destinations (send to a single runtime) */
|
||||
if (likely(is_unicast_ether_addr(ptr_dst_addr))) {
|
||||
if (likely(rte_is_unicast_ether_addr(ptr_dst_addr))) {
|
||||
void *data;
|
||||
struct proc *p;
|
||||
|
||||
|
@ -125,7 +125,7 @@ static void rx_one_pkt(struct rte_mbuf *buf)
|
|||
}
|
||||
|
||||
/* handle broadcast destinations (send to all runtimes) */
|
||||
if (is_broadcast_ether_addr(ptr_dst_addr) && dp.nr_clients > 0) {
|
||||
if (rte_is_broadcast_ether_addr(ptr_dst_addr) && dp.nr_clients > 0) {
|
||||
bool success;
|
||||
int n_sent = 0;
|
||||
|
||||
|
|
|
@ -69,9 +69,9 @@ static void tx_prepare_tx_mbuf(struct rte_mbuf *buf,
|
|||
if (net_hdr->olflags & OLFLAG_IPV6)
|
||||
buf->ol_flags |= PKT_TX_IPV6;
|
||||
|
||||
buf->l4_len = sizeof(struct tcp_hdr);
|
||||
buf->l3_len = sizeof(struct ipv4_hdr);
|
||||
buf->l2_len = ETHER_HDR_LEN;
|
||||
buf->l4_len = sizeof(struct rte_tcp_hdr);
|
||||
buf->l3_len = sizeof(struct rte_ipv4_hdr);
|
||||
buf->l2_len = ETH_HDR_LEN;
|
||||
}
|
||||
|
||||
/* initialize the private data, used to send completion events */
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <runtime/thread.h>
|
||||
#include <runtime/rcu.h>
|
||||
#include <runtime/preempt.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/*
|
||||
|
@ -275,7 +276,8 @@ struct kthread {
|
|||
uint32_t rq_tail;
|
||||
struct list_head rq_overflow;
|
||||
struct lrpc_chan_in rxq;
|
||||
int park_efd;
|
||||
int16_t park_efd;
|
||||
int16_t park_efd_kern;
|
||||
unsigned int parked:1;
|
||||
unsigned int detached:1;
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ int ioqueues_register_iokernel(void)
|
|||
|
||||
/* send efds to iokernel */
|
||||
for (i = 0; i < iok.thread_count; i++)
|
||||
kthread_fds[i] = iok.threads[i].park_efd;
|
||||
kthread_fds[i] = iok.threads[i].park_efd_kern;
|
||||
ret = ioqueues_send_fds(iok.fd, &kthread_fds[0], iok.thread_count);
|
||||
if (ret < 0) {
|
||||
log_err("register_iokernel: ioqueues_send_fds() failed with ret %d",
|
||||
|
@ -311,6 +311,7 @@ int ioqueues_init_thread(void)
|
|||
struct thread_spec *ts = &iok.threads[nrqs++];
|
||||
ts->tid = tid;
|
||||
ts->park_efd = myk()->park_efd;
|
||||
ts->park_efd_kern = myk()->park_efd_kern;
|
||||
spin_unlock(&qlock);
|
||||
|
||||
ret = shm_init_lrpc_in(r, &ts->rxq, &myk()->rxq);
|
||||
|
|
|
@ -42,6 +42,7 @@ struct cpu_record cpu_map[NCPU] __attribute__((aligned(CACHE_LINE_SIZE)));
|
|||
static struct kthread *allock(void)
|
||||
{
|
||||
struct kthread *k;
|
||||
int efds[2];
|
||||
|
||||
k = aligned_alloc(CACHE_LINE_SIZE,
|
||||
align_up(sizeof(*k), CACHE_LINE_SIZE));
|
||||
|
@ -54,7 +55,14 @@ static struct kthread *allock(void)
|
|||
mbufq_init(&k->txpktq_overflow);
|
||||
mbufq_init(&k->txcmdq_overflow);
|
||||
spin_lock_init(&k->timer_lock);
|
||||
k->park_efd = eventfd(0, 0);
|
||||
|
||||
if(pipe(efds) < 0) {
|
||||
BUG_ON(0);
|
||||
}
|
||||
|
||||
k->park_efd = efds[0];
|
||||
k->park_efd_kern = efds[1];
|
||||
|
||||
BUG_ON(k->park_efd < 0);
|
||||
k->detached = true;
|
||||
return k;
|
||||
|
|
Loading…
Reference in New Issue