[Click] Implementing a packet cache for selective ACKs and ReTx

Roman Chertov rchertov at cs.ucsb.edu
Wed Oct 28 12:20:44 EDT 2009


Ashish,

You should be able to just create a brand new packet of the appropriate
size and then copy the data of the original packet into it.  That way,
you will have a shiny new packet that is not dependent on anything else.

Roman

Ashish Sharma wrote:
> Hi,
> 
> I am trying to implement a bulk acknowledgement scheme with selective
> retransmits for wireless. I have implemented a TDMA based MAC for wireless
> wherein a node sends multiple packets during its slot. Instead of per-packet
> 802.11 acks, I am trying to implement a piggy-backed bulk ACK scheme where
> the recipient responds with a bitmap of the received packets that it is
> trying to acknowledge. For this I have implemented my own sequence number
> management in a separate header.
> 
> The issue is, that after I assign it my custom sequence number, I need to
> create a copy of the packet along with all the headers and data so that it
> can be retransmitted at a later time if it is not ACKed by the recipient.
> 
> My question is how do I do this, since Packet::clone shares the data with
> the original packet (which is killed after being send to ToDevice ?) and
> with Packet::uniqueify() I can only create one copy? Documentation in
> packet.cc mentions that
> 
> Packet *p = ...;
> if (WritablePacket *q = p->uniqueify()) {
>             Packet *p2 = q->clone();
>             assert(p2);
> }
> is buggy and WritablePacket::clone() is discouraged.
> 
> My function looks something like this:
> 
> Packet * BulkAckManager::handle_outgoing_pkt(Packet *p,..) {
>  WritablePacket *p_out = p->uniqueify();
>      if (p_out) {
>              // Put sequence number in p_out->bulk_ack_hdr;
>             * WritablePacket *q_copy = p_out->clone();   *or *
> p_out->uniqueify()*or *p->uniqueify(*);
>             insert_in_cache(seq_num, q_copy);
>             return p_out;
>      }
>   }
> 
> Packet * BulkAckManager::Retransmit(seq_num) {
>   Packet* p_retx = fetch_from_cache(seq_num);
>   return p_retx;
> }
> 
> I have tried p_out->clone(), p_out->uniqueify and p->uniqueify  and each
> time I get a Seg Fault when trying to retransmit this packet at a later
> stage.
> 
> I will be grateful for any suggestions. Thanks for your time.
> 
> Ashish
> 
> P.S. : I looked at snooptcp.cc  and it also maintains a packet cache,
> however I believe it never modifies the packets, so
> WritablePacket->uniqueify followed by another copy is not required there.
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 



More information about the click mailing list