@@ -137,4 +137,6 @@ void app_main_loop_tx(void);
#define APP_FLUSH 0x3FF
#endif
+#define APP_METADATA_OFFSET(offset) (sizeof(struct rte_mbuf) + (offset))
+
#endif /* _MAIN_H_ */
@@ -163,8 +163,8 @@ app_main_loop_worker_pipeline_hash(void) {
.n_buckets_ext = 1 << 21,
.f_hash = test_hash,
.seed = 0,
- .signature_offset = 0,
- .key_offset = 32,
+ .signature_offset = APP_METADATA_OFFSET(0),
+ .key_offset = APP_METADATA_OFFSET(32),
};
struct rte_pipeline_table_params table_params = {
@@ -214,8 +214,8 @@ app_main_loop_worker_pipeline_hash(void) {
struct rte_table_hash_key8_ext_params table_hash_params = {
.n_entries = 1 << 24,
.n_entries_ext = 1 << 23,
- .signature_offset = 0,
- .key_offset = 32,
+ .signature_offset = APP_METADATA_OFFSET(0),
+ .key_offset = APP_METADATA_OFFSET(32),
.f_hash = test_hash,
.seed = 0,
};
@@ -238,8 +238,8 @@ app_main_loop_worker_pipeline_hash(void) {
{
struct rte_table_hash_key8_lru_params table_hash_params = {
.n_entries = 1 << 24,
- .signature_offset = 0,
- .key_offset = 32,
+ .signature_offset = APP_METADATA_OFFSET(0),
+ .key_offset = APP_METADATA_OFFSET(32),
.f_hash = test_hash,
.seed = 0,
};
@@ -263,8 +263,8 @@ app_main_loop_worker_pipeline_hash(void) {
struct rte_table_hash_key16_ext_params table_hash_params = {
.n_entries = 1 << 24,
.n_entries_ext = 1 << 23,
- .signature_offset = 0,
- .key_offset = 32,
+ .signature_offset = APP_METADATA_OFFSET(0),
+ .key_offset = APP_METADATA_OFFSET(32),
.f_hash = test_hash,
.seed = 0,
};
@@ -287,8 +287,8 @@ app_main_loop_worker_pipeline_hash(void) {
{
struct rte_table_hash_key16_lru_params table_hash_params = {
.n_entries = 1 << 24,
- .signature_offset = 0,
- .key_offset = 32,
+ .signature_offset = APP_METADATA_OFFSET(0),
+ .key_offset = APP_METADATA_OFFSET(32),
.f_hash = test_hash,
.seed = 0,
};
@@ -312,8 +312,8 @@ app_main_loop_worker_pipeline_hash(void) {
struct rte_table_hash_key32_ext_params table_hash_params = {
.n_entries = 1 << 24,
.n_entries_ext = 1 << 23,
- .signature_offset = 0,
- .key_offset = 32,
+ .signature_offset = APP_METADATA_OFFSET(0),
+ .key_offset = APP_METADATA_OFFSET(32),
.f_hash = test_hash,
.seed = 0,
};
@@ -337,8 +337,8 @@ app_main_loop_worker_pipeline_hash(void) {
{
struct rte_table_hash_key32_lru_params table_hash_params = {
.n_entries = 1 << 24,
- .signature_offset = 0,
- .key_offset = 32,
+ .signature_offset = APP_METADATA_OFFSET(0),
+ .key_offset = APP_METADATA_OFFSET(32),
.f_hash = test_hash,
.seed = 0,
};
@@ -456,8 +456,10 @@ app_main_loop_rx_metadata(void) {
m = app.mbuf_rx.array[j];
m_data = rte_pktmbuf_mtod(m, uint8_t *);
- signature = RTE_MBUF_METADATA_UINT32_PTR(m, 0);
- key = RTE_MBUF_METADATA_UINT8_PTR(m, 32);
+ signature = RTE_MBUF_METADATA_UINT32_PTR(m,
+ APP_METADATA_OFFSET(0));
+ key = RTE_MBUF_METADATA_UINT8_PTR(m,
+ APP_METADATA_OFFSET(32));
if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) {
ip_hdr = (struct ipv4_hdr *)
@@ -115,7 +115,7 @@ app_main_loop_worker_pipeline_lpm(void) {
.n_rules = 1 << 24,
.entry_unique_size =
sizeof(struct rte_pipeline_table_entry),
- .offset = 32,
+ .offset = APP_METADATA_OFFSET(32),
};
struct rte_pipeline_table_params table_params = {
@@ -117,7 +117,7 @@ app_main_loop_worker_pipeline_lpm_ipv6(void) {
.number_tbl8s = 1 << 21,
.entry_unique_size =
sizeof(struct rte_pipeline_table_entry),
- .offset = 32,
+ .offset = APP_METADATA_OFFSET(32),
};
struct rte_pipeline_table_params table_params = {