diff options
Diffstat (limited to 'odp/odp-linux')
4 files changed, 303 insertions, 0 deletions
diff --git a/odp/odp-linux/0001-linux-generic-pool-Return-address-range-in-pool-info.patch b/odp/odp-linux/0001-linux-generic-pool-Return-address-range-in-pool-info.patch new file mode 100644 index 00000000..6c6ffee9 --- /dev/null +++ b/odp/odp-linux/0001-linux-generic-pool-Return-address-range-in-pool-info.patch @@ -0,0 +1,33 @@ +From 4ad1d3be11d5c421567134a53384374a81ad3db4 Mon Sep 17 00:00:00 2001 +From: Michal Mazur <mkm@semihalf.com> +Date: Wed, 31 Jan 2018 16:32:54 +0100 +Subject: [PATCH 1/4] linux-generic: pool: Return address range in pool info + +Implement support in odp_pool_info API to provide address range +of application accessible pool data (linux-generic platform). + +Pull request of API change for reference: +https://github.com/Linaro/odp/pull/200 + +Signed-off-by: Michal Mazur <mkm@semihalf.com> +--- + platform/linux-generic/odp_pool.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c +index e20693d..a33dd45 100644 +--- a/platform/linux-generic/odp_pool.c ++++ b/platform/linux-generic/odp_pool.c +@@ -692,6 +692,9 @@ int odp_pool_info(odp_pool_t pool_hdl, odp_pool_info_t *info) + if (pool->params.type == ODP_POOL_PACKET) + info->pkt.max_num = pool->num; + ++ info->min_data_addr = (uint64_t) pool->base_addr; ++ info->max_data_addr = (uint64_t) pool->base_addr + pool->shm_size - 1; ++ + return 0; + } + +-- +2.7.4 + diff --git a/odp/odp-linux/0002-linux-generic-Place-userdata-before-packet-data.patch b/odp/odp-linux/0002-linux-generic-Place-userdata-before-packet-data.patch new file mode 100644 index 00000000..4ec30ad3 --- /dev/null +++ b/odp/odp-linux/0002-linux-generic-Place-userdata-before-packet-data.patch @@ -0,0 +1,153 @@ +From 89ea1eb01acb424afd1ec340b6e0cea80904d0aa Mon Sep 17 00:00:00 2001 +From: Michal Mazur <mkm@semihalf.com> +Date: Wed, 31 Jan 2018 16:32:54 +0100 +Subject: [PATCH 2/4] linux-generic: Place userdata before packet data + +Signed-off-by: Michal Mazur <mkm@semihalf.com> +--- + .../linux-generic/include/odp_packet_internal.h | 4 +-- + platform/linux-generic/include/odp_pool_internal.h | 3 -- + platform/linux-generic/odp_pool.c | 37 ++++------------------ + 3 files changed, 9 insertions(+), 35 deletions(-) + +diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h +index 62888f8..dc827ab 100644 +--- a/platform/linux-generic/include/odp_packet_internal.h ++++ b/platform/linux-generic/include/odp_packet_internal.h +@@ -161,8 +161,8 @@ typedef struct { + /* Context for IPsec */ + odp_ipsec_packet_result_t ipsec_ctx; + +- /* Packet data storage */ +- uint8_t data[0]; ++ /* Packet data or user area */ ++ uint8_t data[0] ODP_ALIGNED_CACHE; + } odp_packet_hdr_t; + + /** +diff --git a/platform/linux-generic/include/odp_pool_internal.h b/platform/linux-generic/include/odp_pool_internal.h +index 61ec5cc..f1892f0 100644 +--- a/platform/linux-generic/include/odp_pool_internal.h ++++ b/platform/linux-generic/include/odp_pool_internal.h +@@ -54,7 +54,6 @@ typedef struct pool_t { + uint32_t pool_idx; + uint32_t ring_mask; + odp_shm_t shm; +- odp_shm_t uarea_shm; + int reserved; + uint32_t num; + uint32_t align; +@@ -66,9 +65,7 @@ typedef struct pool_t { + uint32_t uarea_size; + uint32_t block_size; + uint32_t shm_size; +- uint32_t uarea_shm_size; + uint8_t *base_addr; +- uint8_t *uarea_base_addr; + + /* Used by DPDK zero-copy pktio */ + uint8_t mem_from_huge_pages; +diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c +index a33dd45..2d50e14 100644 +--- a/platform/linux-generic/odp_pool.c ++++ b/platform/linux-generic/odp_pool.c +@@ -278,14 +278,16 @@ static void init_buffers(pool_t *pool) + continue; + } + } +- if (pool->uarea_size) +- uarea = &pool->uarea_base_addr[(i - skipped_blocks) * +- pool->uarea_size]; +- data = buf_hdr->data; + ++ data = buf_hdr->data; + if (type == ODP_POOL_PACKET) + data = pkt_hdr->data; + ++ if (pool->uarea_size) { ++ uarea = data; ++ data = (uint8_t *)((uintptr_t)data + pool->uarea_size); ++ } ++ + offset = pool->headroom; + + /* move to correct align */ +@@ -451,7 +453,7 @@ static odp_pool_t pool_create(const char *name, odp_pool_param_t *params, + hdr_size = ROUNDUP_CACHE_LINE(hdr_size); + + block_size = ROUNDUP_CACHE_LINE(hdr_size + align + headroom + seg_len + +- tailroom); ++ tailroom + uarea_size); + + /* Allocate extra memory for skipping packet buffers which cross huge + * page boundaries. */ +@@ -478,7 +480,6 @@ static odp_pool_t pool_create(const char *name, odp_pool_param_t *params, + pool->block_size = block_size; + pool->uarea_size = uarea_size; + pool->shm_size = (num + num_extra) * block_size; +- pool->uarea_shm_size = num * uarea_size; + pool->ext_desc = NULL; + pool->ext_destroy = NULL; + +@@ -496,20 +497,6 @@ static odp_pool_t pool_create(const char *name, odp_pool_param_t *params, + + pool->base_addr = odp_shm_addr(pool->shm); + +- pool->uarea_shm = ODP_SHM_INVALID; +- if (uarea_size) { +- shm = odp_shm_reserve(uarea_name, pool->uarea_shm_size, +- ODP_PAGE_SIZE, shmflags); +- +- pool->uarea_shm = shm; +- +- if (shm == ODP_SHM_INVALID) { +- ODP_ERR("Shm reserve failed (uarea)"); +- goto error; +- } +- +- pool->uarea_base_addr = odp_shm_addr(pool->uarea_shm); +- } + + ring_init(&pool->ring->hdr); + init_buffers(pool); +@@ -520,9 +507,6 @@ error: + if (pool->shm != ODP_SHM_INVALID) + odp_shm_free(pool->shm); + +- if (pool->uarea_shm != ODP_SHM_INVALID) +- odp_shm_free(pool->uarea_shm); +- + LOCK(&pool->lock); + pool->reserved = 0; + UNLOCK(&pool->lock); +@@ -638,9 +622,6 @@ int odp_pool_destroy(odp_pool_t pool_hdl) + + odp_shm_free(pool->shm); + +- if (pool->uarea_shm != ODP_SHM_INVALID) +- odp_shm_free(pool->uarea_shm); +- + pool->reserved = 0; + odp_shm_free(pool->ring_shm); + pool->ring = NULL; +@@ -948,8 +929,6 @@ void odp_pool_print(odp_pool_t pool_hdl) + "unknown"))); + ODP_PRINT(" pool shm %" PRIu64 "\n", + odp_shm_to_u64(pool->shm)); +- ODP_PRINT(" user area shm %" PRIu64 "\n", +- odp_shm_to_u64(pool->uarea_shm)); + ODP_PRINT(" num %u\n", pool->num); + ODP_PRINT(" align %u\n", pool->align); + ODP_PRINT(" headroom %u\n", pool->headroom); +@@ -960,8 +939,6 @@ void odp_pool_print(odp_pool_t pool_hdl) + ODP_PRINT(" uarea size %u\n", pool->uarea_size); + ODP_PRINT(" shm size %u\n", pool->shm_size); + ODP_PRINT(" base addr %p\n", pool->base_addr); +- ODP_PRINT(" uarea shm size %u\n", pool->uarea_shm_size); +- ODP_PRINT(" uarea base addr %p\n", pool->uarea_base_addr); + ODP_PRINT("\n"); + } + +-- +2.7.4 + diff --git a/odp/odp-linux/0003-HACK-enable-inline-in-dpdk-pktio.patch b/odp/odp-linux/0003-HACK-enable-inline-in-dpdk-pktio.patch new file mode 100644 index 00000000..036b5f99 --- /dev/null +++ b/odp/odp-linux/0003-HACK-enable-inline-in-dpdk-pktio.patch @@ -0,0 +1,59 @@ +From 566de3dd20df4a4d7d68091e934f59a8849e678c Mon Sep 17 00:00:00 2001 +From: Szymon Sliwa <szs@semihalf.com> +Date: Wed, 31 Jan 2018 14:51:23 +0100 +Subject: [PATCH 3/4] [HACK] enable inline in dpdk pktio + +Added simple lines which enable IPsec inline mode +on RX using dpdk pktio. The changes are not intended to be +pushed to main odp repository - these are only minimal changes +to make use of the functionality. + +Signed-off-by: Szymon Sliwa <szs@semihalf.com> +--- + platform/linux-generic/pktio/dpdk.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c +index 54fd0bd..ce835d8 100644 +--- a/platform/linux-generic/pktio/dpdk.c ++++ b/platform/linux-generic/pktio/dpdk.c +@@ -22,6 +22,7 @@ + + #include <odp_packet_io_internal.h> + #include <odp_classification_internal.h> ++#include <odp_ipsec_internal.h> + #include <odp_packet_dpdk.h> + #include <odp_debug_internal.h> + +@@ -1285,6 +1286,8 @@ static void dpdk_init_capability(pktio_entry_t *pktio_entry, + capa->config.pktout.bit.udp_chksum; + capa->config.pktout.bit.tcp_chksum_ena = + capa->config.pktout.bit.tcp_chksum; ++ capa->config.inbound_ipsec = 1; ++ capa->config.outbound_ipsec = 1; + } + + static int dpdk_open(odp_pktio_t id ODP_UNUSED, +@@ -1566,6 +1569,19 @@ static int dpdk_recv(pktio_entry_t *pktio_entry, int index, + else + nb_rx = mbuf_to_pkt(pktio_entry, pkt_table, rx_mbufs, + nb_rx, ts); ++ ++ /* Try IPsec inline processing */ ++ for (i = 0; i < nb_rx; i++) { ++ odp_packet_t pkt = pkt_table[i]; ++ odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); ++ ++ packet_parse_layer(pkt_hdr, ODP_PROTO_LAYER_L4); ++ ++ if(odp_packet_has_ipsec(pkt_table[i])) ++ _odp_ipsec_try_inline(pkt_table[i]); ++ ++ } ++ + } + + return nb_rx; +-- +2.7.4 + diff --git a/odp/odp-linux/0004-HACK-enable-inline-in-socket-pktio.patch b/odp/odp-linux/0004-HACK-enable-inline-in-socket-pktio.patch new file mode 100644 index 00000000..85a1d18d --- /dev/null +++ b/odp/odp-linux/0004-HACK-enable-inline-in-socket-pktio.patch @@ -0,0 +1,58 @@ +From 0b92516dd24764c3c54b30acb3a96aca94803a8b Mon Sep 17 00:00:00 2001 +From: Szymon Sliwa <szs@semihalf.com> +Date: Thu, 22 Feb 2018 14:32:45 +0100 +Subject: [PATCH 4/4] [HACK] enable inline in socket pktio + +Added simple lines which enable IPsec inline mode +on RX using socket pktio. The changes are not intended to be +pushed to main odp repository - these are only minimal changes +to make use of the functionality. + +Signed-off-by: Szymon Sliwa <szs@semihalf.com> +--- + platform/linux-generic/pktio/socket_mmap.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c +index c63a253..f7cc8e1 100644 +--- a/platform/linux-generic/pktio/socket_mmap.c ++++ b/platform/linux-generic/pktio/socket_mmap.c +@@ -32,6 +32,7 @@ + #include <odp_classification_datamodel.h> + #include <odp_classification_inlines.h> + #include <odp_classification_internal.h> ++#include <odp_ipsec_internal.h> + #include <odp/api/hints.h> + + #include <protocols/eth.h> +@@ -244,6 +245,18 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, + nb_rx++; + } + ++ /* Try IPsec inline processing */ ++ for (i = 0; i < nb_rx; i++) { ++ odp_packet_t pkt = pkt_table[i]; ++ odp_packet_hdr_t *pkt_hdr = odp_packet_hdr(pkt); ++ ++ packet_parse_layer(pkt_hdr, ODP_PROTO_LAYER_L4); ++ ++ if(odp_packet_has_ipsec(pkt_table[i])) ++ _odp_ipsec_try_inline(pkt_table[i]); ++ ++ } ++ + ring->frame_num = frame_num; + return nb_rx; + } +@@ -671,6 +684,8 @@ static int sock_mmap_capability(pktio_entry_t *pktio_entry ODP_UNUSED, + odp_pktio_config_init(&capa->config); + capa->config.pktin.bit.ts_all = 1; + capa->config.pktin.bit.ts_ptp = 1; ++ capa->config.inbound_ipsec = 1; ++ capa->config.outbound_ipsec = 1; + return 0; + } + +-- +2.7.4 + |