Message ID | 47d1af192e2a51722c2d93b78d9c25de1116e82a.1308481492.git.richard.cochran@omicron.at |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
Le dimanche 19 juin 2011 à 13:19 +0200, Richard Cochran a écrit : > This patch enables software (and phy device) time stamping. Since this > MAC uses phylib, adding the hooks make hardware time stamping in the phy > possible. > > Compile tested only. > > Cc: John Linn <john.linn@xilinx.com> > Signed-off-by: Richard Cochran <richard.cochran@omicron.at> > --- > drivers/net/xilinx_emaclite.c | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c > index 372572c..ae029d0 100644 > --- a/drivers/net/xilinx_emaclite.c > +++ b/drivers/net/xilinx_emaclite.c > @@ -647,7 +647,8 @@ static void xemaclite_rx_handler(struct net_device *dev) > dev->stats.rx_packets++; > dev->stats.rx_bytes += len; > > - netif_rx(skb); /* Send the packet upstream */ > + if (!skb_defer_rx_timestamp(skb)) > + netif_rx(skb); /* Send the packet upstream */ > } > > /** > @@ -1029,15 +1030,19 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) > spin_lock_irqsave(&lp->reset_lock, flags); > if (xemaclite_send_data(lp, (u8 *) new_skb->data, len) != 0) { > /* If the Emaclite Tx buffer is busy, stop the Tx queue and > - * defer the skb for transmission at a later point when the > + * defer the skb for transmission during the ISR, after the > * current transmission is complete */ > netif_stop_queue(dev); > lp->deferred_skb = new_skb; > spin_unlock_irqrestore(&lp->reset_lock, flags); Since you unlock reset_lock right here, there is no guarantee something wont eat 'deferred_skb', so you might manipulate a freed skb after this point. > + /* Take the time stamp now, since we can't do this in an ISR. */ > + skb_tx_timestamp(new_skb); > return 0; > } > spin_unlock_irqrestore(&lp->reset_lock, flags); > > + skb_tx_timestamp(new_skb); > + this one is ok. > dev->stats.tx_bytes += len; > dev_kfree_skb(new_skb); > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c index 372572c..ae029d0 100644 --- a/drivers/net/xilinx_emaclite.c +++ b/drivers/net/xilinx_emaclite.c @@ -647,7 +647,8 @@ static void xemaclite_rx_handler(struct net_device *dev) dev->stats.rx_packets++; dev->stats.rx_bytes += len; - netif_rx(skb); /* Send the packet upstream */ + if (!skb_defer_rx_timestamp(skb)) + netif_rx(skb); /* Send the packet upstream */ } /** @@ -1029,15 +1030,19 @@ static int xemaclite_send(struct sk_buff *orig_skb, struct net_device *dev) spin_lock_irqsave(&lp->reset_lock, flags); if (xemaclite_send_data(lp, (u8 *) new_skb->data, len) != 0) { /* If the Emaclite Tx buffer is busy, stop the Tx queue and - * defer the skb for transmission at a later point when the + * defer the skb for transmission during the ISR, after the * current transmission is complete */ netif_stop_queue(dev); lp->deferred_skb = new_skb; spin_unlock_irqrestore(&lp->reset_lock, flags); + /* Take the time stamp now, since we can't do this in an ISR. */ + skb_tx_timestamp(new_skb); return 0; } spin_unlock_irqrestore(&lp->reset_lock, flags); + skb_tx_timestamp(new_skb); + dev->stats.tx_bytes += len; dev_kfree_skb(new_skb);
This patch enables software (and phy device) time stamping. Since this MAC uses phylib, adding the hooks make hardware time stamping in the phy possible. Compile tested only. Cc: John Linn <john.linn@xilinx.com> Signed-off-by: Richard Cochran <richard.cochran@omicron.at> --- drivers/net/xilinx_emaclite.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)