aboutsummaryrefslogtreecommitdiffstats
path: root/net/llc/llc_c_ac.c
diff options
context:
space:
mode:
authorJochen Friedrich <jochen@scram.de>2005-11-15 00:57:15 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-15 00:57:15 -0500
commit59c6196e59a4b85d9c994e70ff20a460cdbaa003 (patch)
tree574e979829d3363c16c8c6d1fe624b206d8ce4f9 /net/llc/llc_c_ac.c
parentcb422c464bdaeeb3b9ad4539010e357bf1bd1745 (diff)
[LLC]: Fix TX window scaling
Signed-off-by: Jochen Friedrich <jochen@scram.de> Acked-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/llc/llc_c_ac.c')
-rw-r--r--net/llc/llc_c_ac.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
index b0bcfb1f12dd..91fb6bc1b116 100644
--- a/net/llc/llc_c_ac.c
+++ b/net/llc/llc_c_ac.c
@@ -866,7 +866,8 @@ int llc_conn_ac_send_ack_if_needed(struct sock *sk, struct sk_buff *skb)
866 llc->ack_must_be_send = 1; 866 llc->ack_must_be_send = 1;
867 llc->ack_pf = pf_bit & 1; 867 llc->ack_pf = pf_bit & 1;
868 } 868 }
869 if (((llc->vR - llc->first_pdu_Ns + 129) % 128) >= llc->npta) { 869 if (((llc->vR - llc->first_pdu_Ns + 1 + LLC_2_SEQ_NBR_MODULO)
870 % LLC_2_SEQ_NBR_MODULO) >= llc->npta) {
870 llc_conn_ac_send_rr_rsp_f_set_ackpf(sk, skb); 871 llc_conn_ac_send_rr_rsp_f_set_ackpf(sk, skb);
871 llc->ack_must_be_send = 0; 872 llc->ack_must_be_send = 0;
872 llc->ack_pf = 0; 873 llc->ack_pf = 0;
@@ -994,8 +995,8 @@ static int llc_conn_ac_inc_npta_value(struct sock *sk, struct sk_buff *skb)
994 llc->dec_step = 0; 995 llc->dec_step = 0;
995 llc->dec_cntr = llc->inc_cntr = 2; 996 llc->dec_cntr = llc->inc_cntr = 2;
996 ++llc->npta; 997 ++llc->npta;
997 if (llc->npta > 127) 998 if (llc->npta > ~LLC_2_SEQ_NBR_MODULO)
998 llc->npta = 127 ; 999 llc->npta = ~LLC_2_SEQ_NBR_MODULO ;
999 } else 1000 } else
1000 --llc->inc_cntr; 1001 --llc->inc_cntr;
1001 return 0; 1002 return 0;
@@ -1065,9 +1066,10 @@ int llc_conn_ac_dec_tx_win_size(struct sock *sk, struct sk_buff *skb)
1065 struct llc_sock *llc = llc_sk(sk); 1066 struct llc_sock *llc = llc_sk(sk);
1066 u8 unacked_pdu = skb_queue_len(&llc->pdu_unack_q); 1067 u8 unacked_pdu = skb_queue_len(&llc->pdu_unack_q);
1067 1068
1068 llc->k -= unacked_pdu; 1069 if (llc->k - unacked_pdu < 1)
1069 if (llc->k < 2) 1070 llc->k = 1;
1070 llc->k = 2; 1071 else
1072 llc->k -= unacked_pdu;
1071 return 0; 1073 return 0;
1072} 1074}
1073 1075
@@ -1084,8 +1086,8 @@ int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct sk_buff *skb)
1084 struct llc_sock *llc = llc_sk(sk); 1086 struct llc_sock *llc = llc_sk(sk);
1085 1087
1086 llc->k += 1; 1088 llc->k += 1;
1087 if (llc->k > 128) 1089 if (llc->k > ~LLC_2_SEQ_NBR_MODULO)
1088 llc->k = 128 ; 1090 llc->k = ~LLC_2_SEQ_NBR_MODULO ;
1089 return 0; 1091 return 0;
1090} 1092}
1091 1093
@@ -1309,7 +1311,7 @@ int llc_conn_ac_set_vs_nr(struct sock *sk, struct sk_buff *skb)
1309 1311
1310static int llc_conn_ac_inc_vs_by_1(struct sock *sk, struct sk_buff *skb) 1312static int llc_conn_ac_inc_vs_by_1(struct sock *sk, struct sk_buff *skb)
1311{ 1313{
1312 llc_sk(sk)->vS = (llc_sk(sk)->vS + 1) % 128; 1314 llc_sk(sk)->vS = (llc_sk(sk)->vS + 1) % LLC_2_SEQ_NBR_MODULO;
1313 return 0; 1315 return 0;
1314} 1316}
1315 1317