Description:

Ensure all fragments of a big v4/v6 packet hava same rss value, that can 
generate

same tunnel outer port, make tunnel header information consistent.

Signed-off-by: laixiangwu <[email protected]>

---

 lib/ipf.c | 11 +++++++++++

 1 file changed, 11 insertions(+)




diff --git a/lib/ipf.c b/lib/ipf.c

index 7d74e2c13..522cd9f42 100644

--- a/lib/ipf.c

+++ b/lib/ipf.c

@@ -72,6 +72,7 @@ enum {

     IPF_V6_FRAG_SIZE_MIN_DEF = 1280,

     IPF_MAX_FRAGS_DEFAULT = 1000,

     IPF_NFRAG_UBOUND = 5000,

+    IPF_FRAG_LIST_RSS = 0,

 };

 

 enum ipf_counter_type {

@@ -122,6 +123,7 @@ struct ipf_list {

     int last_sent_idx;             /* Last sent fragment idx. */

     int last_inuse_idx;            /* Last inuse fragment idx. */

     int size;                      /* Fragment list size. */

+    uint32_t rss;                  /* RSS hash value of fragment. */

     uint8_t state;                 /* Frag list state; see ipf_list_state. */

 };

 

@@ -444,6 +446,8 @@ ipf_reassemble_v4_frags(struct ipf_list *ipf_list)

     l3->ip_frag_off = new_ip_frag_off;

     dp_packet_set_l2_pad_size(pkt, 0);

 

+    /* Store the rss value of the first v4 fragment in ipf_list */

+    ipf_list->rss = frag_list[0].pkt->mbuf.hash.rss;

     return pkt;

 }

 

@@ -502,6 +506,9 @@ ipf_reassemble_v6_frags(struct ipf_list *ipf_list)

     l3->ip6_plen = htons(pl);

     l3->ip6_ctlun.ip6_un1.ip6_un1_nxt = nw_proto;

     dp_packet_set_l2_pad_size(pkt, 0);

+

+/* Store the rss value of the first v6 fragment in ipf_list */

+    ipf_list->rss = frag_list[0].pkt->mbuf.hash.rss;

     return pkt;

 }

 

@@ -842,6 +849,7 @@ ipf_list_init(struct ipf_list *ipf_list, struct 
ipf_list_key *key,

     ipf_list->reass_execute_ctx = NULL;

     ipf_list->state = IPF_LIST_STATE_UNUSED;

     ipf_list->size = max_frag_list_size;

+    ipf_list->rss = IPF_FRAG_LIST_RSS;

     ipf_list->frag_list

         = xzalloc(ipf_list->size * sizeof *ipf_list->frag_list);

 }

@@ -1027,6 +1035,9 @@ ipf_send_frags_in_list(struct ipf *ipf, struct ipf_list 
*ipf_list,

     while (ipf_list->last_sent_idx < ipf_list->last_inuse_idx) {

         struct dp_packet *pkt

             = ipf_list->frag_list[ipf_list->last_sent_idx + 1].pkt;

+        /* Ensure all fragments of a big packet hava same rss value, that can 
generate

+         * same tunnel outer port.*/

+        pkt->mbuf.hash.rss = ipf_list->rss;

         if (ipf_dp_packet_batch_add(pb, pkt, true)) {

             ipf_list->last_sent_idx++;

             atomic_count_dec(&ipf->nfrag);

-- 



















--

它山之石,可以攻玉。
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to