Skip to content

Commit b7fc82e

Browse files
kananyevtmonjalo
authored andcommitted
ip_frag: add namespace
Update public macros to have RTE_IP_FRAG_ prefix. Update DPDK components to use new names. Keep obsolete macro for compatibility reasons. Renamed experimental function ``rte_frag_table_del_expired_entries``to ``rte_ip_frag_table_del_expired_entries`` to comply with other public API naming convention. Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
1 parent fba335b commit b7fc82e

File tree

9 files changed

+44
-27
lines changed

9 files changed

+44
-27
lines changed

doc/guides/rel_notes/release_21_11.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,13 @@ API Changes
584584
* fib: Added the ``rib_ext_sz`` field to ``rte_fib_conf`` and ``rte_fib6_conf``
585585
so that user can specify the size of the RIB extension inside the FIB.
586586

587+
* ip_frag: All macros updated to have ``RTE_IP_FRAG_`` prefix.
588+
Obsolete macros are kept for compatibility.
589+
DPDK components updated to use new names.
590+
Experimental function ``rte_frag_table_del_expired_entries`` was renamed
591+
to ``rte_ip_frag_table_del_expired_entries``
592+
to comply with other public API naming convention.
593+
587594

588595
ABI Changes
589596
-----------

examples/ip_reassembly/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue,
371371
eth_hdr->ether_type = rte_be_to_cpu_16(RTE_ETHER_TYPE_IPV4);
372372
} else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) {
373373
/* if packet is IPv6 */
374-
struct ipv6_extension_fragment *frag_hdr;
374+
struct rte_ipv6_fragment_ext *frag_hdr;
375375
struct rte_ipv6_hdr *ip_hdr;
376376

377377
ip_hdr = (struct rte_ipv6_hdr *)(eth_hdr + 1);

examples/ipsec-secgw/ipsec-secgw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,7 @@ rx_callback(__rte_unused uint16_t port, __rte_unused uint16_t queue,
26472647
rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6)) {
26482648

26492649
struct rte_ipv6_hdr *iph;
2650-
struct ipv6_extension_fragment *fh;
2650+
struct rte_ipv6_fragment_ext *fh;
26512651

26522652
iph = (struct rte_ipv6_hdr *)(eth + 1);
26532653
fh = rte_ipv6_frag_get_ipv6_fragment_header(iph);

lib/ip_frag/rte_ip_frag.h

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,20 @@ extern "C" {
2727

2828
struct rte_mbuf;
2929

30-
#define IP_FRAG_DEATH_ROW_LEN 32 /**< death row size (in packets) */
30+
/** death row size (in packets) */
31+
#define RTE_IP_FRAG_DEATH_ROW_LEN 32
3132

32-
/* death row size in mbufs */
33-
#define IP_FRAG_DEATH_ROW_MBUF_LEN \
34-
(IP_FRAG_DEATH_ROW_LEN * (RTE_LIBRTE_IP_FRAG_MAX_FRAG + 1))
33+
/** death row size in mbufs */
34+
#define RTE_IP_FRAG_DEATH_ROW_MBUF_LEN \
35+
(RTE_IP_FRAG_DEATH_ROW_LEN * (RTE_LIBRTE_IP_FRAG_MAX_FRAG + 1))
3536

3637
/** mbuf death row (packets to be freed) */
3738
struct rte_ip_frag_death_row {
3839
uint32_t cnt; /**< number of mbufs currently on death row */
39-
struct rte_mbuf *row[IP_FRAG_DEATH_ROW_MBUF_LEN];
40+
struct rte_mbuf *row[RTE_IP_FRAG_DEATH_ROW_MBUF_LEN];
4041
/**< mbufs to be freed */
4142
};
4243

43-
/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
44-
#define ipv6_extension_fragment rte_ipv6_fragment_ext
45-
4644
/**
4745
* Create a new IP fragmentation table.
4846
*
@@ -128,7 +126,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
128126
struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
129127
struct rte_ip_frag_death_row *dr,
130128
struct rte_mbuf *mb, uint64_t tms, struct rte_ipv6_hdr *ip_hdr,
131-
struct ipv6_extension_fragment *frag_hdr);
129+
struct rte_ipv6_fragment_ext *frag_hdr);
132130

133131
/**
134132
* Return a pointer to the packet's fragment header, if found.
@@ -141,11 +139,11 @@ struct rte_mbuf *rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
141139
* Pointer to the IPv6 fragment extension header, or NULL if it's not
142140
* present.
143141
*/
144-
static inline struct ipv6_extension_fragment *
142+
static inline struct rte_ipv6_fragment_ext *
145143
rte_ipv6_frag_get_ipv6_fragment_header(struct rte_ipv6_hdr *hdr)
146144
{
147145
if (hdr->proto == IPPROTO_FRAGMENT) {
148-
return (struct ipv6_extension_fragment *) ++hdr;
146+
return (struct rte_ipv6_fragment_ext *) ++hdr;
149147
}
150148
else
151149
return NULL;
@@ -258,9 +256,20 @@ rte_ip_frag_table_statistics_dump(FILE * f, const struct rte_ip_frag_tbl *tbl);
258256
*/
259257
__rte_experimental
260258
void
261-
rte_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
259+
rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
262260
struct rte_ip_frag_death_row *dr, uint64_t tms);
263261

262+
/**@{@name Obsolete macros, kept here for compatibility reasons.
263+
* Will be deprecated/removed in future DPDK releases.
264+
*/
265+
/** Obsolete */
266+
#define IP_FRAG_DEATH_ROW_LEN RTE_IP_FRAG_DEATH_ROW_LEN
267+
/** Obsolete */
268+
#define IP_FRAG_DEATH_ROW_MBUF_LEN RTE_IP_FRAG_DEATH_ROW_MBUF_LEN
269+
/** Obsolete */
270+
#define ipv6_extension_fragment rte_ipv6_fragment_ext
271+
/**@}*/
272+
264273
#ifdef __cplusplus
265274
}
266275
#endif

lib/ip_frag/rte_ip_frag_common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ rte_ip_frag_table_statistics_dump(FILE *f, const struct rte_ip_frag_tbl *tbl)
124124

125125
/* Delete expired fragments */
126126
void
127-
rte_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
127+
rte_ip_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
128128
struct rte_ip_frag_death_row *dr, uint64_t tms)
129129
{
130130
uint64_t max_cycles;
@@ -135,7 +135,8 @@ rte_frag_table_del_expired_entries(struct rte_ip_frag_tbl *tbl,
135135
TAILQ_FOREACH(fp, &tbl->lru, lru)
136136
if (max_cycles + fp->start < tms) {
137137
/* check that death row has enough space */
138-
if (IP_FRAG_DEATH_ROW_MBUF_LEN - dr->cnt >= fp->last_idx)
138+
if (RTE_IP_FRAG_DEATH_ROW_MBUF_LEN - dr->cnt >=
139+
fp->last_idx)
139140
ip_frag_tbl_del(tbl, dr, fp);
140141
else
141142
return;

lib/ip_frag/rte_ipv6_fragmentation.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ __fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst,
2222
const struct rte_ipv6_hdr *src, uint16_t len, uint16_t fofs,
2323
uint32_t mf)
2424
{
25-
struct ipv6_extension_fragment *fh;
25+
struct rte_ipv6_fragment_ext *fh;
2626

2727
rte_memcpy(dst, src, sizeof(*dst));
2828
dst->payload_len = rte_cpu_to_be_16(len);
2929
dst->proto = IPPROTO_FRAGMENT;
3030

31-
fh = (struct ipv6_extension_fragment *) ++dst;
31+
fh = (struct rte_ipv6_fragment_ext *) ++dst;
3232
fh->next_header = src->proto;
3333
fh->reserved = 0;
3434
fh->frag_data = rte_cpu_to_be_16(RTE_IPV6_SET_FRAG_DATA(fofs, mf));
@@ -94,7 +94,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
9494
*/
9595

9696
frag_size = mtu_size - sizeof(struct rte_ipv6_hdr) -
97-
sizeof(struct ipv6_extension_fragment);
97+
sizeof(struct rte_ipv6_fragment_ext);
9898
frag_size = RTE_ALIGN_FLOOR(frag_size, RTE_IPV6_EHDR_FO_ALIGN);
9999

100100
/* Check that pkts_out is big enough to hold all fragments */
@@ -124,9 +124,9 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
124124

125125
/* Reserve space for the IP header that will be built later */
126126
out_pkt->data_len = sizeof(struct rte_ipv6_hdr) +
127-
sizeof(struct ipv6_extension_fragment);
127+
sizeof(struct rte_ipv6_fragment_ext);
128128
out_pkt->pkt_len = sizeof(struct rte_ipv6_hdr) +
129-
sizeof(struct ipv6_extension_fragment);
129+
sizeof(struct rte_ipv6_fragment_ext);
130130
frag_bytes_remaining = frag_size;
131131

132132
out_seg_prev = out_pkt;
@@ -184,7 +184,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
184184

185185
fragment_offset = (uint16_t)(fragment_offset +
186186
out_pkt->pkt_len - sizeof(struct rte_ipv6_hdr)
187-
- sizeof(struct ipv6_extension_fragment));
187+
- sizeof(struct rte_ipv6_fragment_ext));
188188

189189
/* Write the fragment to the output list */
190190
pkts_out[out_pkt_pos] = out_pkt;

lib/ip_frag/rte_ipv6_reassembly.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct rte_mbuf *
3333
ipv6_frag_reassemble(struct ip_frag_pkt *fp)
3434
{
3535
struct rte_ipv6_hdr *ip_hdr;
36-
struct ipv6_extension_fragment *frag_hdr;
36+
struct rte_ipv6_fragment_ext *frag_hdr;
3737
struct rte_mbuf *m, *prev;
3838
uint32_t i, n, ofs, first_len;
3939
uint32_t last_len, move_len, payload_len;
@@ -102,7 +102,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp)
102102
* the main IPv6 header instead.
103103
*/
104104
move_len = m->l2_len + m->l3_len - sizeof(*frag_hdr);
105-
frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
105+
frag_hdr = (struct rte_ipv6_fragment_ext *) (ip_hdr + 1);
106106
ip_hdr->proto = frag_hdr->next_header;
107107

108108
ip_frag_memmove(rte_pktmbuf_mtod_offset(m, char *, sizeof(*frag_hdr)),
@@ -136,7 +136,7 @@ ipv6_frag_reassemble(struct ip_frag_pkt *fp)
136136
struct rte_mbuf *
137137
rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
138138
struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
139-
struct rte_ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr)
139+
struct rte_ipv6_hdr *ip_hdr, struct rte_ipv6_fragment_ext *frag_hdr)
140140
{
141141
struct ip_frag_pkt *fp;
142142
struct ip_frag_key key;

lib/ip_frag/version.map

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ DPDK_22 {
1616
EXPERIMENTAL {
1717
global:
1818

19-
rte_frag_table_del_expired_entries;
19+
rte_ip_frag_table_del_expired_entries;
2020
};

lib/port/rte_port_ras.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ process_ipv6(struct rte_port_ring_writer_ras *p, struct rte_mbuf *pkt)
186186
struct rte_ipv6_hdr *pkt_hdr =
187187
rte_pktmbuf_mtod(pkt, struct rte_ipv6_hdr *);
188188

189-
struct ipv6_extension_fragment *frag_hdr;
189+
struct rte_ipv6_fragment_ext *frag_hdr;
190190
uint16_t frag_data = 0;
191191
frag_hdr = rte_ipv6_frag_get_ipv6_fragment_header(pkt_hdr);
192192
if (frag_hdr != NULL)

0 commit comments

Comments
 (0)