This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, next has been updated via e85a5453f2f85e4d5794d3ea2fc9e7b8433485a9 (commit) via 1f99d8573bff477f7190ed167947ca654921ac7a (commit) via b6c25e4c84437304ffc0376f1150682fd19b5c21 (commit) via e1dd174435abfbc8886fcc48e758c080cbc6975b (commit) via 5c47f45bc42f062e94d4e8d8c4e851eb104659a0 (commit) via dc8da17b1a507bc4e35d5e5b094c565a7dfbd211 (commit) via 225de4341d55fa2ad7783e16fd406d47f5a1119e (commit) from 3f4dd655d9e6f097d1c809f7f3ab6f32b345c038 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit e85a5453f2f85e4d5794d3ea2fc9e7b8433485a9 Author: Bill Fischofer bill.fischofer@linaro.org Date: Fri Jan 19 09:24:32 2018 -0600
api: pktio: drop support for indefinite waits on recv_tmo calls
The ODP_PKTIN_WAIT option on odp_pktin_recv_tmo() and odp_pktin_recv_mq_tmo() is deprecated and removed.
Signed-off-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index ad9b29fd..a55c2678 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -72,11 +72,6 @@ extern "C" { * Do not wait on packet input */
-/** - * @def ODP_PKTIN_WAIT - * Wait infinitely on packet input - */ - /** * Packet input mode */ @@ -884,7 +879,6 @@ int odp_pktin_recv(odp_pktin_queue_t queue, odp_packet_t packets[], int num); * @param num Maximum number of packets to receive * @param wait Wait time specified as as follows: * * ODP_PKTIN_NO_WAIT: Do not wait - * * ODP_PKTIN_WAIT: Wait infinitely * * Other values specify the minimum time to wait. * Use odp_pktin_wait_time() to convert nanoseconds * to a valid parameter value. Wait time may be @@ -923,7 +917,6 @@ int odp_pktin_recv_tmo(odp_pktin_queue_t queue, odp_packet_t packets[], * @param num Maximum number of packets to receive * @param wait Wait time specified as as follows: * * ODP_PKTIN_NO_WAIT: Do not wait - * * ODP_PKTIN_WAIT: Wait infinitely * * Other values specify the minimum time to wait. * Use odp_pktin_wait_time() to convert nanoseconds * to a valid parameter value. Wait time may be
commit 1f99d8573bff477f7190ed167947ca654921ac7a Author: Bill Fischofer bill.fischofer@linaro.org Date: Fri Jan 19 09:21:22 2018 -0600
test: validation: drop use of indefinite wait in pktio test
Drop use of deprecated ODP_PKTIN_WAIT timeout option in pktio tests.
Signed-off-by: Bill Fischofer bill.fischofer@linaro.org Reviewed-by: Petri Savolainen petri.savolainen@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index 884292fa..ecab4448 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -553,10 +553,8 @@ static int recv_packets_tmo(odp_pktio_t pktio, odp_packet_t pkt_tbl[], CU_ASSERT(from_val < (unsigned)num_q); } while (num_rx < num);
- if (tmo == ODP_PKTIN_WAIT) - CU_ASSERT(num_rx == num); if (num_rx < num) - CU_ASSERT(odp_time_to_ns(odp_time_diff(ts2, ts1)) >= ns); + CU_ASSERT(odp_time_diff_ns(ts2, ts1) >= ns);
return num_rx; } @@ -980,7 +978,7 @@ static void test_recv_tmo(recv_tmo_mode_e mode) CU_ASSERT_FATAL(ret == test_pkt_count);
ret = recv_packets_tmo(pktio_rx, &pkt_tbl[0], &pkt_seq[0], 1, mode, - ODP_PKTIN_WAIT, 0); + odp_pktin_wait_time(UINT64_MAX), 0); CU_ASSERT_FATAL(ret == 1);
ret = recv_packets_tmo(pktio_rx, &pkt_tbl[1], &pkt_seq[1], 1, mode,
commit b6c25e4c84437304ffc0376f1150682fd19b5c21 Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Jan 12 17:06:38 2018 +0200
validation: packet: test user pointer init to NULL
Test if user pointer is NULL after alloc and reset.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index c8ef92df..3e8e00d9 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -322,6 +322,9 @@ static void packet_test_alloc_free(void) CU_ASSERT(odp_packet_to_u64(packet) != odp_packet_to_u64(ODP_PACKET_INVALID));
+ /* User pointer should be NULL after alloc */ + CU_ASSERT(odp_packet_user_ptr(packet) == NULL); + /* Pool should have only one packet */ CU_ASSERT_FATAL(odp_packet_alloc(pool, packet_len) == ODP_PACKET_INVALID); @@ -401,6 +404,9 @@ static void packet_test_alloc_free_multi(void) CU_ASSERT(subtype == ODP_EVENT_PACKET_BASIC); CU_ASSERT(odp_packet_to_u64(packet[i]) != odp_packet_to_u64(ODP_PACKET_INVALID)); + + /* User pointer should be NULL after alloc */ + CU_ASSERT(odp_packet_user_ptr(packet[i]) == NULL); }
/* Pools should have no more packets */ @@ -680,7 +686,15 @@ static void packet_test_context(void) CU_ASSERT(memcmp(udat, &test_packet_udata, sizeof(struct udata_struct)) == 0);
+ odp_packet_user_ptr_set(pkt, NULL); + CU_ASSERT(odp_packet_user_ptr(pkt) == NULL); + odp_packet_user_ptr_set(pkt, (void *)0xdead); + CU_ASSERT(odp_packet_user_ptr(pkt) == (void *)0xdead); + odp_packet_reset(pkt, packet_len); + + /* User pointer should be NULL after reset */ + CU_ASSERT(odp_packet_user_ptr(pkt) == NULL); }
static void packet_test_layer_offsets(void)
commit e1dd174435abfbc8886fcc48e758c080cbc6975b Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Jan 12 16:10:04 2018 +0200
linux-gen: packet: initialize user ptr to NULL
Use a flag to record if user pointer has been set. This avoids resetting the pointer in every alloc.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index e0ef31a0..2e8efecb 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -44,6 +44,7 @@ typedef struct _odp_packet_inline_offset_t { uint16_t flow_hash; uint16_t timestamp; uint16_t input_flags; + uint16_t flags;
} _odp_packet_inline_offset_t;
@@ -108,7 +109,12 @@ typedef union { uint32_t all_flags;
struct { - uint32_t reserved1: 12; + uint32_t reserved1: 11; + + /* + * Init flags + */ + uint32_t user_ptr_set: 1; /* User has set a non-NULL value */
/* * Packet output flags @@ -134,8 +140,8 @@ typedef union {
/* Flag groups */ struct { - uint32_t reserved2: 12; - uint32_t other: 12; /* All other flags */ + uint32_t reserved2: 11; + uint32_t other: 13; /* All other flags */ uint32_t error: 8; /* All error flags */ } all;
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inlines.h b/platform/linux-generic/include/odp/api/plat/packet_inlines.h index 276c69df..b6b49336 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inlines.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inlines.h @@ -104,6 +104,13 @@ static inline int _odp_packet_num_segs(odp_packet_t pkt)
static inline void *_odp_packet_user_ptr(odp_packet_t pkt) { + _odp_packet_flags_t flags; + + flags.all_flags = _odp_pkt_get(pkt, uint32_t, flags); + + if (flags.user_ptr_set == 0) + return NULL; + return _odp_pkt_get(pkt, void *, user_ptr); }
diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 2642bac6..22df7d67 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -45,7 +45,8 @@ const _odp_packet_inline_offset_t ODP_ALIGNED_CACHE _odp_packet_inline = { .l4_offset = offsetof(odp_packet_hdr_t, p.l4_offset), .flow_hash = offsetof(odp_packet_hdr_t, flow_hash), .timestamp = offsetof(odp_packet_hdr_t, timestamp), - .input_flags = offsetof(odp_packet_hdr_t, p.input_flags) + .input_flags = offsetof(odp_packet_hdr_t, p.input_flags), + .flags = offsetof(odp_packet_hdr_t, p.flags)
};
@@ -1265,7 +1266,15 @@ void *odp_packet_offset(odp_packet_t pkt, uint32_t offset, uint32_t *len,
void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ptr) { - packet_hdr(pkt)->buf_hdr.user_ptr = ptr; + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (odp_unlikely(ptr == NULL)) { + pkt_hdr->p.flags.user_ptr_set = 0; + return; + } + + pkt_hdr->buf_hdr.user_ptr = ptr; + pkt_hdr->p.flags.user_ptr_set = 1; }
int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset)
commit 5c47f45bc42f062e94d4e8d8c4e851eb104659a0 Author: Petri Savolainen petri.savolainen@linaro.org Date: Fri Jan 12 12:53:11 2018 +0200
api: packet: initialize user ptr to NULL
Require that implementation initializes the pointer value to NULL. Application can use the pointer more robustly when it can tell if the pointer has been set previously or not.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index a1111325..3222ff5c 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1341,7 +1341,10 @@ int odp_packet_input_index(odp_packet_t pkt); /** * User context pointer * - * Return previously stored user context pointer. + * Return previously stored user context pointer. If not otherwise documented, + * the pointer value is maintained over packet manipulating operations. + * Implementation initializes the pointer value to NULL during new packet + * creation (e.g. alloc and packet input) and reset. * * @param pkt Packet handle * @@ -1357,10 +1360,10 @@ void *odp_packet_user_ptr(odp_packet_t pkt); * value of type intptr_t. ODP may use the pointer for data prefetching, but * must ignore any invalid addresses. * - * @param pkt Packet handle - * @param ctx User context pointer + * @param pkt Packet handle + * @param user_ptr User context pointer */ -void odp_packet_user_ptr_set(odp_packet_t pkt, const void *ctx); +void odp_packet_user_ptr_set(odp_packet_t pkt, const void *user_ptr);
/** * User area address
commit dc8da17b1a507bc4e35d5e5b094c565a7dfbd211 Author: Petri Savolainen petri.savolainen@linaro.org Date: Mon Jan 15 13:33:58 2018 +0200
linux-gen: packet: clean up error and output flags
Removed three unused error flags. Combined error and output flags into a single uint32_t. This saves four bytes and init of those bytes. There's still room for 12 flags in this word. Later on, these and input flags could be also combined.
Moved the combined flag structure to packet types header, so that it can be accessed from inlined packet code.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 7331c1c6..e0ef31a0 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -100,6 +100,47 @@ typedef union {
} _odp_packet_input_flags_t;
+/* + * Additional packet flags + */ +typedef union { + /* All flags */ + uint32_t all_flags; + + struct { + uint32_t reserved1: 12; + + /* + * Packet output flags + */ + uint32_t l3_chksum_set: 1; /* L3 chksum bit is valid */ + uint32_t l3_chksum: 1; /* L3 chksum override */ + uint32_t l4_chksum_set: 1; /* L4 chksum bit is valid */ + uint32_t l4_chksum: 1; /* L4 chksum override */ + uint32_t shaper_len_adj: 8; /* Adjustment for traffic mgr */ + + /* + * Error flags + */ + uint32_t snap_len_err: 1; /* Snap length error */ + uint32_t ip_err: 1; /* IP error */ + uint32_t l3_chksum_err: 1; /* L3 checksum error */ + uint32_t tcp_err: 1; /* TCP error */ + uint32_t udp_err: 1; /* UDP error */ + uint32_t l4_chksum_err: 1; /* L4 checksum error */ + uint32_t ipsec_err: 1; /* IPsec error */ + uint32_t crypto_err: 1; /* Crypto packet operation error */ + }; + + /* Flag groups */ + struct { + uint32_t reserved2: 12; + uint32_t other: 12; /* All other flags */ + uint32_t error: 8; /* All error flags */ + } all; + +} _odp_packet_flags_t; + /** @endcond */
#ifdef __cplusplus diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 9db53e7c..75b4ce9e 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -33,65 +33,21 @@ extern "C" { /** Minimum segment length expected by packet_parse_common() */ #define PACKET_PARSE_SEG_LEN 96
- ODP_STATIC_ASSERT(sizeof(_odp_packet_input_flags_t) == sizeof(uint64_t), "INPUT_FLAGS_SIZE_ERROR");
-/** - * Packet error flags - */ -typedef union { - /* All error flags */ - uint32_t all; - - struct { - /* Bitfield flags for each detected error */ - uint32_t app_error:1; /**< Error bit for application use */ - uint32_t frame_len:1; /**< Frame length error */ - uint32_t snap_len:1; /**< Snap length error */ - uint32_t l2_chksum:1; /**< L2 checksum error, checks TBD */ - uint32_t ip_err:1; /**< IP error, checks TBD */ - uint32_t l3_chksum:1; /**< L3 checksum error */ - uint32_t tcp_err:1; /**< TCP error, checks TBD */ - uint32_t udp_err:1; /**< UDP error, checks TBD */ - uint32_t ipsec_err:1; /**< IPsec error */ - uint32_t crypto_err:1; /**< Crypto packet operation error */ - uint32_t l4_chksum:1; /**< L4 checksum error */ - }; -} error_flags_t; - -ODP_STATIC_ASSERT(sizeof(error_flags_t) == sizeof(uint32_t), - "ERROR_FLAGS_SIZE_ERROR"); - -/** - * Packet output flags - */ -typedef union { - /* All output flags */ - uint32_t all; - - struct { - /** adjustment for traffic mgr */ - uint32_t shaper_len_adj:8; - - /* Bitfield flags for each output option */ - uint32_t l3_chksum_set:1; /**< L3 chksum bit is valid */ - uint32_t l3_chksum:1; /**< L3 chksum override */ - uint32_t l4_chksum_set:1; /**< L3 chksum bit is valid */ - uint32_t l4_chksum:1; /**< L4 chksum override */ - }; -} output_flags_t; - -ODP_STATIC_ASSERT(sizeof(output_flags_t) == sizeof(uint32_t), - "OUTPUT_FLAGS_SIZE_ERROR"); +ODP_STATIC_ASSERT(sizeof(_odp_packet_flags_t) == sizeof(uint32_t), + "PACKET_FLAGS_SIZE_ERROR");
/** * Packet parser metadata */ typedef struct { + /* Packet input flags */ _odp_packet_input_flags_t input_flags; - error_flags_t error_flags; - output_flags_t output_flags; + + /* Other flags */ + _odp_packet_flags_t flags;
/* offset to L2 hdr, e.g. Eth */ uint16_t l2_offset; @@ -232,8 +188,7 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, uint32_t len) }
pkt_hdr->p.input_flags.all = 0; - pkt_hdr->p.output_flags.all = 0; - pkt_hdr->p.error_flags.all = 0; + pkt_hdr->p.flags.all_flags = 0;
pkt_hdr->p.l2_offset = 0; pkt_hdr->p.l3_offset = ODP_PACKET_OFFSET_INVALID; diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 7c77885f..14720924 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -947,7 +947,7 @@ static inline cos_t *cls_select_cos(pktio_entry_t *entry, default_cos = cls->default_cos;
/* Return error cos for error packet */ - if (pkt_hdr->p.error_flags.all) + if (pkt_hdr->p.flags.all.error) return cls->error_cos; /* Calls all the PMRs attached at the PKTIO level*/ for (i = 0; i < odp_atomic_load_u32(&default_cos->s.num_rule); i++) { diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 7ad3d5c7..4b2b884a 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -1533,7 +1533,7 @@ int odp_crypto_int(odp_packet_t pkt_in, (rc_auth == ODP_CRYPTO_ALG_ERR_NONE);
pkt_hdr = packet_hdr(out_pkt); - pkt_hdr->p.error_flags.crypto_err = !op_result->ok; + pkt_hdr->p.flags.crypto_err = !op_result->ok;
/* Synchronous, simply return results */ *pkt_out = out_pkt; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index b28547a2..8d897771 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -831,7 +831,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt,
err: pkt_hdr = packet_hdr(pkt); - pkt_hdr->p.error_flags.ipsec_err = 1; + pkt_hdr->p.flags.ipsec_err = 1;
*pkt_out = pkt;
@@ -1408,7 +1408,7 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, err: pkt_hdr = packet_hdr(pkt);
- pkt_hdr->p.error_flags.ipsec_err = 1; + pkt_hdr->p.flags.ipsec_err = 1;
*pkt_out = pkt; return ipsec_sa; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 37449845..2642bac6 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -383,9 +383,8 @@ int _odp_packet_copy_to_mem_seg(odp_packet_t pkt, uint32_t offset, void packet_parse_reset(odp_packet_hdr_t *pkt_hdr) { /* Reset parser metadata before new parse */ - pkt_hdr->p.error_flags.all = 0; pkt_hdr->p.input_flags.all = 0; - pkt_hdr->p.output_flags.all = 0; + pkt_hdr->p.flags.all.error = 0; pkt_hdr->p.l2_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->p.l3_offset = ODP_PACKET_OFFSET_INVALID; pkt_hdr->p.l4_offset = ODP_PACKET_OFFSET_INVALID; @@ -1315,16 +1314,16 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int insert) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
- pkt_hdr->p.output_flags.l3_chksum_set = 1; - pkt_hdr->p.output_flags.l3_chksum = insert; + pkt_hdr->p.flags.l3_chksum_set = 1; + pkt_hdr->p.flags.l3_chksum = insert; }
void odp_packet_l4_chksum_insert(odp_packet_t pkt, int insert) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
- pkt_hdr->p.output_flags.l4_chksum_set = 1; - pkt_hdr->p.output_flags.l4_chksum = insert; + pkt_hdr->p.flags.l4_chksum_set = 1; + pkt_hdr->p.flags.l4_chksum = insert; }
odp_packet_chksum_status_t odp_packet_l3_chksum_status(odp_packet_t pkt) @@ -1334,7 +1333,7 @@ odp_packet_chksum_status_t odp_packet_l3_chksum_status(odp_packet_t pkt) if (!pkt_hdr->p.input_flags.l3_chksum_done) return ODP_PACKET_CHKSUM_UNKNOWN;
- if (pkt_hdr->p.error_flags.l3_chksum) + if (pkt_hdr->p.flags.l3_chksum_err) return ODP_PACKET_CHKSUM_BAD;
return ODP_PACKET_CHKSUM_OK; @@ -1347,7 +1346,7 @@ odp_packet_chksum_status_t odp_packet_l4_chksum_status(odp_packet_t pkt) if (!pkt_hdr->p.input_flags.l4_chksum_done) return ODP_PACKET_CHKSUM_UNKNOWN;
- if (pkt_hdr->p.error_flags.l4_chksum) + if (pkt_hdr->p.flags.l4_chksum_err) return ODP_PACKET_CHKSUM_BAD;
return ODP_PACKET_CHKSUM_OK; @@ -1739,11 +1738,8 @@ void odp_packet_print(odp_packet_t pkt) len += odp_buffer_snprint(&str[len], n - len, buf); len += snprintf(&str[len], n - len, " input_flags 0x%" PRIx64 "\n", hdr->p.input_flags.all); - len += snprintf(&str[len], n - len, " error_flags 0x%" PRIx32 "\n", - hdr->p.error_flags.all); - len += snprintf(&str[len], n - len, - " output_flags 0x%" PRIx32 "\n", - hdr->p.output_flags.all); + len += snprintf(&str[len], n - len, " flags 0x%" PRIx32 "\n", + hdr->p.flags.all_flags); len += snprintf(&str[len], n - len, " l2_offset %" PRIu32 "\n", hdr->p.l2_offset); len += snprintf(&str[len], n - len, @@ -1950,7 +1946,7 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, if (odp_unlikely(ethtype < _ODP_ETH_LEN_MAX)) { input_flags.snap = 1; if (ethtype > frame_len - *offset) { - prs->error_flags.snap_len = 1; + prs->flags.snap_len_err = 1; ethtype = 0; goto error; } @@ -2001,7 +1997,7 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, if (odp_unlikely(ihl < _ODP_IPV4HDR_IHL_MIN || ver != 4 || (l3_len > frame_len - *offset))) { - prs->error_flags.ip_err = 1; + prs->flags.ip_err = 1; return 0; }
@@ -2045,7 +2041,7 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, /* Basic sanity checks on IPv6 header */ if ((_odp_be_to_cpu_32(ipv6->ver_tc_flow) >> 28) != 6 || l3_len > frame_len - *offset) { - prs->error_flags.ip_err = 1; + prs->flags.ip_err = 1; return 0; }
@@ -2074,7 +2070,7 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr,
if (*offset >= prs->l3_offset + _odp_be_to_cpu_16(ipv6->payload_len)) { - prs->error_flags.ip_err = 1; + prs->flags.ip_err = 1; return 0; }
@@ -2101,7 +2097,7 @@ static inline void parse_tcp(packet_parser_t *prs, const uint8_t **parseptr) uint32_t len = tcp->hl * 4;
if (odp_unlikely(tcp->hl < sizeof(_odp_tcphdr_t) / sizeof(uint32_t))) - prs->error_flags.tcp_err = 1; + prs->flags.tcp_err = 1;
*parseptr += len; } @@ -2116,7 +2112,7 @@ static inline void parse_udp(packet_parser_t *prs, const uint8_t **parseptr) uint16_t ipsec_port = _odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT);
if (odp_unlikely(udplen < sizeof(_odp_udphdr_t))) - prs->error_flags.udp_err = 1; + prs->flags.udp_err = 1;
if (odp_unlikely(ipsec_port == udp->dst_port && udplen > 4)) { uint32_t val; @@ -2142,7 +2138,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, prs->l3_offset = offset;
if (odp_unlikely(layer <= ODP_PROTO_LAYER_L2)) - return prs->error_flags.all != 0; + return prs->flags.all.error != 0;
/* Set l3 flag only for known ethtypes */ prs->input_flags.l3 = 1; @@ -2173,7 +2169,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, }
if (layer == ODP_PROTO_LAYER_L3) - return prs->error_flags.all != 0; + return prs->flags.all.error != 0;
/* Set l4 flag only for known ip_proto */ prs->input_flags.l4 = 1; @@ -2224,7 +2220,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, break; }
- return prs->error_flags.all != 0; + return prs->flags.all.error != 0; }
/** diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 79472131..efd564d0 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -24,7 +24,7 @@ int odp_packet_has_error(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
- return pkt_hdr->p.error_flags.all != 0; + return pkt_hdr->p.flags.all.error != 0; }
/* Get Input Flags */ @@ -34,9 +34,7 @@ int odp_packet_has_l2_error(odp_packet_t pkt) odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); /* L2 parsing is always done by default and hence no additional check is required */ - return pkt_hdr->p.error_flags.frame_len - | pkt_hdr->p.error_flags.snap_len - | pkt_hdr->p.error_flags.l2_chksum; + return pkt_hdr->p.flags.snap_len_err; }
int odp_packet_has_l3(odp_packet_t pkt) @@ -48,7 +46,7 @@ int odp_packet_has_l3_error(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
- return pkt_hdr->p.error_flags.ip_err; + return pkt_hdr->p.flags.ip_err; }
int odp_packet_has_l4(odp_packet_t pkt) @@ -60,7 +58,7 @@ int odp_packet_has_l4_error(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
- return pkt_hdr->p.error_flags.tcp_err | pkt_hdr->p.error_flags.udp_err; + return pkt_hdr->p.flags.tcp_err | pkt_hdr->p.flags.udp_err; }
int odp_packet_has_eth_bcast(odp_packet_t pkt) @@ -169,14 +167,14 @@ void odp_packet_drop_eligible_set(odp_packet_t pkt, odp_bool_t drop)
int8_t odp_packet_shaper_len_adjust(odp_packet_t pkt) { - retflag(pkt, output_flags.shaper_len_adj); + retflag(pkt, flags.shaper_len_adj); }
void odp_packet_shaper_len_adjust_set(odp_packet_t pkt, int8_t adj) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt);
- pkt_hdr->p.output_flags.shaper_len_adj = adj; + pkt_hdr->p.flags.shaper_len_adj = adj; }
/* Set Input Flags */ diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index a2ec0f8d..a31b0dbb 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -380,8 +380,8 @@ static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, return -1;
pkt_hdr->p.input_flags.l3_chksum_done = 1; - pkt_hdr->p.error_flags.ip_err = 1; - pkt_hdr->p.error_flags.l3_chksum = 1; + pkt_hdr->p.flags.ip_err = 1; + pkt_hdr->p.flags.l3_chksum_err = 1; } }
@@ -396,8 +396,8 @@ static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, return -1;
pkt_hdr->p.input_flags.l4_chksum_done = 1; - pkt_hdr->p.error_flags.udp_err = 1; - pkt_hdr->p.error_flags.l4_chksum = 1; + pkt_hdr->p.flags.udp_err = 1; + pkt_hdr->p.flags.l4_chksum_err = 1; } } else if (pktin_cfg->bit.tcp_chksum && HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_TCP)) { @@ -410,8 +410,8 @@ static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, return -1;
pkt_hdr->p.input_flags.l4_chksum_done = 1; - pkt_hdr->p.error_flags.tcp_err = 1; - pkt_hdr->p.error_flags.l4_chksum = 1; + pkt_hdr->p.flags.tcp_err = 1; + pkt_hdr->p.flags.l4_chksum_err = 1; } }
@@ -573,18 +573,18 @@ static inline void pkt_set_ol_tx(odp_pktout_config_opt_t *pktout_cfg, ipv4_chksum_pkt = OL_TX_CHKSUM_PKT(pktout_cfg->bit.ipv4_chksum, pktout_capa->bit.ipv4_chksum, l3_proto_v4, - pkt_p->output_flags.l3_chksum_set, - pkt_p->output_flags.l3_chksum); + pkt_p->flags.l3_chksum_set, + pkt_p->flags.l3_chksum); udp_chksum_pkt = OL_TX_CHKSUM_PKT(pktout_cfg->bit.udp_chksum, pktout_capa->bit.udp_chksum, (l4_proto == _ODP_IPPROTO_UDP), - pkt_p->output_flags.l4_chksum_set, - pkt_p->output_flags.l4_chksum); + pkt_p->flags.l4_chksum_set, + pkt_p->flags.l4_chksum); tcp_chksum_pkt = OL_TX_CHKSUM_PKT(pktout_cfg->bit.tcp_chksum, pktout_capa->bit.tcp_chksum, (l4_proto == _ODP_IPPROTO_TCP), - pkt_p->output_flags.l4_chksum_set, - pkt_p->output_flags.l4_chksum); + pkt_p->flags.l4_chksum_set, + pkt_p->flags.l4_chksum);
if (!ipv4_chksum_pkt && !udp_chksum_pkt && !tcp_chksum_pkt) return; diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 6b531c08..7fc0fd61 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -156,7 +156,7 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
/* Try IPsec inline processing */ if (pktio_entry->s.config.inbound_ipsec && - !pkt_hdr->p.error_flags.ip_err && + !pkt_hdr->p.flags.ip_err && _odp_packet_has_ipsec(pkt)) _odp_ipsec_try_inline(&pkt);
commit 225de4341d55fa2ad7783e16fd406d47f5a1119e Author: Petri Savolainen petri.savolainen@linaro.org Date: Mon Jan 15 13:23:21 2018 +0200
linux-gen: packet: hide internal definitions from Doxygen
This internal header file is included from API files and thus Doxygen sees it. Use Doxygen tag @cond to hide implementation internal definitions. Dummy Doxygen doxumentation is not needed any more.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 880fd01f..7331c1c6 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -20,100 +20,88 @@ extern "C" {
#include <stdint.h>
-/** @internal Packet field accessor */ +/** @cond _ODP_HIDE_FROM_DOXYGEN_ */ + +/* Packet field accessor */ #define _odp_pkt_get(pkt, cast, field) \ (*(cast *)(uintptr_t)((uint8_t *)pkt + _odp_packet_inline.field))
-/** @internal Packet header field offsets for inline functions */ +/* Packet header field offsets for inline functions */ typedef struct _odp_packet_inline_offset_t { - /** @internal field offset */ uint16_t data; - /** @internal field offset */ uint16_t seg_len; - /** @internal field offset */ uint16_t frame_len; - /** @internal field offset */ uint16_t headroom; - /** @internal field offset */ uint16_t tailroom; - /** @internal field offset */ uint16_t pool; - /** @internal field offset */ uint16_t input; - /** @internal field offset */ uint16_t segcount; - /** @internal field offset */ uint16_t user_ptr; - /** @internal field offset */ uint16_t user_area; - /** @internal field offset */ uint16_t l2_offset; - /** @internal field offset */ uint16_t l3_offset; - /** @internal field offset */ uint16_t l4_offset; - /** @internal field offset */ uint16_t flow_hash; - /** @internal field offset */ uint16_t timestamp; - /** @internal field offset */ uint16_t input_flags;
} _odp_packet_inline_offset_t;
-/** @internal Packet input & protocol flags */ +/* Packet input & protocol flags */ typedef union { - /** All input flags */ + /* All input flags */ uint64_t all;
- /** Individual input flags */ + /* Individual input flags */ struct { - uint64_t dst_queue:1; /**< Dst queue present */ + uint64_t dst_queue:1; /* Dst queue present */
- uint64_t flow_hash:1; /**< Flow hash present */ - uint64_t timestamp:1; /**< Timestamp present */ + uint64_t flow_hash:1; /* Flow hash present */ + uint64_t timestamp:1; /* Timestamp present */
- uint64_t l2:1; /**< known L2 protocol present */ - uint64_t l3:1; /**< known L3 protocol present */ - uint64_t l4:1; /**< known L4 protocol present */ + uint64_t l2:1; /* known L2 protocol present */ + uint64_t l3:1; /* known L3 protocol present */ + uint64_t l4:1; /* known L4 protocol present */
- uint64_t eth:1; /**< Ethernet */ - uint64_t eth_bcast:1; /**< Ethernet broadcast */ - uint64_t eth_mcast:1; /**< Ethernet multicast */ - uint64_t jumbo:1; /**< Jumbo frame */ - uint64_t vlan:1; /**< VLAN hdr found */ - uint64_t vlan_qinq:1; /**< Stacked VLAN found, QinQ */ + uint64_t eth:1; /* Ethernet */ + uint64_t eth_bcast:1; /* Ethernet broadcast */ + uint64_t eth_mcast:1; /* Ethernet multicast */ + uint64_t jumbo:1; /* Jumbo frame */ + uint64_t vlan:1; /* VLAN hdr found */ + uint64_t vlan_qinq:1; /* Stacked VLAN found, QinQ */
- uint64_t snap:1; /**< SNAP */ - uint64_t arp:1; /**< ARP */ + uint64_t snap:1; /* SNAP */ + uint64_t arp:1; /* ARP */
- uint64_t ipv4:1; /**< IPv4 */ - uint64_t ipv6:1; /**< IPv6 */ - uint64_t ip_bcast:1; /**< IP broadcast */ - uint64_t ip_mcast:1; /**< IP multicast */ - uint64_t ipfrag:1; /**< IP fragment */ - uint64_t ipopt:1; /**< IP optional headers */ + uint64_t ipv4:1; /* IPv4 */ + uint64_t ipv6:1; /* IPv6 */ + uint64_t ip_bcast:1; /* IP broadcast */ + uint64_t ip_mcast:1; /* IP multicast */ + uint64_t ipfrag:1; /* IP fragment */ + uint64_t ipopt:1; /* IP optional headers */
- uint64_t ipsec:1; /**< IPSec packet. Required by the + uint64_t ipsec:1; /* IPSec packet. Required by the odp_packet_has_ipsec_set() func. */ - uint64_t ipsec_ah:1; /**< IPSec authentication header */ - uint64_t ipsec_esp:1; /**< IPSec encapsulating security + uint64_t ipsec_ah:1; /* IPSec authentication header */ + uint64_t ipsec_esp:1; /* IPSec encapsulating security payload */ - uint64_t udp:1; /**< UDP */ - uint64_t tcp:1; /**< TCP */ - uint64_t sctp:1; /**< SCTP */ - uint64_t icmp:1; /**< ICMP */ + uint64_t udp:1; /* UDP */ + uint64_t tcp:1; /* TCP */ + uint64_t sctp:1; /* SCTP */ + uint64_t icmp:1; /* ICMP */
- uint64_t color:2; /**< Packet color for traffic mgmt */ - uint64_t nodrop:1; /**< Drop eligibility status */ + uint64_t color:2; /* Packet color for traffic mgmt */ + uint64_t nodrop:1; /* Drop eligibility status */
- uint64_t l3_chksum_done:1; /**< L3 checksum validation done */ - uint64_t l4_chksum_done:1; /**< L4 checksum validation done */ - uint64_t ipsec_udp:1; /**< UDP-encapsulated IPsec packet */ + uint64_t l3_chksum_done:1; /* L3 checksum validation done */ + uint64_t l4_chksum_done:1; /* L4 checksum validation done */ + uint64_t ipsec_udp:1; /* UDP-encapsulated IPsec packet */ };
} _odp_packet_input_flags_t;
+/** @endcond */ + #ifdef __cplusplus } #endif
-----------------------------------------------------------------------
Summary of changes: include/odp/api/spec/packet.h | 11 +- include/odp/api/spec/packet_io.h | 7 - .../include/odp/api/plat/packet_inline_types.h | 141 +++++++++++++-------- .../include/odp/api/plat/packet_inlines.h | 7 + .../linux-generic/include/odp_packet_internal.h | 59 +-------- platform/linux-generic/odp_classification.c | 2 +- platform/linux-generic/odp_crypto.c | 2 +- platform/linux-generic/odp_ipsec.c | 4 +- platform/linux-generic/odp_packet.c | 53 ++++---- platform/linux-generic/odp_packet_flags.c | 14 +- platform/linux-generic/pktio/dpdk.c | 24 ++-- platform/linux-generic/pktio/loop.c | 2 +- test/validation/api/packet/packet.c | 14 ++ test/validation/api/pktio/pktio.c | 6 +- 14 files changed, 177 insertions(+), 169 deletions(-)
hooks/post-receive