diff options
author | Konstantin Ananyev <konstantin.ananyev@intel.com> | 2017-02-21 18:12:20 +0000 |
---|---|---|
committer | Konstantin Ananyev <konstantin.ananyev@intel.com> | 2017-02-24 16:37:08 +0000 |
commit | aa97dd1ce910b839fed46ad55d1e70e403f5a930 (patch) | |
tree | f6f0fd494eaf499859bff9f20f5ddfac9ab99233 /lib/libtle_udp/udp_impl.h | |
parent | f5f10013ffef8e4ac1071087b8492fe6380d98fe (diff) |
Introduce first version of TCP code.
Supported functionality:
- open/close
- listen/accept/connect
- send/recv
In order to achieve that libtle_udp library was
reworked into libtle_l4p library that supports
both TCP and UDP protocols.
New libtle_timer library was introduced
(thanks to Cisco guys and Dave Barach <dbarach@cisco.com>
for sharing their timer code with us).
Sample application was also reworked significantly
to support both TCP and UDP traffic handling.
New UT were introduced.
Change-Id: I806b05011f521e89b58db403cfdd484a37beb775
Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Signed-off-by: Karol Latecki <karolx.latecki@intel.com>
Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Diffstat (limited to 'lib/libtle_udp/udp_impl.h')
-rw-r--r-- | lib/libtle_udp/udp_impl.h | 166 |
1 files changed, 0 insertions, 166 deletions
diff --git a/lib/libtle_udp/udp_impl.h b/lib/libtle_udp/udp_impl.h deleted file mode 100644 index af35197..0000000 --- a/lib/libtle_udp/udp_impl.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2016 Intel Corporation. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _UDP_IMPL_H_ -#define _UDP_IMPL_H_ - -#include <rte_spinlock.h> -#include <rte_vect.h> -#include <tle_dring.h> -#include <tle_udp_impl.h> -#include <tle_event.h> - -#include "port_bitmap.h" -#include "osdep.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - TLE_UDP_V4, - TLE_UDP_V6, - TLE_UDP_VNUM -}; - -union udp_ports { - uint32_t raw; - struct { - uint16_t src; - uint16_t dst; - }; -}; - -union udph { - uint64_t raw; - struct { - union udp_ports ports; - uint16_t len; - uint16_t cksum; - }; -}; - -union ipv4_addrs { - uint64_t raw; - struct { - uint32_t src; - uint32_t dst; - }; -}; - -union ipv6_addrs { - _ymm_t raw; - struct { - rte_xmm_t src; - rte_xmm_t dst; - }; -}; - -union ip_addrs { - union ipv4_addrs v4; - union ipv6_addrs v6; -}; - - -struct tle_udp_stream { - - STAILQ_ENTRY(tle_udp_stream) link; - struct tle_udp_ctx *ctx; - - uint8_t type; /* TLE_UDP_V4 or TLE_UDP_V6 */ - - struct { - struct rte_ring *q; - struct tle_event *ev; - struct tle_udp_stream_cb cb; - rte_atomic32_t use; - } rx; - - union udp_ports port; - union udp_ports pmsk; - - union { - struct { - union ipv4_addrs addr; - union ipv4_addrs mask; - } ipv4; - struct { - union ipv6_addrs addr; - union ipv6_addrs mask; - } ipv6; - }; - - struct { - rte_atomic32_t use; - struct { - uint32_t nb_elem; /* number of obects per drb. */ - uint32_t nb_max; /* number of drbs per stream. */ - struct rte_ring *r; - } drb; - struct tle_event *ev; - struct tle_udp_stream_cb cb; - } tx __rte_cache_aligned; - - struct tle_udp_stream_param prm; -} __rte_cache_aligned; - -#define UDP_STREAM_TX_PENDING(s) \ - ((s)->tx.drb.nb_max != rte_ring_count((s)->tx.drb.r)) - -#define UDP_STREAM_TX_FINISHED(s) \ - ((s)->tx.drb.nb_max == rte_ring_count((s)->tx.drb.r)) - -struct tle_udp_dport { - struct udp_pbm use; /* ports in use. */ - struct tle_udp_stream *streams[MAX_PORT_NUM]; /* port to stream. */ -}; - -struct tle_udp_dev { - struct tle_udp_ctx *ctx; - struct { - uint64_t ol_flags[TLE_UDP_VNUM]; - } rx; - struct { - /* used by FE. */ - uint64_t ol_flags[TLE_UDP_VNUM]; - rte_atomic32_t packet_id[TLE_UDP_VNUM]; - - /* used by FE & BE. */ - struct tle_dring dr; - } tx; - struct tle_udp_dev_param prm; /* copy of device paramaters. */ - struct tle_udp_dport *dp[TLE_UDP_VNUM]; /* device udp ports */ -}; - -struct tle_udp_ctx { - struct tle_udp_ctx_param prm; - struct { - rte_spinlock_t lock; - uint32_t nb_free; /* number of free streams. */ - STAILQ_HEAD(, tle_udp_stream) free; - struct tle_udp_stream *buf; /* array of streams */ - } streams; - - rte_spinlock_t dev_lock; - uint32_t nb_dev; - struct udp_pbm use[TLE_UDP_VNUM]; /* all ports in use. */ - struct tle_udp_dev dev[RTE_MAX_ETHPORTS]; -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _UDP_IMPL_H_ */ |