0
votes

I am writing a linux phy driver that handles packet timestamping. The bottom half does the process of calculating timestamps and sending this info to the kernel networking stack and then to user space. The bottom half needs some information from the skb(packet) which the caller of the tasklet has. I am having difficulty passing this skb to the takslet. tasklet handler function doesnot take any input other than unsigned long. I am stuck here. Below is a code snippet for you understanding -

    static void tx_ts_task(unsigned long val)
    {
      struct phyts *phyts = container_of(&val, struct phyts, int_flags);
      //skb_copy(skb);  ///want to access skb in this tasklet but I am unable to do this.
      .
      .
     }

    int tx_timestamp(struct phyts *phyts, struct sk_buff *skb, int len)
    {
      .
      .
       tasklet_schedule(&tx_ts_tasklet);

     }

Appreciate your inputs. Thanks

1
Unsigned long is full equivalent to void * in Linux. - 0andriy

1 Answers

0
votes

Tasklet function receives the same data parameter that is specified in DECLARE_TASKLET/tasklet_init. Usually this a pointer to some (large) driver struct.

So basically, you can't pass runtime data between ISR and tasklet directly and should use some sort of shared variable (may be the above-mentioned struct) with proper locking.