From: Ling, X. <xia...@in...> - 2004-05-31 01:06:39
|
Ok, That's great fix=A3=A1 The code is more stable now. >-----Original Message----- >From: Mark Haverkamp [mailto:ma...@os...]=20 >Sent: 2004=C4=EA5=D4=C227=C8=D5 1:05 >To: Ling, Xiaofeng; Jon Maloy; tipc >Subject: sendbcast/recvbcast patch > >I went through sendbcast and recvbcast and fixed the return codes.=20 >While I was in there I updated the comments headers to reflect what the >functions actually return and fixed some line length problems. > >I had to change a couple returns of TIPC_ERR_NO_PORT and >TIPC_ERR_NO_NAME to be TIPC_FAILURE since the expected return=20 >value is a >message size. TIPC_ERR_NO_NAME and TIPC_ERR_NO_PORT are positive >numbers and could be confused with messages sizes, where=20 >TIPC_FAILURE is >-22 and can not be confused with a size. > >Mark. > > >cvs diff -u recvbcast.c sendbcast.c >Index: recvbcast.c >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >RCS file: /cvsroot/tipc/source/unstable/net/tipc/recvbcast.c,v >retrieving revision 1.20 >diff -u -r1.20 recvbcast.c >--- recvbcast.c 26 May 2004 01:31:04 -0000 1.20 >+++ recvbcast.c 26 May 2004 16:57:21 -0000 >@@ -215,11 +215,14 @@ > } >=20 > /** >- * Add the buf to the ownership node deferred queue,update=20 >defer_inqueue size and gap >+ * Add the buf to the ownership node deferred queue,update=20 >defer_inqueue=20 >+ * size and gap. >+ * > * Input: this: the link buf belonged >- * buf: to be added to deffer queue >- * Return: 1: true >- * 0: false >+ * buf: to be added to deffer queue >+ * >+ * Return: 1: true >+ * 0: false > */ >=20 > static int >@@ -241,9 +244,12 @@ > } >=20 > /** >- * Recaulte the gap, accord to the defer queue packet's=20 >seqno, reorgnize them and send them >- * to port, update the gap, defer_queue_size, last_in_bcast. >+ * Recaulte the gap, accord to the defer queue packet's=20 >seqno, reorgnize=20 >+ * them and send them to port, update the gap, defer_queue_size,=20 >+ * last_in_bcast. >+ * > * Input: this: link >+ * > * Return: void =20 > */ > static void >@@ -276,7 +282,8 @@ > /** > * process the bcast_nextsend in TIPC header.=20 > * input: this: link >- * buf: recv buf >+ * buf: recv buf >+ * > * return:void > */ > void >@@ -307,10 +314,12 @@ > } >=20 > /** >- * recieve the bcast data,case seqno equal to expect=20 >number,recv them, if greater than >- * expect seqno, add to defer queue. >+ * recieve the bcast data,case seqno equal to expect=20 >number,recv them,=20 >+ * if greater than expect seqno, add to defer queue. >+ * > * input: this: link >- * buf: recv buf >+ * buf: recv buf >+ * > * return:void=20 > */ > void >@@ -374,9 +383,12 @@ > } >=20 > /** >- * recieved the retransmit packet, which has been wraped,=20 >extract the buf and send to upper layer >+ * recieved the retransmit packet, which has been wraped,=20 >extract the=20 >+ * buf and send to upper layer >+ * > * input: this: link >- * buf: recv buf >+ * buf: recv buf >+ * > * return:void=20 > */ >=20 >@@ -399,7 +411,8 @@ > /** > * recieved the bcast state packet, handle retransmit. > * input: this: link >- * buf: recv buf >+ * buf: recv buf >+ * > * return:void=20 > */ > void >@@ -434,8 +447,10 @@ > /** > * deliver the buf to multicast member > * input: mc_head: mc_idenity list head >- * buf: recv buf >- * return:void=20 >+ * buf: recv buf >+ * >+ * return: message data size: success >+ * other: failure > */ >=20 > int >@@ -444,8 +459,8 @@ >=20 > struct list_head *pos; > struct mc_identity *mid; >- int res =3D TIPC_OK; >- int sz =3D msg_data_sz(buf_msg(buf)); >+ int res =3D msg_data_sz(buf_msg(buf)); >+ int sz; >=20 > dbg("nameseq_deliver\n"); > list_for_each(pos, mc_head) { >@@ -457,7 +472,7 @@ > msg_set_user(buf_msg(copymsg), 0); > msg_set_destport(buf_msg(copymsg), mid->port); > if (port) { >- res =3D port_recv_msg(copymsg); >+ sz =3D port_recv_msg(copymsg); > if (res !=3D sz) > break; > } >@@ -469,8 +484,10 @@ >=20 > /** > * request to retransmit the messages >- * input: this:use the link to send back the retransmit requests >- * gap: the seqno gap >+ * >+ * input: this: use the link to send back the retransmit requests >+ * gap: the seqno gap >+ * > * return:void=20 > */ >=20 >@@ -482,9 +499,11 @@ > } >=20 > /** >- * check bcast out queue, select the minmum ack seqno and=20 >deleted all the packets which >- * seqno is less than the minmum seqno >+ * check bcast out queue, select the minmum ack seqno and=20 >deleted all=20 >+ * the packets which seqno is less than the minmum seqno >+ * > * input: void >+ * > * return:void=20 > */ >=20 >@@ -518,7 +537,8 @@ > * lower level recv bcast proto message handle,=20 >differentiate their types and=20 > * call corresponding function > * input: this:link >- * buf: the recieved buffer >+ * buf: the recieved buffer >+ * > * return:void=20 > */ >=20 >@@ -550,16 +570,19 @@ > } >=20 > /** >- * port recieved function, get the mc idenity list and=20 >deliever the buf to the mc member =20 >+ * port recieved function, get the mc idenity list and=20 >deliever the buf=20 >+ * to the mc member. >+ * > * input: buf: the recieved buffer >- * return:void=20 >+ * >+ * return: message data size: success >+ * other: failure > */ >- > int > bcast_port_recv(struct sk_buff *buf) > { > struct list_head mc_head; >- int res =3D true; >+ int res; > struct tipc_msg *msg =3D buf_msg(buf); >=20 > INIT_LIST_HEAD(&mc_head); >@@ -569,7 +592,7 @@ > msg_nameupper(msg))) { > dbg("get TIPC_ERR_NO_PORT\n"); > buf_safe_discard(buf); >- return TIPC_ERR_NO_PORT; >+ return TIPC_FAILURE; > } > res =3D nameseq_deliver(buf, &mc_head); > free_mclist(&mc_head); >Index: sendbcast.c >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >RCS file: /cvsroot/tipc/source/unstable/net/tipc/sendbcast.c,v >retrieving revision 1.17 >diff -u -r1.17 sendbcast.c >--- sendbcast.c 26 May 2004 01:40:12 -0000 1.17 >+++ sendbcast.c 26 May 2004 16:57:22 -0000 >@@ -150,7 +150,7 @@ > * @size: packet length > * @importance: priority > * mc_head: mc idenitity head >- * @Return: TIPC_OK: success >+ * @Return: message data size: success > * TIPC_FAILURE: fail > * TIPC_CONGEST: congest > */ >@@ -214,7 +214,7 @@ > INIT_LIST_HEAD(&mc_head); > res =3D nametbl_mc_translate(&mc_head, seq->type,=20 >seq->lower, seq->upper); > if (res =3D=3D false) >- return TIPC_ERR_NO_NAME; >+ return TIPC_FAILURE; > tipc_ownidentity(ref, &orig); > hdr =3D &this->publ.phdr; > msg_set_type(hdr, TIPC_MCAST_MSG); >@@ -271,8 +271,9 @@ > * send the buf using the bcastlinkset > * Input parameter: buf: buf to be added to the outqueue > * mc_head: mc identity head; >- * Return: TIPC_OK: success >- * other values: fail >+ * >+ * Return: message data size: success >+ * other values: fail > */ >=20 > int >@@ -409,6 +410,9 @@ > * blink_send_buf() is the 'full path' for messages, called from=20 > * inside TIPC when the 'fast path' in=20 >tipc_send_buf/tipc_send_sections=20 > * has failed, and from link_send() >+ * >+ * return message data size: success >+ * other: failure > */ >=20 > static int >@@ -420,6 +424,8 @@ > uint imp =3D msg_tot_importance(msg); > uint queue_limit =3D this->queue_limit[imp]; > uint max_packet =3D link_max_pkt(this); >+ uint dsz =3D msg_data_sz(msg); >+ > msg_set_prevnode(msg, tipc_own_addr); >=20 > if (unlikely(queue_size >=3D queue_limit)) { >@@ -434,12 +440,11 @@ > warn("Resetting %s, send queue full",=20 >this->name); > link_reset(this); > } >- return TIPC_OK; >+ return dsz; > } >=20 > if (size > max_packet) { >- link_send_long_buf(this, buf); >- return TIPC_OK; >+ return link_send_long_buf(this, buf); > } >=20 > if (queue_size > this->stats.max_queue_sz) >@@ -454,22 +459,22 @@ > bearer_schedule(this->bearer, this); > this->next_out =3D buf; > } >- return TIPC_OK; >+ return dsz; > } >=20 > if (!this->next_out) > this->next_out =3D buf; > blink_add_to_outqueue(this, buf); > bearer_resolve_congestion(this->bearer, this); >- return TIPC_OK; >+ return dsz; > } >=20 > /** > * send out the broadcast buf using common link,add the buf=20 >to bcast out queue > * Input : buf: buffer to be sent > * this: link >- * return: TIPC_OK: true >- * other: failure >+ * return: message data size: success >+ * other: failure > */ >=20 > int >@@ -478,7 +483,7 @@ >=20 > struct tipc_msg *msg =3D buf_msg(buf); > if (likely(this)) { >- int res =3D TIPC_OK; >+ int res =3D msg_data_sz(msg); > if (likely(!link_congested(this))) { > if (likely(msg_size(msg) <=3D=20 >link_max_pkt(this))) { > if (likely( >@@ -501,7 +506,6 @@ > =09 >bearer_schedule(this->bearer, > this); > this->next_out =3D buf; >- res =3D TIPC_OK; > goto exit; > } > } >@@ -514,7 +518,7 @@ > if (msg_destnode(msg) =3D=3D tipc_own_addr) > return port_recv_msg(buf); > tipc_reject_msg(buf, TIPC_ERR_NO_NODE); >- return TIPC_OK; >+ return TIPC_FAILURE; > } >=20 > /** >@@ -679,10 +683,11 @@ >=20 > /** > * Tunel the buffer in the broadcast packet and retransmit it >- * Input parameters: this: link >- * buf: buffer to be sent >- * last_seq:seqno >- * return : void >+ * Input parameters: this: link >+ * buf: buffer to be sent >+ * last_seq:seqno >+ * >+ * return : void > */ > void > bcast_link_retransmit(struct link *this, struct sk_buff *buf,=20 >uint lastseq) > >--=20 >Mark Haverkamp <ma...@os...> > > |