diff --git a/examples/get_af_ninet.c b/examples/get_af_ninet.c index d245f2d86512740bf03a98febb7fe0f6c2337703..83a33304fc61aba336258ebbf8115b671106450e 100644 --- a/examples/get_af_ninet.c +++ b/examples/get_af_ninet.c @@ -69,9 +69,7 @@ int get_af_ninet(void) int main(int argc, char **argv) { - int af_ninet = get_af_ninet(); - - printf("af_ninet=%d\n\n", g_af_ninet); + printf("af_ninet=%d\n\n", get_af_ninet()); return 0; } diff --git a/examples/nip_lib.c b/examples/nip_lib.c index 1c679a0a576e562cfa71053e535de00bfa16f7af..d41496885f92ec53fafda17a4a30547e97d89dd4 100644 --- a/examples/nip_lib.c +++ b/examples/nip_lib.c @@ -96,8 +96,7 @@ int nip_addr_fmt(char *addr_str, struct nip_addr *sap, int addrlen_input) first_byte += addr_str[1]; if (first_byte <= ADDR_FIRST_DC) addrlen = NIP_ADDR_LEN_1; - else if ((first_byte > ADDR_FIRST_DC && first_byte <= ADDR_FIRST_F0) || - (first_byte == ADDR_FIRST_FF)) + else if (first_byte <= ADDR_FIRST_F0 || first_byte == ADDR_FIRST_FF) addrlen = NIP_ADDR_LEN_2; else if (first_byte == ADDR_FIRST_F1) addrlen = NIP_ADDR_LEN_3; @@ -130,7 +129,6 @@ int nip_addr_fmt(char *addr_str, struct nip_addr *sap, int addrlen_input) int nip_get_addr(char **args, struct nip_addr *addr) { - int ret; unsigned int len; char *sp = *args; int addrlen_input = 0; diff --git a/src/linux/net/newip/tcp_nip_input.c b/src/linux/net/newip/tcp_nip_input.c index 7f6333f21e4a1092da9e5d19918211df08adbd7c..1b01ce13c6921e5bed12aeaae05293bc6a56ab97 100644 --- a/src/linux/net/newip/tcp_nip_input.c +++ b/src/linux/net/newip/tcp_nip_input.c @@ -118,10 +118,10 @@ static void tcp_nip_overlap_handle(struct tcp_sock *tp, struct sk_buff *skb) static void tcp_nip_ofo_queue(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); - struct sk_buff *skb; while (tp->nip_out_of_order_queue) { - skb = tp->nip_out_of_order_queue; + struct sk_buff *skb = tp->nip_out_of_order_queue; + if (after(TCP_SKB_CB(tp->nip_out_of_order_queue)->seq, tp->rcv_nxt)) return; tp->nip_out_of_order_queue = tp->nip_out_of_order_queue->next; @@ -892,8 +892,8 @@ static inline bool tcp_nip_may_update_window(const struct tcp_sock *tp, (ack_seq == tp->snd_wl1 && nwin > tp->snd_wnd); } -static int tcp_nip_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32 ack, - u32 ack_seq) +static void tcp_nip_ack_update_window(struct sock *sk, const struct sk_buff *skb, u32 ack, + u32 ack_seq) { struct tcp_sock *tp = tcp_sk(sk); int flag = 0; @@ -912,8 +912,6 @@ static int tcp_nip_ack_update_window(struct sock *sk, const struct sk_buff *skb, tp->pred_flags = 0; } } - - return flag; } /* Check whether the ACK returned by the packet is detected @@ -1135,7 +1133,7 @@ static void tcp_nip_ack_calc_ssthresh(struct sock *sk, u32 ack, int icsk_rto_las } } -static int tcp_nip_ack(struct sock *sk, const struct sk_buff *skb, int flag) +static int tcp_nip_ack(struct sock *sk, const struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); struct tcp_nip_common *ntp = &tcp_nip_sk(sk)->common; @@ -1145,16 +1143,15 @@ static int tcp_nip_ack(struct sock *sk, const struct sk_buff *skb, int flag) u32 ack = TCP_SKB_CB(skb)->ack_seq; int prior_packets = tp->packets_out; ktime_t skb_snd_tstamp = 0; - int icsk_rto_last; if (before(ack, prior_snd_una)) return 0; if (after(ack, tp->snd_nxt)) return -1; - (void)tcp_nip_ack_update_window(sk, skb, ack, ack_seq); - icsk->icsk_probes_out = 0; // probe0 cnt - ntp->nip_keepalive_out = 0; // keepalive cnt + tcp_nip_ack_update_window(sk, skb, ack, ack_seq); + icsk->icsk_probes_out = 0; /* probe0 cnt */ + ntp->nip_keepalive_out = 0; /* keepalive cnt */ tp->rcv_tstamp = tcp_jiffies32; /* maybe zero window probe */ @@ -1167,6 +1164,8 @@ static int tcp_nip_ack(struct sock *sk, const struct sk_buff *skb, int flag) } if (after(ack, prior_snd_una)) { + int icsk_rto_last; + icsk->icsk_retransmits = 0; tp->retrans_stamp = tcp_time_stamp(tp); tp->rcv_tstamp = tcp_jiffies32; @@ -1297,7 +1296,7 @@ void tcp_nip_rcv_established(struct sock *sk, struct sk_buff *skb, if (!tcp_nip_validate_incoming(sk, skb, th, 1)) return; - if (tcp_nip_ack(sk, skb, 0) < 0) + if (tcp_nip_ack(sk, skb) < 0) goto discard; tcp_nip_data_queue(sk, skb); @@ -1427,7 +1426,7 @@ static int tcp_nip_rcv_synsent_state_process(struct sock *sk, struct sk_buff *sk tcp_init_wl(tp, TCP_SKB_CB(skb)->seq); - tcp_nip_ack(sk, skb, FLAG_SLOWPATH); + tcp_nip_ack(sk, skb); tp->nip_out_of_order_queue = NULL; /* The next data number expected to be accepted is +1 */ tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; @@ -1556,7 +1555,7 @@ int tcp_nip_rcv_state_process(struct sock *sk, struct sk_buff *skb) if (!tcp_nip_validate_incoming(sk, skb, th, 0)) return 0; - acceptable = tcp_nip_ack(sk, skb, 0); + acceptable = tcp_nip_ack(sk, skb); /* If the third handshake ACK is invalid, 1 is returned * and the SKB is discarded in tcp_nip_rcv diff --git a/src/linux/net/newip/tcp_nip_output.c b/src/linux/net/newip/tcp_nip_output.c index 5b34d6bd2e14bcde56bc22e71add1ed3b0a14d3d..2db7b0c6fb0ab86c84f8a0dc457b13317cac0198 100644 --- a/src/linux/net/newip/tcp_nip_output.c +++ b/src/linux/net/newip/tcp_nip_output.c @@ -39,8 +39,6 @@ struct tcp_nip_out_options { u8 ws; /* window scale, 0 to disable, If the window is enlarged, * 0 indicates that the option is disabled */ - u8 hash_size; /* bytes in hash_location */ - __u8 *hash_location; /* temporary pointer, overloaded */ __u32 tsval, tsecr; /* need to include OPTION_TS */ }; @@ -542,9 +540,8 @@ static int __tcp_nip_transmit_skb(struct sock *sk, struct sk_buff *skb, tcp_nip_event_ack_sent(sk, tcp_skb_pcount(skb), rcv_nxt); /* There's data to send */ - if (skb->len != tcp_header_size) { + if (skb->len != tcp_header_size) tp->data_segs_out += tcp_skb_pcount(skb); - } memset(skb->cb, 0, sizeof(struct ninet_skb_parm)); err = icsk->icsk_af_ops->queue_xmit(sk, skb, &inet->cork.fl); @@ -607,7 +604,6 @@ int __tcp_nip_connect(struct sock *sk) tp->snd_nxt = tp->write_seq; tp->pushed_seq = tp->write_seq; - buff = tcp_nip_send_head(sk); TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS); @@ -1040,7 +1036,6 @@ static bool tcp_nip_write_xmit(struct sock *sk, unsigned int mss_now, int nonagl struct sk_buff *skb; u32 snd_num = g_nip_tcp_snd_win_enable ? (ntp->nip_ssthresh / mss_now) : 0xFFFFFFFF; u32 last_nip_ssthresh = ntp->nip_ssthresh; - bool snd_wnd_ready; static const char * const str[] = {"can`t send pkt because no window", "have window to send pkt"}; @@ -1062,6 +1057,8 @@ static bool tcp_nip_write_xmit(struct sock *sk, unsigned int mss_now, int nonagl } while ((skb = tcp_nip_send_head(sk)) && (snd_num--)) { + bool snd_wnd_ready; + tcp_nip_init_tso_segs(skb, mss_now); snd_wnd_ready = tcp_nip_snd_wnd_test(tp, skb, mss_now); DEBUG("%s %s, skb->len=%u", __func__, (snd_wnd_ready ? str[1] : str[0]), skb->len); @@ -1105,7 +1102,7 @@ int __tcp_nip_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) { struct tcp_sock *tp = tcp_sk(sk); unsigned int cur_mss; - int diff, len, err; + int len, err; if (before(TCP_SKB_CB(skb)->seq, tp->snd_una)) { if (unlikely(before(TCP_SKB_CB(skb)->end_seq, tp->snd_una))) { @@ -1128,7 +1125,8 @@ int __tcp_nip_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) skb, len, cur_mss, GFP_ATOMIC)) return -ENOMEM; /* We'll try again later. */ } else { - diff = tcp_skb_pcount(skb); + int diff = tcp_skb_pcount(skb); + tcp_nip_set_skb_tso_segs(skb, cur_mss); diff -= tcp_skb_pcount(skb); if (diff)