On 09/29/2018 04:52 AM, Jon Maloy wrote:
> From: LUU Duc Canh <canh.d....@dektech.com.au>
> 
> Currently, the broadcast retransmission algorithm is using the
> 'prev_retr' field in struct tipc_link to time stamp the latest broadcast
> retransmission occasion. This helps to restrict retransmission of
> individual broadcast packets to max once per 10 milliseconds, even
> though all other criteria for retransmission are met.
> 
> We now move this time stamp to the control block of each individual
> packet, and remove other limiting criteria. This simplifies the
> retransmission algorithm, and eliminates any risk of logical errors
> in selecting which packets can be retransmitted.
> 
> Signed-off-by: LUU Duc Canh <canh.d....@dektech.com.au>
> Signed-off-by: Jon Maloy <jon.ma...@ericsson.com>

Good approach!

Acked-by: Ying Xue <ying....@windriver.com>

> ---
>  net/tipc/link.c | 49 +++++++------------------------------------------
>  net/tipc/msg.h  |  1 +
>  2 files changed, 8 insertions(+), 42 deletions(-)
> 
> diff --git a/net/tipc/link.c b/net/tipc/link.c
> index b1f0bee..8fe5feb 100644
> --- a/net/tipc/link.c
> +++ b/net/tipc/link.c
> @@ -186,9 +186,6 @@ struct tipc_link {
>       u16 acked;
>       struct tipc_link *bc_rcvlink;
>       struct tipc_link *bc_sndlink;
> -     unsigned long prev_retr;
> -     u16 prev_from;
> -     u16 prev_to;
>       u8 nack_state;
>       bool bc_peer_is_up;
>  
> @@ -210,7 +207,7 @@ enum {
>       BC_NACK_SND_SUPPRESS,
>  };
>  
> -#define TIPC_BC_RETR_LIMIT 10   /* [ms] */
> +#define TIPC_BC_RETR_LIM msecs_to_jiffies(10)   /* [ms] */
>  
>  /*
>   * Interval between NACKs when packets arrive out of order
> @@ -1035,6 +1032,11 @@ static int tipc_link_retrans(struct tipc_link *l, 
> struct tipc_link *r,
>                       continue;
>               if (more(msg_seqno(hdr), to))
>                       break;
> +             if (link_is_bc_sndlink(l)) {
> +                     if (time_before(jiffies, TIPC_SKB_CB(skb)->nxt_retr))
> +                             continue;
> +                     TIPC_SKB_CB(skb)->nxt_retr = jiffies + TIPC_BC_RETR_LIM;
> +             }
>               _skb = __pskb_copy(skb, MIN_H_SIZE, GFP_ATOMIC);
>               if (!_skb)
>                       return 0;
> @@ -1679,42 +1681,6 @@ void tipc_link_bc_init_rcv(struct tipc_link *l, struct 
> tipc_msg *hdr)
>               l->rcv_nxt = peers_snd_nxt;
>  }
>  
> -/* link_bc_retr eval()- check if the indicated range can be retransmitted now
> - * - Adjust permitted range if there is overlap with previous retransmission
> - */
> -static bool link_bc_retr_eval(struct tipc_link *l, u16 *from, u16 *to)
> -{
> -     unsigned long elapsed = jiffies_to_msecs(jiffies - l->prev_retr);
> -
> -     if (less(*to, *from))
> -             return false;
> -
> -     /* New retransmission request */
> -     if ((elapsed > TIPC_BC_RETR_LIMIT) ||
> -         less(*to, l->prev_from) || more(*from, l->prev_to)) {
> -             l->prev_from = *from;
> -             l->prev_to = *to;
> -             l->prev_retr = jiffies;
> -             return true;
> -     }
> -
> -     /* Inside range of previous retransmit */
> -     if (!less(*from, l->prev_from) && !more(*to, l->prev_to))
> -             return false;
> -
> -     /* Fully or partially outside previous range => exclude overlap */
> -     if (less(*from, l->prev_from)) {
> -             *to = l->prev_from - 1;
> -             l->prev_from = *from;
> -     }
> -     if (more(*to, l->prev_to)) {
> -             *from = l->prev_to + 1;
> -             l->prev_to = *to;
> -     }
> -     l->prev_retr = jiffies;
> -     return true;
> -}
> -
>  /* tipc_link_bc_sync_rcv - update rcv link according to peer's send state
>   */
>  int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr,
> @@ -1745,8 +1711,7 @@ int tipc_link_bc_sync_rcv(struct tipc_link *l, struct 
> tipc_msg *hdr,
>       if (more(peers_snd_nxt, l->rcv_nxt + l->window))
>               return rc;
>  
> -     if (link_bc_retr_eval(snd_l, &from, &to))
> -             rc = tipc_link_retrans(snd_l, l, from, to, xmitq);
> +     rc = tipc_link_retrans(snd_l, l, from, to, xmitq);
>  
>       l->snd_nxt = peers_snd_nxt;
>       if (link_bc_rcv_gap(l))
> diff --git a/net/tipc/msg.h b/net/tipc/msg.h
> index a2879e6..a092495 100644
> --- a/net/tipc/msg.h
> +++ b/net/tipc/msg.h
> @@ -105,6 +105,7 @@ struct tipc_skb_cb {
>       u32 bytes_read;
>       u32 orig_member;
>       struct sk_buff *tail;
> +     unsigned long nxt_retr;
>       bool validated;
>       u16 chain_imp;
>       u16 ackers;
> 


_______________________________________________
tipc-discussion mailing list
tipc-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to