rte_ip_frag: various fixes for lib and examples
cover rte_ip_frag: various fixes for lib and examples
This patchset fixes a few issues found during validation, and also does a bunch of renames (so that internally-used data structures aren't starting with rte_) and fixes a few typos.
Anatoly Burakov (10):
ip_frag: rename RTE_IP_FRAG_ASSERT to IP_FRAG_ASSERT
ip_frag: fix debug macros
ip_frag: renaming rte_ip_frag_pkt to ip_frag_pkt
ip_frag: fix stats macro, rename rte_ip_frag_tbl_stat structure
ip_frag: small fix, replace hardcode with a macro
ip_frag: replace memmove with custom copying
ip_frag: fix order of arguments to key compare function
ip_fragmentation: small fixes
ip_reassembly: small fixes
rte_ip_frag: API header file fix
config/common_bsdapp | 1 + config/common_linuxapp | 1 + examples/ip_fragmentation/main.c | 6 +++++- examples/ip_reassembly/main.c | 16 ++++++++++------ lib/librte_ip_frag/ip_frag_common.h | 22 +++++++++++----------- lib/librte_ip_frag/ip_frag_internal.c | 28 ++++++++++++++-------------- lib/librte_ip_frag/rte_ip_frag.h | 20 ++++++++++---------- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 2 +- lib/librte_ip_frag/rte_ipv4_reassembly.c | 10 +++++----- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 2 +- lib/librte_ip_frag/rte_ipv6_reassembly.c | 16 +++++++++++++--- 11 files changed, 72 insertions(+), 52 deletions(-)
Signature · 1 line
1.8.1.4
A message that is not in the archive (sent off-list or not yet received): cover.1403102825.git.anatoly.burakov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
PATCH 1/10 ip_frag: rename RTE_IP_FRAG_ASSERT to IP_FRAG_ASSERT
--- lib/librte_ip_frag/ip_frag_common.h | 4 ++-- lib/librte_ip_frag/rte_ipv4_fragmentation.c | 2 +- lib/librte_ip_frag/rte_ipv6_fragmentation.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
lib/librte_ip_frag/ip_frag_common.h +2 -2
@@ -41,14 +41,14 @@ #define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, USER1, fmt, ##args) -#define RTE_IP_FRAG_ASSERT (exp) \ +#define IP_FRAG_ASSERT (exp) \ if (!(exp)) { \ rte_panic("function %s, line%d\tassert \"" #exp "\" failed\n", \ __func__, __LINE__); \ }#else #define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0) -#define RTE_IP_FRAG_ASSERT (exp) do { } while(0) +#define IP_FRAG_ASSERT (exp) do { } while(0)#endif /* IP_FRAG_DEBUG */ #define IPV4_KEYLEN 1
lib/librte_ip_frag/rte_ipv4_fragmentation.c +1 -1
@@ -107,7 +107,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, frag_size = (uint16_t )(mtu_size -sizeof (struct ipv4_hdr ));/* Fragment size should be a multiply of 8. */ -RTE_IP_FRAG_ASSERT ((frag_size &IPV4_HDR_FO_MASK ) ==0 ); +IP_FRAG_ASSERT ((frag_size &IPV4_HDR_FO_MASK ) ==0 ); in_hdr = (struct ipv4_hdr *) pkt_in->pkt.data; flag_offset =rte_cpu_to_be_16 (in_hdr->fragment_offset);
lib/librte_ip_frag/rte_ipv6_fragmentation.c +1 -1
@@ -118,7 +118,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in, frag_size = (uint16_t )(mtu_size -sizeof (struct ipv6_hdr ));/* Fragment size should be a multiple of 8. */ -RTE_IP_FRAG_ASSERT ((frag_size &IPV6_HDR_FO_MASK ) ==0 ); +IP_FRAG_ASSERT ((frag_size &IPV6_HDR_FO_MASK ) ==0 );/* Check that pkts_out is big enough to hold all fragments */ if (unlikely (frag_size * nb_pkts_out <
Signature · 1 line
1.8.1.4
PATCH 2/10 ip_frag: fix debug macros
In reply to a message not in the archive--- lib/librte_ip_frag/rte_ipv4_reassembly.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_ip_frag/rte_ipv4_reassembly.c +3 -3
@@ -145,7 +145,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,"tbl: %p, max_cycles: %" PRIu64", entry_mask: %#x, " "max_entries: %u, use_entries: %u\n\n" , __func__, __LINE__, - mb, tms, key.src_dst, key.id, ip_ofs, ip_len, ip_flag, + mb, tms, key.src_dst[0 ], key.id, ip_ofs, ip_len, ip_flag, tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries, tbl->use_entries);
@@ -161,7 +161,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,", total_size: %u, frag_size: %u, last_idx: %u\n\n" , __func__, __LINE__, tbl, tbl->max_entries, tbl->use_entries, - fp, fp->key.src_dst, fp->key.id, fp->start, + fp, fp->key.src_dst[0 ], fp->key.id, fp->start, fp->total_size, fp->frag_size, fp->last_idx);
@@ -176,7 +176,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,", total_size: %u, frag_size: %u, last_idx: %u\n\n" , __func__, __LINE__, mb, tbl, tbl->max_entries, tbl->use_entries, - fp, fp->key.src_dst, fp->key.id, fp->start, + fp, fp->key.src_dst[0 ], fp->key.id, fp->start, fp->total_size, fp->frag_size, fp->last_idx);return (mb);
Signature · 1 line
1.8.1.4
PATCH 3/10 ip_frag: renaming rte_ip_frag_pkt to ip_frag_pkt
In reply to a message not in the archive--- lib/librte_ip_frag/ip_frag_common.h | 18 +++++++++--------- lib/librte_ip_frag/ip_frag_internal.c | 20 ++++++++++---------- lib/librte_ip_frag/rte_ip_frag.h | 12 ++++++------ lib/librte_ip_frag/rte_ipv4_reassembly.c | 4 ++-- lib/librte_ip_frag/rte_ipv6_reassembly.c | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-)
lib/librte_ip_frag/ip_frag_common.h +9 -9
@@ -63,21 +63,21 @@ if (!(exp)) { \"%08" PRIx64"%08" PRIx64"%08" PRIx64"%08" PRIx64/* internal functions declarations */ -struct rte_mbuf * ip_frag_process(struct rte_ip_frag_pkt *fp, +struct rte_mbuf * ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint16_t ofs, uint16_t len, uint16_t more_frags); -struct rte_ip_frag_pkt *ip_frag_find (struct rte_ip_frag_tbl *tbl, +struct ip_frag_pkt *ip_frag_find (struct rte_ip_frag_tbl *tbl,struct rte_ip_frag_death_row *dr,const struct ip_frag_key *key,uint64_t tms); -struct rte_ip_frag_pkt *ip_frag_lookup (struct rte_ip_frag_tbl *tbl, +struct ip_frag_pkt *ip_frag_lookup (struct rte_ip_frag_tbl *tbl,const struct ip_frag_key *key,uint64_t tms, -struct rte_ip_frag_pkt **free,struct rte_ip_frag_pkt **stale); +struct ip_frag_pkt **free,struct ip_frag_pkt **stale);/* these functions need to be declared here as ip_frag_process relies on them */ -struct rte_mbuf *ipv4_frag_reassemble (const struct rte_ip_frag_pkt *fp); -struct rte_mbuf *ipv6_frag_reassemble (const struct rte_ip_frag_pkt *fp); +struct rte_mbuf *ipv4_frag_reassemble (const struct ip_frag_pkt *fp); +struct rte_mbuf *ipv6_frag_reassemble (const struct ip_frag_pkt *fp);
@@ -122,7 +122,7 @@ ip_frag_key_cmp(const struct ip_frag_key * k1, const struct ip_frag_key * k2)/* put fragment on death row */ static inline void -ip_frag_free (struct rte_ip_frag_pkt *fp,struct rte_ip_frag_death_row *dr) +ip_frag_free (struct ip_frag_pkt *fp,struct rte_ip_frag_death_row *dr) {uint32_t i, k;
@@ -140,7 +140,7 @@ ip_frag_free(struct rte_ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr)/* if key is empty, mark key as in use */ static inline void -ip_frag_inuse (struct rte_ip_frag_tbl *tbl,const struct rte_ip_frag_pkt *fp) +ip_frag_inuse (struct rte_ip_frag_tbl *tbl,const struct ip_frag_pkt *fp) {if (ip_frag_key_is_empty (&fp->key)) {TAILQ_REMOVE (&tbl->lru, fp, lru);
@@ -150,7 +150,7 @@ ip_frag_inuse(struct rte_ip_frag_tbl *tbl, const struct rte_ip_frag_pkt *fp)/* reset the fragment */ static inline void -ip_frag_reset (struct rte_ip_frag_pkt *fp,uint64_t tms) +ip_frag_reset (struct ip_frag_pkt *fp,uint64_t tms) {static const struct ip_frag zero_frag = { .ofs =0 ,
lib/librte_ip_frag/ip_frag_internal.c +10 -10
@@ -54,7 +54,7 @@/* local frag table helper functions */ static inline void ip_frag_tbl_del (struct rte_ip_frag_tbl *tbl,struct rte_ip_frag_death_row *dr, -struct rte_ip_frag_pkt *fp) +struct ip_frag_pkt *fp) {ip_frag_free (fp, dr);ip_frag_key_invalidate (&fp->key);
@@ -64,7 +64,7 @@ ip_frag_tbl_del(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, }static inline void -ip_frag_tbl_add (struct rte_ip_frag_tbl *tbl,struct rte_ip_frag_pkt *fp, +ip_frag_tbl_add (struct rte_ip_frag_tbl *tbl,struct ip_frag_pkt *fp,const struct ip_frag_key *key,uint64_t tms) { fp->key = key[0 ];
@@ -76,7 +76,7 @@ ip_frag_tbl_add(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_pkt *fp,static inline void ip_frag_tbl_reuse (struct rte_ip_frag_tbl *tbl,struct rte_ip_frag_death_row *dr, -struct rte_ip_frag_pkt *fp,uint64_t tms) +struct ip_frag_pkt *fp,uint64_t tms) {ip_frag_free (fp, dr);ip_frag_reset (fp, tms);
@@ -137,7 +137,7 @@ ipv6_frag_hash(const struct ip_frag_key *key, uint32_t *v1, uint32_t *v2) }struct rte_mbuf * -ip_frag_process (struct rte_ip_frag_pkt *fp,struct rte_ip_frag_death_row *dr, +ip_frag_process (struct ip_frag_pkt *fp,struct rte_ip_frag_death_row *dr,struct rte_mbuf *mb,uint16_t ofs,uint16_t len,uint16_t more_frags) {uint32_t idx;
@@ -268,11 +268,11 @@ ip_frag_process(struct rte_ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,* If such entry is not present, then allocate a new one. * If the entry is stale, then free and reuse it. */ -struct rte_ip_frag_pkt * +struct ip_frag_pkt *ip_frag_find (struct rte_ip_frag_tbl *tbl,struct rte_ip_frag_death_row *dr,const struct ip_frag_key *key,uint64_t tms) { -struct rte_ip_frag_pkt *pkt, *free, *stale, *lru; +struct ip_frag_pkt *pkt, *free, *stale, *lru;uint64_t max_cycles;/*
@@ -330,13 +330,13 @@ ip_frag_find(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr,return (pkt); } -struct rte_ip_frag_pkt * +struct ip_frag_pkt *ip_frag_lookup (struct rte_ip_frag_tbl *tbl,const struct ip_frag_key *key,uint64_t tms, -struct rte_ip_frag_pkt **free,struct rte_ip_frag_pkt **stale) +struct ip_frag_pkt **free,struct ip_frag_pkt **stale) { -struct rte_ip_frag_pkt *p1, *p2; -struct rte_ip_frag_pkt *empty, *old; +struct ip_frag_pkt *p1, *p2; +struct ip_frag_pkt *empty, *old;uint64_t max_cycles;uint32_t i, assoc, sig1, sig2;
lib/librte_ip_frag/rte_ip_frag.h +6 -6
@@ -75,8 +75,8 @@ struct ip_frag_key {* @internal Fragmented packet to reassemble. * First two entries in the frags[] array are for the last and first fragments. */ -struct rte_ip_frag_pkt { -TAILQ_ENTRY (rte_ip_frag_pkt) lru;/**< LRU list */ +struct ip_frag_pkt { +TAILQ_ENTRY (ip_frag_pkt) lru;/**< LRU list */ struct ip_frag_key key;/**< fragmentation key */ uint64_t start;/**< creation timestamp */ uint32_t total_size;/**< expected reassembled size */
@@ -94,7 +94,7 @@ struct rte_ip_frag_death_row {/**< mbufs to be freed */ }; -TAILQ_HEAD (rte_ip_pkt_list, rte_ip_frag_pkt);/**< @internal fragments tailq */ +TAILQ_HEAD (ip_pkt_list, ip_frag_pkt);/**< @internal fragments tailq */ /** fragmentation table statistics */ struct rte_ip_frag_tbl_stat {
@@ -115,10 +115,10 @@ struct rte_ip_frag_tbl {uint32_t bucket_entries;/**< hash assocaitivity. */ uint32_t nb_entries;/**< total size of the table. */ uint32_t nb_buckets;/**< num of associativity lines. */ -struct rte_ip_frag_pkt *last;/**< last used entry. */ -struct rte_ip_pkt_list lru;/**< LRU list for table entries. */ +struct ip_frag_pkt *last;/**< last used entry. */ +struct ip_pkt_list lru;/**< LRU list for table entries. */ struct rte_ip_frag_tbl_stat stat;/**< statistics counters. */ -struct rte_ip_frag_pkt pkt[0 ];/**< hash table. */ +struct ip_frag_pkt pkt[0 ];/**< hash table. */ };/** IPv6 fragment extension header */
lib/librte_ip_frag/rte_ipv4_reassembly.c +2 -2
@@ -42,7 +42,7 @@* Reassemble fragments into one packet. */ struct rte_mbuf * -ipv4_frag_reassemble (const struct rte_ip_frag_pkt *fp) +ipv4_frag_reassemble (const struct ip_frag_pkt *fp) {struct ipv4_hdr *ip_hdr;struct rte_mbuf *m, *prev;
@@ -119,7 +119,7 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, struct ipv4_hdr *ip_hdr) { - struct rte_ip_frag_pkt *fp; + struct ip_frag_pkt *fp;struct ip_frag_key key;const uint64_t *psd;uint16_t ip_len;
lib/librte_ip_frag/rte_ipv6_reassembly.c +2 -2
@@ -49,7 +49,7 @@* Reassemble fragments into one packet. */ struct rte_mbuf * -ipv6_frag_reassemble (const struct rte_ip_frag_pkt *fp) +ipv6_frag_reassemble (const struct ip_frag_pkt *fp) {struct ipv6_hdr *ip_hdr;struct ipv6_extension_fragment *frag_hdr;
@@ -148,7 +148,7 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms, struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr) { - struct rte_ip_frag_pkt *fp; + struct ip_frag_pkt *fp;struct ip_frag_key key;uint16_t ip_len, ip_ofs;
Signature · 1 line
1.8.1.4
PATCH 4/10 ip_frag: fix stats macro, rename rte_ip_frag_tbl_stat structure
In reply to a message not in the archiveThis also makes ip_reassembly sample application statistics to obey the CONFIG_RTE_LIBRTE_IP_FRAG_FRAG_TBL_STATS config option
--- config/common_bsdapp | 1 + config/common_linuxapp | 1 + examples/ip_reassembly/main.c | 4 ++-- lib/librte_ip_frag/rte_ip_frag.h | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-)
config/common_bsdapp +1 -0
@@ -294,6 +294,7 @@ CONFIG_RTE_LIBRTE_NET=y CONFIG_RTE_LIBRTE_IP_FRAG=y CONFIG_RTE_LIBRTE_IP_FRAG_DEBUG=n CONFIG_RTE_LIBRTE_IP_FRAG_MAX_FRAG=4 +CONFIG_RTE_LIBRTE_IP_FRAG_TBL_STAT=n # # Compile librte_meter
config/common_linuxapp +1 -0
@@ -337,6 +337,7 @@ CONFIG_RTE_LIBRTE_NET=y CONFIG_RTE_LIBRTE_IP_FRAG=y CONFIG_RTE_LIBRTE_IP_FRAG_DEBUG=n CONFIG_RTE_LIBRTE_IP_FRAG_MAX_FRAG=4 +CONFIG_RTE_LIBRTE_IP_FRAG_TBL_STAT=n # # Compile librte_meter
examples/ip_reassembly/main.c +2 -2
@@ -310,11 +310,11 @@ struct rte_lpm6_config lpm6_config = {static struct rte_lpm *socket_lpm[RTE_MAX_NUMA_NODES ];static struct rte_lpm6 *socket_lpm6[RTE_MAX_NUMA_NODES ]; -#ifdef IPV6_FRAG_TBL_STAT +#ifdef RTE_LIBRTE_IP_FRAG_TBL_STAT #define TX_LCORE_STAT_UPDATE (s, f, v) ((s)->f += (v))#else #define TX_LCORE_STAT_UPDATE (s, f, v) do {} while (0) -#endif /* IPV6_FRAG_TBL_STAT */ +#endif /* RTE_LIBRTE_IP_FRAG_TBL_STAT */ /* * If number of queued packets reached given threahold, then
lib/librte_ip_frag/rte_ip_frag.h +2 -2
@@ -97,7 +97,7 @@ struct rte_ip_frag_death_row {TAILQ_HEAD (ip_pkt_list, ip_frag_pkt);/**< @internal fragments tailq */ /** fragmentation table statistics */ -struct rte_ip_frag_tbl_stat { +struct ip_frag_tbl_stat {uint64_t find_num;/**< total # of find/insert attempts. */ uint64_t add_num;/**< # of add ops. */ uint64_t del_num;/**< # of del ops. */
@@ -117,7 +117,7 @@ struct rte_ip_frag_tbl {uint32_t nb_buckets;/**< num of associativity lines. */ struct ip_frag_pkt *last;/**< last used entry. */ struct ip_pkt_list lru;/**< LRU list for table entries. */ -struct rte_ip_frag_tbl_stat stat;/**< statistics counters. */ +struct ip_frag_tbl_stat stat;/**< statistics counters. */ struct ip_frag_pkt pkt[0 ];/**< hash table. */ };
Signature · 1 line
1.8.1.4
PATCH 5/10 ip_frag: small fix, replace hardcode with a macro
In reply to a message not in the archive--- lib/librte_ip_frag/ip_frag_internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_ip_frag/ip_frag_internal.c +1 -1
@@ -350,7 +350,7 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl,return (tbl->last);/* different hashing methods for IPv4 and IPv6 */ -if (key->key_len ==1 ) +if (key->key_len ==IPV4_KEYLEN )ipv4_frag_hash (key, &sig1, &sig2);else ipv6_frag_hash (key, &sig1, &sig2);
Signature · 1 line
1.8.1.4
PATCH 6/10 ip_frag: replace memmove with custom copying
In reply to a message not in the archivesome implementations of memmove may make a copy of src before writing to dst. we avoid that by explicitly writing from src to dst backwards.
--- lib/librte_ip_frag/rte_ipv6_reassembly.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
lib/librte_ip_frag/rte_ipv6_reassembly.c +11 -1
@@ -45,6 +45,16 @@* */ +static inline void +ip_frag_memmove (char *dst,char *src,int len) +{ +int i; + +/* go backwards to make sure we don't overwrite anything important */ +for (i = len -1 ; i >=0 ; i--) + dst[i] = src[i]; +} +/* * Reassemble fragments into one packet. */
@@ -115,7 +125,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp) frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr +1 ); ip_hdr->proto = frag_hdr->next_header; - memmove(rte_pktmbuf_mtod(m, char*) + sizeof(*frag_hdr), + ip_frag_memmove(rte_pktmbuf_mtod(m, char*) + sizeof(*frag_hdr), rte_pktmbuf_mtod(m, char*), move_len);rte_pktmbuf_adj (m,sizeof (*frag_hdr));
Signature · 1 line
1.8.1.4
PATCH 7/10 ip_frag: fix order of arguments to key compare function
In reply to a message not in the archivewhen using key compare function, it uses key length of the first argument to determine how long should be the keys that are compared. however, currently we are passing a key from the fragmentation table as first argument. the problem with this is that this key is potentially uninitialized (i.e. contains all zeroes, including key length). this leads to a nasty bug of comparing only the key id's and not keys themselves.
of course, a safer way would be to do RTE_MAX between key lengths, but since this compare is done per-packet, every cycle counts, so we just use the key whos length is guaranteed to be correct because it comes from an actual packet.
--- lib/librte_ip_frag/ip_frag_internal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/librte_ip_frag/ip_frag_internal.c +3 -3
@@ -346,7 +346,7 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl, max_cycles = tbl->max_cycles; assoc = tbl->bucket_entries; -if (tbl->last !=NULL &&ip_frag_key_cmp (&tbl->last->key, key) ==0 ) +if (tbl->last !=NULL &&ip_frag_key_cmp (key, &tbl->last->key) ==0 )return (tbl->last);/* different hashing methods for IPv4 and IPv6 */
@@ -378,7 +378,7 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl, p1, i, assoc, IPv6_KEY_BYTES(p1[i].key.src_dst), p1[i].key.id, p1[i].start); -if (ip_frag_key_cmp (&p1[i].key, key) ==0 ) +if (ip_frag_key_cmp (key, &p1[i].key) ==0 )return (p1 + i);else if (ip_frag_key_is_empty (&p1[i].key)) empty = (empty ==NULL ) ? (p1 + i) : empty;
@@ -404,7 +404,7 @@ ip_frag_lookup(struct rte_ip_frag_tbl *tbl, p2, i, assoc, IPv6_KEY_BYTES(p2[i].key.src_dst), p2[i].key.id, p2[i].start); -if (ip_frag_key_cmp (&p2[i].key, key) ==0 ) +if (ip_frag_key_cmp (key, &p2[i].key) ==0 )return (p2 + i);else if (ip_frag_key_is_empty (&p2[i].key)) empty = (empty ==NULL ) ?( p2 + i) : empty;
Signature · 1 line
1.8.1.4
PATCH 8/10 ip_fragmentation: small fixes
In reply to a message not in the archiveAdding check for non-existent ports in portmask.
Also, making everything NUMA-related depend on lcore sockets, not device sockets. This is because the init_mem() function allocates all data structures based on NUMA nodes of the lcores in the coremask. Therefore, when no cores are on socket 0, but there are devices on socket 0, it may lead to segmentation faults.
--- examples/ip_fragmentation/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
examples/ip_fragmentation/main.c +5 -1
@@ -886,6 +886,10 @@ MAIN(int argc, char **argv)if (init_mem () <0 )rte_panic ("Cannot initialize memory structures!\n" ); +/* check if portmask has non-existent ports */ +if (enabled_port_mask & ~(RTE_LEN2MASK (nb_ports, unsigned))) +rte_exit (EXIT_FAILURE ,"Non-existent ports in portmask!\n" ); +/* initialize all ports */ for (portid =0 ; portid < nb_ports; portid++) {/* skip ports that are not enabled */
@@ -907,7 +911,7 @@ MAIN(int argc, char **argv) qconf = &lcore_queue_conf[rx_lcore_id]; } - socket =rte_eth_dev_socket_id (portid); + socket = (int )rte_lcore_to_socket_id (rx_lcore_id);if (socket ==SOCKET_ID_ANY ) socket =0 ;
Signature · 1 line
1.8.1.4
PATCH 9/10 ip_reassembly: small fixes
In reply to a message not in the archiveAdding check for non-existent ports in portmask.
Also, making everything NUMA-related depend on lcore sockets, not device sockets. This is because the init_mem() function allocates all data structures based on NUMA nodes of the lcores in the coremask. Therefore, when no cores are on socket 0, but there are devices on socket 0, it may lead to segmentation faults.
Also, making ip_reassembly eat up a bit less memory.
--- examples/ip_reassembly/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
examples/ip_reassembly/main.c +8 -4
@@ -942,15 +942,15 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, uint32_t queue) }/* -* At any given moment up to <max_flow_num * (MAX_FRAG_NUM - 1)> +* At any given moment up to <max_flow_num * (MAX_FRAG_NUM)> * mbufs could be stored int the fragment table. * Plus, each TX queue can hold up to <max_flow_num> packets. */ - nb_mbuf =2 *RTE_MAX (max_flow_num,2UL *MAX_PKT_BURST ) *MAX_FRAG_NUM ; + nb_mbuf =RTE_MAX (max_flow_num,2UL *MAX_PKT_BURST ) *MAX_FRAG_NUM ; nb_mbuf *= (port_conf.rxmode.max_rx_pkt_len +BUF_SIZE -1 ) /BUF_SIZE ; - nb_mbuf +=RTE_TEST_RX_DESC_DEFAULT +RTE_TEST_TX_DESC_DEFAULT ; nb_mbuf *=2 ;/* ipv4 and ipv6 */ + nb_mbuf +=RTE_TEST_RX_DESC_DEFAULT +RTE_TEST_TX_DESC_DEFAULT ; nb_mbuf =RTE_MAX (nb_mbuf, (uint32_t )NB_MBUF );
@@ -1093,6 +1093,10 @@ MAIN(int argc, char **argv)if (init_mem () <0 )rte_panic ("Cannot initialize memory structures!\n" ); +/* check if portmask has non-existent ports */ +if (enabled_port_mask & ~(RTE_LEN2MASK (nb_ports, unsigned))) +rte_exit (EXIT_FAILURE ,"Non-existent ports in portmask!\n" ); +/* initialize all ports */ for (portid =0 ; portid < nb_ports; portid++) {/* skip ports that are not enabled */
@@ -1114,7 +1118,7 @@ MAIN(int argc, char **argv) qconf = &lcore_queue_conf[rx_lcore_id]; } - socket =rte_eth_dev_socket_id (portid); + socket =rte_lcore_to_socket_id (portid);if (socket ==SOCKET_ID_ANY ) socket =0 ;
Signature · 1 line
1.8.1.4
PATCH 10/10 rte_ip_frag: API header file fix
In reply to a message not in the archive--- lib/librte_ip_frag/rte_ip_frag.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_ip_frag/rte_ip_frag.h +2 -2
@@ -36,9 +36,9 @@/** * @file -* RTE IPv4 Fragmentation and Reassembly +* RTE IP Fragmentation and Reassembly * -* Implementation of IPv4 packet fragmentation and reassembly. +* Implementation of IP packet fragmentation and reassembly. */ #include <stdint.h>
Signature · 1 line
1.8.1.4
Thomas Monjalon
Acked-by2014-06-18 15:50, Anatoly Burakov:
Quoted 4 lines
This patchset fixes a few issues found during validation, and also does a bunch of renames (so that internally-used data structures aren't starting with
rte_) and fixes a few typos.
Quoted 11 lines
Anatoly Burakov (10):
ip_frag: renameRTE_IP_FRAG_ASSERTtoIP_FRAG_ASSERT
ip_frag: fix debug macros
ip_frag: renamingrte_ip_frag_pkttoip_frag_pkt
ip_frag: fix stats macro, renamerte_ip_frag_tbl_statstructure
ip_frag: small fix, replace hardcode with a macro
ip_frag: replace memmove with custom copying
ip_frag: fix order of arguments to key compare function
ip_fragmentation: small fixes
ip_reassembly: small fixes
rte_ip_frag: API header file fix
There were a lot of little things in these commits. In order to tidy them without waiting another version for rc2, I've splitted, merged and renamed some commits.
Applied for version 1.7.0.
Thanks
Signature · 1 line
Thomas