Skip to content

Commit

Permalink
Merge pull request #171 from natsys/ab-56-refcnt
Browse files Browse the repository at this point in the history
Set the kernel as an extra user of SKBs that are sent out.
  • Loading branch information
keshonok committed Aug 4, 2015
2 parents 1d82c49 + 6ea9bfb commit 2636242
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tempesta_fw/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,19 @@ ss_send(struct sock *sk, const SsSkbList *skb_list)
SS_DBG("%s:%d entail skb=%p data_len=%u len=%u\n",
__FUNCTION__, __LINE__, skb, skb->data_len, skb->len);

/*
* When SKBs are removed from socket's receive queue and
* passed to Tempesta, control over these SKBs is passed
* from kernel to Tempesta as well. Tempesta becomes the
* sole owner of these SKBs. When these SKBs are sent out
* to a client or a backend by Tempesta, the kernel becomes
* an extra owner of the SKBs in addition to Tempesta.
* To account for that it's necessary to increment SKB's
* count of users so that SKBs are not freed from under
* Tempesta or from under the kernel.
*/
skb_get(skb);

skb_entail(sk, skb);

tcb->end_seq += skb->len;
Expand Down

0 comments on commit 2636242

Please sign in to comment.