From: Mark H. <ma...@os...> - 2004-05-26 17:05:03
|
I went through sendbcast and recvbcast and fixed the return codes. 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 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 TIPC_FAILURE is -22 and can not be confused with a size. Mark. cvs diff -u recvbcast.c sendbcast.c Index: recvbcast.c =================================================================== 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 @@ } /** - * Add the buf to the ownership node deferred queue,update defer_inqueue size and gap + * Add the buf to the ownership node deferred queue,update defer_inqueue + * 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 */ static int @@ -241,9 +244,12 @@ } /** - * Recaulte the gap, accord to the defer queue packet's 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 seqno, reorgnize + * them and send them to port, update the gap, defer_queue_size, + * last_in_bcast. + * * Input: this: link + * * Return: void */ static void @@ -276,7 +282,8 @@ /** * process the bcast_nextsend in TIPC header. * input: this: link - * buf: recv buf + * buf: recv buf + * * return:void */ void @@ -307,10 +314,12 @@ } /** - * recieve the bcast data,case seqno equal to expect number,recv them, if greater than - * expect seqno, add to defer queue. + * recieve the bcast data,case seqno equal to expect number,recv them, + * if greater than expect seqno, add to defer queue. + * * input: this: link - * buf: recv buf + * buf: recv buf + * * return:void */ void @@ -374,9 +383,12 @@ } /** - * recieved the retransmit packet, which has been wraped, extract the buf and send to upper layer + * recieved the retransmit packet, which has been wraped, extract the + * buf and send to upper layer + * * input: this: link - * buf: recv buf + * buf: recv buf + * * return:void */ @@ -399,7 +411,8 @@ /** * recieved the bcast state packet, handle retransmit. * input: this: link - * buf: recv buf + * buf: recv buf + * * return:void */ void @@ -434,8 +447,10 @@ /** * deliver the buf to multicast member * input: mc_head: mc_idenity list head - * buf: recv buf - * return:void + * buf: recv buf + * + * return: message data size: success + * other: failure */ int @@ -444,8 +459,8 @@ struct list_head *pos; struct mc_identity *mid; - int res = TIPC_OK; - int sz = msg_data_sz(buf_msg(buf)); + int res = msg_data_sz(buf_msg(buf)); + int sz; 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 = port_recv_msg(copymsg); + sz = port_recv_msg(copymsg); if (res != sz) break; } @@ -469,8 +484,10 @@ /** * 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 */ @@ -482,9 +499,11 @@ } /** - * check bcast out queue, select the minmum ack seqno and deleted all the packets which - * seqno is less than the minmum seqno + * check bcast out queue, select the minmum ack seqno and deleted all + * the packets which seqno is less than the minmum seqno + * * input: void + * * return:void */ @@ -518,7 +537,8 @@ * lower level recv bcast proto message handle, differentiate their types and * call corresponding function * input: this:link - * buf: the recieved buffer + * buf: the recieved buffer + * * return:void */ @@ -550,16 +570,19 @@ } /** - * port recieved function, get the mc idenity list and deliever the buf to the mc member + * port recieved function, get the mc idenity list and deliever the buf + * to the mc member. + * * input: buf: the recieved buffer - * return:void + * + * return: message data size: success + * other: failure */ - int bcast_port_recv(struct sk_buff *buf) { struct list_head mc_head; - int res = true; + int res; struct tipc_msg *msg = buf_msg(buf); 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 = nameseq_deliver(buf, &mc_head); free_mclist(&mc_head); Index: sendbcast.c =================================================================== 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 = nametbl_mc_translate(&mc_head, seq->type, seq->lower, seq->upper); if (res == false) - return TIPC_ERR_NO_NAME; + return TIPC_FAILURE; tipc_ownidentity(ref, &orig); hdr = &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 */ int @@ -409,6 +410,9 @@ * blink_send_buf() is the 'full path' for messages, called from * inside TIPC when the 'fast path' in tipc_send_buf/tipc_send_sections * has failed, and from link_send() + * + * return message data size: success + * other: failure */ static int @@ -420,6 +424,8 @@ uint imp = msg_tot_importance(msg); uint queue_limit = this->queue_limit[imp]; uint max_packet = link_max_pkt(this); + uint dsz = msg_data_sz(msg); + msg_set_prevnode(msg, tipc_own_addr); if (unlikely(queue_size >= queue_limit)) { @@ -434,12 +440,11 @@ warn("Resetting %s, send queue full", this->name); link_reset(this); } - return TIPC_OK; + return dsz; } if (size > max_packet) { - link_send_long_buf(this, buf); - return TIPC_OK; + return link_send_long_buf(this, buf); } if (queue_size > this->stats.max_queue_sz) @@ -454,22 +459,22 @@ bearer_schedule(this->bearer, this); this->next_out = buf; } - return TIPC_OK; + return dsz; } if (!this->next_out) this->next_out = buf; blink_add_to_outqueue(this, buf); bearer_resolve_congestion(this->bearer, this); - return TIPC_OK; + return dsz; } /** * send out the broadcast buf using common link,add the buf 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 */ int @@ -478,7 +483,7 @@ struct tipc_msg *msg = buf_msg(buf); if (likely(this)) { - int res = TIPC_OK; + int res = msg_data_sz(msg); if (likely(!link_congested(this))) { if (likely(msg_size(msg) <= link_max_pkt(this))) { if (likely( @@ -501,7 +506,6 @@ bearer_schedule(this->bearer, this); this->next_out = buf; - res = TIPC_OK; goto exit; } } @@ -514,7 +518,7 @@ if (msg_destnode(msg) == tipc_own_addr) return port_recv_msg(buf); tipc_reject_msg(buf, TIPC_ERR_NO_NODE); - return TIPC_OK; + return TIPC_FAILURE; } /** @@ -679,10 +683,11 @@ /** * 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, uint lastseq) -- Mark Haverkamp <ma...@os...> |