aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libtle_l4p/misc.h20
-rw-r--r--lib/libtle_l4p/stream.h8
-rw-r--r--lib/libtle_l4p/tcp_misc.h22
-rw-r--r--lib/libtle_l4p/tcp_rxtx.c45
-rw-r--r--lib/libtle_l4p/udp_rxtx.c18
5 files changed, 59 insertions, 54 deletions
diff --git a/lib/libtle_l4p/misc.h b/lib/libtle_l4p/misc.h
index 327296f..e1efb0d 100644
--- a/lib/libtle_l4p/misc.h
+++ b/lib/libtle_l4p/misc.h
@@ -207,7 +207,7 @@ __udptcp_mbuf_cksum(const struct rte_mbuf *mb, uint16_t l4_ofs,
* The non-complemented checksum to set in the L4 header.
*/
static inline uint16_t
-_ipv4x_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, size_t ipv4h_len,
+_ipv4x_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, size_t ipv4h_len,
uint64_t ol_flags)
{
uint32_t s0, s1;
@@ -243,7 +243,7 @@ _ipv4x_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, size_t ipv4h_len,
*/
static inline int
_ipv4_udptcp_mbuf_cksum(const struct rte_mbuf *mb, uint16_t l4_ofs,
- const struct ipv4_hdr *ipv4_hdr)
+ const struct rte_ipv4_hdr *ipv4_hdr)
{
uint32_t cksum;
@@ -267,7 +267,7 @@ _ipv4_udptcp_mbuf_cksum(const struct rte_mbuf *mb, uint16_t l4_ofs,
*/
static inline int
_ipv6_udptcp_mbuf_cksum(const struct rte_mbuf *mb, uint16_t l4_ofs,
- const struct ipv6_hdr *ipv6_hdr)
+ const struct rte_ipv6_hdr *ipv6_hdr)
{
uint32_t cksum;
@@ -293,9 +293,9 @@ static inline int
check_pkt_csum(const struct rte_mbuf *m, uint64_t ol_flags, uint32_t type,
uint32_t proto)
{
- const struct ipv4_hdr *l3h4;
- const struct ipv6_hdr *l3h6;
- const struct udp_hdr *l4h;
+ const struct rte_ipv4_hdr *l3h4;
+ const struct rte_ipv6_hdr *l3h6;
+ const struct rte_udp_hdr *l4h;
uint64_t fl3, fl4;
uint16_t csum;
int32_t ret;
@@ -313,8 +313,10 @@ check_pkt_csum(const struct rte_mbuf *m, uint64_t ol_flags, uint32_t type,
return 1;
/* case 2: either ip or l4 or both cksum is unknown */
- l3h4 = rte_pktmbuf_mtod_offset(m, const struct ipv4_hdr *, m->l2_len);
- l3h6 = rte_pktmbuf_mtod_offset(m, const struct ipv6_hdr *, m->l2_len);
+ l3h4 = rte_pktmbuf_mtod_offset(m, const struct rte_ipv4_hdr *,
+ m->l2_len);
+ l3h6 = rte_pktmbuf_mtod_offset(m, const struct rte_ipv6_hdr *,
+ m->l2_len);
ret = 0;
if (fl3 == PKT_RX_IP_CKSUM_UNKNOWN && l3h4->hdr_checksum != 0) {
@@ -329,7 +331,7 @@ check_pkt_csum(const struct rte_mbuf *m, uint64_t ol_flags, uint32_t type,
* for IPv6 valid UDP cksum is mandatory.
*/
if (type == TLE_V4) {
- l4h = (const struct udp_hdr *)((uintptr_t)l3h4 +
+ l4h = (const struct rte_udp_hdr *)((uintptr_t)l3h4 +
m->l3_len);
csum = (proto == IPPROTO_UDP && l4h->dgram_cksum == 0) ?
UINT16_MAX : _ipv4_udptcp_mbuf_cksum(m,
diff --git a/lib/libtle_l4p/stream.h b/lib/libtle_l4p/stream.h
index 49a2809..ebefa6c 100644
--- a/lib/libtle_l4p/stream.h
+++ b/lib/libtle_l4p/stream.h
@@ -151,13 +151,13 @@ stream_get_dest(struct tle_stream *s, const void *dst_addr,
dst->ol_flags = dev->tx.ol_flags[s->type];
if (s->type == TLE_V4) {
- struct ipv4_hdr *l3h;
- l3h = (struct ipv4_hdr *)(dst->hdr + dst->l2_len);
+ struct rte_ipv4_hdr *l3h;
+ l3h = (struct rte_ipv4_hdr *)(dst->hdr + dst->l2_len);
l3h->src_addr = dev->prm.local_addr4.s_addr;
l3h->dst_addr = d4->s_addr;
} else {
- struct ipv6_hdr *l3h;
- l3h = (struct ipv6_hdr *)(dst->hdr + dst->l2_len);
+ struct rte_ipv6_hdr *l3h;
+ l3h = (struct rte_ipv6_hdr *)(dst->hdr + dst->l2_len);
rte_memcpy(l3h->src_addr, &dev->prm.local_addr6,
sizeof(l3h->src_addr));
rte_memcpy(l3h->dst_addr, d6, sizeof(l3h->dst_addr));
diff --git a/lib/libtle_l4p/tcp_misc.h b/lib/libtle_l4p/tcp_misc.h
index 0cef8b2..01c1e67 100644
--- a/lib/libtle_l4p/tcp_misc.h
+++ b/lib/libtle_l4p/tcp_misc.h
@@ -33,10 +33,10 @@ extern "C" {
#define TCP_WSCALE_DEFAULT 7
#define TCP_WSCALE_NONE 0
-#define TCP_TX_HDR_MAX (sizeof(struct tcp_hdr) + TCP_TX_OPT_LEN_MAX)
+#define TCP_TX_HDR_MAX (sizeof(struct rte_tcp_hdr) + TCP_TX_OPT_LEN_MAX)
/* max header size for normal data+ack packet */
-#define TCP_TX_HDR_DACK (sizeof(struct tcp_hdr) + TCP_TX_OPT_LEN_TMS)
+#define TCP_TX_HDR_DACK (sizeof(struct rte_tcp_hdr) + TCP_TX_OPT_LEN_TMS)
#define TCP4_MIN_MSS 536
@@ -44,10 +44,12 @@ extern "C" {
/* default MTU, no TCP options. */
#define TCP4_NOP_MSS \
- (ETHER_MTU - sizeof(struct ipv4_hdr) - sizeof(struct tcp_hdr))
+ (RTE_ETHER_MTU - sizeof(struct rte_ipv4_hdr) - \
+ sizeof(struct rte_tcp_hdr))
#define TCP6_NOP_MSS \
- (ETHER_MTU - sizeof(struct ipv6_hdr) - sizeof(struct tcp_hdr))
+ (RTE_ETHER_MTU - sizeof(struct rte_ipv6_hdr) - \
+ sizeof(struct rte_tcp_hdr))
/* default MTU, TCP options present */
#define TCP4_OP_MSS (TCP4_NOP_MSS - TCP_TX_OPT_LEN_MAX)
@@ -256,7 +258,7 @@ tcp_seq_min(uint32_t l, uint32_t r)
}
static inline void
-get_seg_info(const struct tcp_hdr *th, union seg_info *si)
+get_seg_info(const struct rte_tcp_hdr *th, union seg_info *si)
{
__m128i v;
const __m128i bswap_mask =
@@ -421,7 +423,7 @@ static inline void
get_pkt_info(const struct rte_mbuf *m, union pkt_info *pi, union seg_info *si)
{
uint32_t len, type;
- const struct tcp_hdr *tcph;
+ const struct rte_tcp_hdr *tcph;
const union l4_ports *prt;
const union ipv4_addrs *pa4;
@@ -436,17 +438,17 @@ get_pkt_info(const struct rte_mbuf *m, union pkt_info *pi, union seg_info *si)
if (type == TLE_V4) {
pa4 = rte_pktmbuf_mtod_offset(m, const union ipv4_addrs *,
- len + offsetof(struct ipv4_hdr, src_addr));
+ len + offsetof(struct rte_ipv4_hdr, src_addr));
pi->addr4.raw = pa4->raw;
} else if (type == TLE_V6) {
pi->addr6 = rte_pktmbuf_mtod_offset(m, const union ipv6_addrs *,
- len + offsetof(struct ipv6_hdr, src_addr));
+ len + offsetof(struct rte_ipv6_hdr, src_addr));
}
len += m->l3_len;
- tcph = rte_pktmbuf_mtod_offset(m, const struct tcp_hdr *, len);
+ tcph = rte_pktmbuf_mtod_offset(m, const struct rte_tcp_hdr *, len);
prt = (const union l4_ports *)
- ((uintptr_t)tcph + offsetof(struct tcp_hdr, src_port));
+ ((uintptr_t)tcph + offsetof(struct rte_tcp_hdr, src_port));
pi->tf.flags = tcph->tcp_flags;
pi->tf.type = type;
pi->csf = m->ol_flags & (PKT_RX_IP_CKSUM_MASK | PKT_RX_L4_CKSUM_MASK);
diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c
index b4bc626..b1aad60 100644
--- a/lib/libtle_l4p/tcp_rxtx.c
+++ b/lib/libtle_l4p/tcp_rxtx.c
@@ -183,7 +183,7 @@ get_ip_pid(struct tle_dev *dev, uint32_t num, uint32_t type, uint32_t st)
}
static inline void
-fill_tcph(struct tcp_hdr *l4h, const struct tcb *tcb, union l4_ports port,
+fill_tcph(struct rte_tcp_hdr *l4h, const struct tcb *tcb, union l4_ports port,
uint32_t seq, uint8_t hlen, uint8_t flags)
{
uint16_t wnd;
@@ -217,7 +217,7 @@ tcp_fill_mbuf(struct rte_mbuf *m, const struct tle_tcp_stream *s,
uint32_t pid, uint32_t swcsm)
{
uint32_t l4, len, plen;
- struct tcp_hdr *l4h;
+ struct rte_tcp_hdr *l4h;
char *l2h;
len = dst->l2_len + dst->l3_len;
@@ -239,7 +239,7 @@ tcp_fill_mbuf(struct rte_mbuf *m, const struct tle_tcp_stream *s,
rte_memcpy(l2h, dst->hdr, len);
/* setup TCP header & options */
- l4h = (struct tcp_hdr *)(l2h + len);
+ l4h = (struct rte_tcp_hdr *)(l2h + len);
fill_tcph(l4h, &s->tcb, port, seq, l4, flags);
/* setup mbuf TX offload related fields. */
@@ -249,8 +249,8 @@ tcp_fill_mbuf(struct rte_mbuf *m, const struct tle_tcp_stream *s,
/* update proto specific fields. */
if (s->s.type == TLE_V4) {
- struct ipv4_hdr *l3h;
- l3h = (struct ipv4_hdr *)(l2h + dst->l2_len);
+ struct rte_ipv4_hdr *l3h;
+ l3h = (struct rte_ipv4_hdr *)(l2h + dst->l2_len);
l3h->packet_id = rte_cpu_to_be_16(pid);
l3h->total_length = rte_cpu_to_be_16(plen + dst->l3_len + l4);
@@ -263,8 +263,8 @@ tcp_fill_mbuf(struct rte_mbuf *m, const struct tle_tcp_stream *s,
if ((ol_flags & PKT_TX_IP_CKSUM) == 0 && swcsm != 0)
l3h->hdr_checksum = _ipv4x_cksum(l3h, m->l3_len);
} else {
- struct ipv6_hdr *l3h;
- l3h = (struct ipv6_hdr *)(l2h + dst->l2_len);
+ struct rte_ipv6_hdr *l3h;
+ l3h = (struct rte_ipv6_hdr *)(l2h + dst->l2_len);
l3h->payload_len = rte_cpu_to_be_16(plen + l4);
if ((ol_flags & PKT_TX_TCP_CKSUM) != 0)
l4h->cksum = rte_ipv6_phdr_cksum(l3h, ol_flags);
@@ -285,11 +285,11 @@ static inline void
tcp_update_mbuf(struct rte_mbuf *m, uint32_t type, const struct tcb *tcb,
uint32_t seq, uint32_t pid)
{
- struct tcp_hdr *l4h;
+ struct rte_tcp_hdr *l4h;
uint32_t len;
len = m->l2_len + m->l3_len;
- l4h = rte_pktmbuf_mtod_offset(m, struct tcp_hdr *, len);
+ l4h = rte_pktmbuf_mtod_offset(m, struct rte_tcp_hdr *, len);
l4h->sent_seq = rte_cpu_to_be_32(seq);
l4h->recv_ack = rte_cpu_to_be_32(tcb->rcv.nxt);
@@ -298,8 +298,9 @@ tcp_update_mbuf(struct rte_mbuf *m, uint32_t type, const struct tcb *tcb,
fill_tms_opts(l4h + 1, tcb->snd.ts, tcb->rcv.ts);
if (type == TLE_V4) {
- struct ipv4_hdr *l3h;
- l3h = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len);
+ struct rte_ipv4_hdr *l3h;
+ l3h = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
+ m->l2_len);
l3h->hdr_checksum = 0;
l3h->packet_id = rte_cpu_to_be_16(pid);
if ((m->ol_flags & PKT_TX_IP_CKSUM) == 0)
@@ -312,14 +313,14 @@ tcp_update_mbuf(struct rte_mbuf *m, uint32_t type, const struct tcb *tcb,
l4h->cksum = 0;
if (type == TLE_V4) {
- struct ipv4_hdr *l3h;
- l3h = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *,
+ struct rte_ipv4_hdr *l3h;
+ l3h = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *,
m->l2_len);
l4h->cksum = _ipv4_udptcp_mbuf_cksum(m, len, l3h);
} else {
- struct ipv6_hdr *l3h;
- l3h = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *,
+ struct rte_ipv6_hdr *l3h;
+ l3h = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *,
m->l2_len);
l4h->cksum = _ipv6_udptcp_mbuf_cksum(m, len, l3h);
}
@@ -635,7 +636,7 @@ sync_ack(struct tle_tcp_stream *s, const union pkt_info *pi,
struct tle_dev *dev;
const void *da;
struct tle_dest dst;
- const struct tcp_hdr *th;
+ const struct rte_tcp_hdr *th;
type = s->s.type;
@@ -649,7 +650,7 @@ sync_ack(struct tle_tcp_stream *s, const union pkt_info *pi,
if (rc < 0)
return rc;
- th = rte_pktmbuf_mtod_offset(m, const struct tcp_hdr *,
+ th = rte_pktmbuf_mtod_offset(m, const struct rte_tcp_hdr *,
m->l2_len + m->l3_len);
get_syn_opts(&s->tcb.so, (uintptr_t)(th + 1), m->l4_len - sizeof(*th));
@@ -714,7 +715,7 @@ rx_tms_opt(const struct tcb *tcb, const struct rte_mbuf *mb)
{
union tsopt ts;
uintptr_t opt;
- const struct tcp_hdr *th;
+ const struct rte_tcp_hdr *th;
if (tcb->so.ts.val != 0) {
opt = rte_pktmbuf_mtod_offset(mb, uintptr_t,
@@ -786,7 +787,7 @@ restore_syn_opt(union seg_info *si, union tsopt *to,
{
int32_t rc;
uint32_t len;
- const struct tcp_hdr *th;
+ const struct rte_tcp_hdr *th;
/* check that ACK, etc fields are what we expected. */
rc = sync_check_ack(pi, si->seq, si->ack - 1, ts,
@@ -797,7 +798,7 @@ restore_syn_opt(union seg_info *si, union tsopt *to,
si->mss = rc;
- th = rte_pktmbuf_mtod_offset(mb, const struct tcp_hdr *,
+ th = rte_pktmbuf_mtod_offset(mb, const struct rte_tcp_hdr *,
mb->l2_len + mb->l3_len);
len = mb->l4_len - sizeof(*th);
to[0] = get_tms_opts((uintptr_t)(th + 1), len);
@@ -1553,7 +1554,7 @@ rx_synack(struct tle_tcp_stream *s, uint32_t ts, uint32_t state,
struct resp_info *rsp)
{
struct syn_opts so;
- struct tcp_hdr *th;
+ struct rte_tcp_hdr *th;
if (state != TCP_ST_SYN_SENT)
return -EINVAL;
@@ -1570,7 +1571,7 @@ rx_synack(struct tle_tcp_stream *s, uint32_t ts, uint32_t state,
return 0;
}
- th = rte_pktmbuf_mtod_offset(mb, struct tcp_hdr *,
+ th = rte_pktmbuf_mtod_offset(mb, struct rte_tcp_hdr *,
mb->l2_len + mb->l3_len);
get_syn_opts(&so, (uintptr_t)(th + 1), mb->l4_len - sizeof(*th));
diff --git a/lib/libtle_l4p/udp_rxtx.c b/lib/libtle_l4p/udp_rxtx.c
index 84a13ea..8963df5 100644
--- a/lib/libtle_l4p/udp_rxtx.c
+++ b/lib/libtle_l4p/udp_rxtx.c
@@ -69,16 +69,16 @@ pkt_info(struct rte_mbuf *m, union l4_ports *ports, union ipv4_addrs *addr4,
len = m->l2_len;
if (ret.src == TLE_V4) {
pa4 = rte_pktmbuf_mtod_offset(m, union ipv4_addrs *,
- len + offsetof(struct ipv4_hdr, src_addr));
+ len + offsetof(struct rte_ipv4_hdr, src_addr));
addr4->raw = pa4->raw;
} else if (ret.src == TLE_V6) {
*addr6 = rte_pktmbuf_mtod_offset(m, union ipv6_addrs *,
- len + offsetof(struct ipv6_hdr, src_addr));
+ len + offsetof(struct rte_ipv6_hdr, src_addr));
}
len += m->l3_len;
up = rte_pktmbuf_mtod_offset(m, union l4_ports *,
- len + offsetof(struct udp_hdr, src_port));
+ len + offsetof(struct rte_udp_hdr, src_port));
ports->raw = up->raw;
ret.dst = ports->dst;
return ret;
@@ -355,8 +355,8 @@ udp_fill_mbuf(struct rte_mbuf *m,
/* update proto specific fields. */
if (type == TLE_V4) {
- struct ipv4_hdr *l3h;
- l3h = (struct ipv4_hdr *)(l2h + dst->l2_len);
+ struct rte_ipv4_hdr *l3h;
+ l3h = (struct rte_ipv4_hdr *)(l2h + dst->l2_len);
l3h->packet_id = rte_cpu_to_be_16(pid);
l3h->total_length = rte_cpu_to_be_16(plen + dst->l3_len +
sizeof(*l4h));
@@ -370,8 +370,8 @@ udp_fill_mbuf(struct rte_mbuf *m,
if ((ol_flags & PKT_TX_IP_CKSUM) == 0)
l3h->hdr_checksum = _ipv4x_cksum(l3h, m->l3_len);
} else {
- struct ipv6_hdr *l3h;
- l3h = (struct ipv6_hdr *)(l2h + dst->l2_len);
+ struct rte_ipv6_hdr *l3h;
+ l3h = (struct rte_ipv6_hdr *)(l2h + dst->l2_len);
l3h->payload_len = rte_cpu_to_be_16(plen + sizeof(*l4h));
if ((ol_flags & PKT_TX_UDP_CKSUM) != 0)
l4h->cksum = rte_ipv6_phdr_cksum(l3h, ol_flags);
@@ -389,13 +389,13 @@ udp_fill_mbuf(struct rte_mbuf *m,
static inline void
frag_fixup(const struct rte_mbuf *ms, struct rte_mbuf *mf, uint32_t type)
{
- struct ipv4_hdr *l3h;
+ struct rte_ipv4_hdr *l3h;
mf->ol_flags = ms->ol_flags;
mf->tx_offload = ms->tx_offload;
if (type == TLE_V4 && (ms->ol_flags & PKT_TX_IP_CKSUM) == 0) {
- l3h = rte_pktmbuf_mtod(mf, struct ipv4_hdr *);
+ l3h = rte_pktmbuf_mtod(mf, struct rte_ipv4_hdr *);
l3h->hdr_checksum = _ipv4x_cksum(l3h, mf->l3_len);
}
}