diff options
Diffstat (limited to 'lib/libtle_l4p/stream_table.h')
-rw-r--r-- | lib/libtle_l4p/stream_table.h | 56 |
1 files changed, 7 insertions, 49 deletions
diff --git a/lib/libtle_l4p/stream_table.h b/lib/libtle_l4p/stream_table.h index 29f1f63..033c306 100644 --- a/lib/libtle_l4p/stream_table.h +++ b/lib/libtle_l4p/stream_table.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Intel Corporation. + * Copyright (c) 2016-2017 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: @@ -23,9 +23,6 @@ extern "C" { #endif -/* current stbl entry contains packet. */ -#define STE_PKT 1 - struct stbl_entry { void *data; }; @@ -138,18 +135,6 @@ stbl_find_entry(struct stbl *st, const union pkt_info *pi) return ht->ent + rc; } -static inline int -stbl_data_pkt(const void *p) -{ - return ((uintptr_t)p & STE_PKT); -} - -static inline void * -stbl_get_pkt(const struct stbl_entry *se) -{ - return (void *)((uintptr_t)se->data ^ STE_PKT); -} - static inline void * stbl_find_data(struct stbl *st, const union pkt_info *pi) { @@ -159,35 +144,6 @@ stbl_find_data(struct stbl *st, const union pkt_info *pi) return (ent == NULL) ? NULL : ent->data; } -static inline void -stbl_del_pkt(struct stbl *st, struct stbl_entry *se, const union pkt_info *pi) -{ - uint32_t type; - struct stbl_key k; - - se->data = NULL; - - type = pi->tf.type; - stbl_pkt_fill_key(&k, pi, type); - rte_hash_del_key(st->ht[type].t, &k); -} - -static inline void -stbl_del_pkt_lock(struct stbl *st, struct stbl_entry *se, - const union pkt_info *pi) -{ - uint32_t type; - struct stbl_key k; - - se->data = NULL; - - type = pi->tf.type; - stbl_pkt_fill_key(&k, pi, type); - stbl_lock(st, type); - rte_hash_del_key(st->ht[type].t, &k); - stbl_unlock(st, type); -} - #include "tcp_stream.h" static inline void @@ -235,8 +191,8 @@ stbl_add_stream_lock(struct stbl *st, const struct tle_tcp_stream *s) } static inline void -stbl_del_stream_lock(struct stbl *st, struct stbl_entry *se, - const struct tle_tcp_stream *s) +stbl_del_stream(struct stbl *st, struct stbl_entry *se, + const struct tle_tcp_stream *s, uint32_t lock) { uint32_t type; struct stbl_key k; @@ -248,9 +204,11 @@ stbl_del_stream_lock(struct stbl *st, struct stbl_entry *se, type = s->s.type; stbl_stream_fill_key(&k, &s->s, type); - stbl_lock(st, type); + if (lock != 0) + stbl_lock(st, type); rte_hash_del_key(st->ht[type].t, &k); - stbl_unlock(st, type); + if (lock != 0) + stbl_unlock(st, type); } #ifdef __cplusplus |