Once an instance of the scheduler has been created, this function is called whenever a packet is to be sent through the scheduler. We place the packet into our internal queue (one per instance), ready to be removed when qsize_dequeue is called. No modifications are made to the skbuff/packet at this point.
- backlog - length of queue (bytes and packets)If the packet would place the queue over the limit, as specified by the limit option, it will be dropped. This is again recorded in the statistics.
If a packet has to be placed back into the queue for any reason, this function will be called. We put the packet at the head of the queue, so that it will be dequeued next. No change is made to the statistics, other than the length of the queue.
This function is used when updating the checksum of a packet we have modified. It is important to use this rather than recalculating the entire checksum, in case the previous checksum was invalid. In that case, we must take care not to make it correct.
This function retrieves the next packet to be sent. It also, if possible, modifies the packet so that it contains the p(q) TCP option. This is stored as option number 92, and it takes up 4 bytes. Because of this, it can only be included on packets which are 4 bytes or more smaller than the MTU of the device they're being sent on. Even so, this may cause troubles with Path-MTU discovery.If the packet is modified, the checksum will be recalculated.
Packets which are too big (> MTU - 4) will be passed through without modification. They will be recorded as having passed through, but not modified.
if (queue is empty) return NULL if (next packet is not IP and TCP) return it if (skb does not have enough tailroom, but packet can be grown) make room in the skb and insert zeroes at beginning of option if (packet can be grown): Fill in zeroes with option data Recalculate tcp checksum Recalculate ip checksum Increase stats for packets modified return the packet
The packet at the tail of the queue is removed, and its memory freed. If the queue was already empty, nothing is done.
This function resets a queue back to its initial state. The queue is purged, and statistics reseta. The queue will now be empty.
When a scheduler is added by running the tc command, this function is called to initialise the queue. Here we set the constants used to calculate p(q) and other variables, such as the length of the queue.It also ensures the module will not be unloaded until all instances have been destroyed.
This function frees all memory being used by the scheduler.
We don't seem to actually free any memory!!
When called, we create our own buffer, and fill it with information on all the qdisc instances. This uses the instances array the module keeps internally.
- Checks that the mandatory maxrate parameter was given. Fails to load otherwise - Creates the entry for the file /proc/net/fcm_queue - Initialises the instances array - Registers as a qdisc
Performs the following functions - Removes the file /proc/net/fcm_queue - Unregisters as a qdisc