[Click] Re: driver hacking and packet annotations
Eddie Kohler
kohler at icir.org
Mon Jun 30 17:31:28 EDT 2003
Hi John,
> Hi Everyone,
> I've been doing a lot of hacking on some of the wireless drivers so
> that we can do some cool things in click that used to require cumbersome
> hacks.
>
> For instance, when the prism2 driver receives a packet, it can mark
> a packet annotation with the signal and noise that the packet was
> recieved with, and then you process that information in click since
> the annotations are stored in sk_buff->cb.
>
> Here is the packet_anno.h file that I put in the linux-2.4.20/include/linux
> dir and I have been using. It's basically stuff taken out of
> click/include/click/packet.hh.
>
> I don't know that this is something that you want to include in the patches,
> but I wondered if you had any thoughts or feedback.
>
> --john
I like this approach, but would suggest something different, more like the
rest of Linux. Why not define a structure, and cast the 'cb' to have that
structure type? Like in <linux/atmdev.h>:
struct atm_skb_data {
struct atm_vcc *vcc; /* ATM VCC */
int iovcnt; /* 0 for "normal" operation */
unsigned long atm_options; /* ATM layer options */
};
#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))
Or tcp_skb_cb in <net/tcp.h>, etc. For instance you could do:
struct wifi_skb_cb {
unsigned char padding[10];
unsigned char wifi_tx_success;
unsigned char wifi_tx_power;
unsigned char wifi_rate;
unsigned char wifi_retries;
unsigned char wifi_signal;
unsigned char wifi_noise;
};
#define WIFI_SKB_CB(__skb) ((struct wifi_skb_cb *)((__skb)->cb))
Anyway, if you decide to do it using packet_anno.h instead, you probably
want to declare the functions as "static inline".
Eddie
More information about the click
mailing list