Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using SKB headroom for SsSkbCb #166

Closed
milabs opened this issue Jul 28, 2015 · 3 comments
Closed

Using SKB headroom for SsSkbCb #166

milabs opened this issue Jul 28, 2015 · 3 comments
Assignees

Comments

@milabs
Copy link
Contributor

milabs commented Jul 28, 2015

Hello,

Is it possible to make TFW as a LKM without needing of kernel prepatching? As I see it, the patch (apart from other things) extends skb->cb so SsSkbCb resides on it. But taking into account that the SKBs has some headroom groving with increasing of the OSI's layer seems that it is possible to avoid SKB's cb area to extend.

#define TFW_MAGIC   0x54454d5045535441ULL

typedef struct {
    struct sk_buff  *next;
    struct sk_buff  *prev;
    unsigned long   magic;
} SsSkbCb;

#define TFW_SKB_CB(s)       ((SsSkbCb *)(s)->head)

static inline bool ss_skb_passed(const struct sk_buff *skb)
{
    const SsSkbCb *scb = TFW_SKB_CB(skb);
    return (scb->magic == TFW_MAGIC && (scb->next && scb->prev));
}

Any reasons why is it can't be implemented?

@keshonok keshonok added the question Questions and support tasks label Jul 28, 2015
@krizhanovsky krizhanovsky self-assigned this Jul 29, 2015
@krizhanovsky krizhanovsky added enhancement and removed question Questions and support tasks labels Jul 30, 2015
@krizhanovsky krizhanovsky added this to the TBD milestone Jul 30, 2015
@krizhanovsky
Copy link
Contributor

Ilya,

thank you for the interesting question. We need valid SsSkbCb list members also during skb (re-)transmission, so we can't reuse part of headroom used by MAC or IP layers. However, there is NET_SKB_PAD alignment before mac_header which is typically 64 bytes in size, so it seems we can place SsSkbCb at the room.

This is good thing to keep in mind for next releases.

@krizhanovsky krizhanovsky changed the title About needing of kernel prepatching Using SKB headroom for SsSkbCb Jul 30, 2015
@krizhanovsky krizhanovsky removed their assignment Jul 30, 2015
@krizhanovsky
Copy link
Contributor

In fact, we don't need SsSkbCb since Tempesta doesn't use standard skb next and prev linkage as well as remove ingress skbs from the lists such as sk_receive_queue or frag_list, so we can just use standard skb lists instead.

@keshonok
Copy link
Contributor

keshonok commented Dec 5, 2017

Uh, yes, indeed. However, my understanding is that the key word here is skb clone.

The major reason for introduction of a separate list of skbs was that Tempesta kept request's data on a list until a paired response came, and at the same time these same skbs were handed to Linux kernel's TCP/IP stack for sending. Thus, an skb could have been a member of a socket queue, and at the same time a member of a message queue. So, as soon as we started passing skb clones to the TCP/IP stack instead of the original skbs, SsSkbCb became unnecessary. Standard skb list members can be used to link skbs that belong to a message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants