From patchwork Sat Jul 17 18:48:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 59149 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A002CB6EF0 for ; Sun, 18 Jul 2010 04:48:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756600Ab0GQSs3 (ORCPT ); Sat, 17 Jul 2010 14:48:29 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:65139 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756493Ab0GQSs2 (ORCPT ); Sat, 17 Jul 2010 14:48:28 -0400 Received: by mail-bw0-f46.google.com with SMTP id 1so1698395bwz.19 for ; Sat, 17 Jul 2010 11:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=OmpuyCOUMz+s4O84/USNkZsEy+8AxxHqVZERqp+Wbw4=; b=BlODSkQtlD4ZRh+p7s06IslUcJ309MEzczobYQZPahD+P4z9NtXEXYPtJUAsIHr57H 6ayA311lelG7x3Y7Yg4rwyIQyS3yZzAmhQOYzKCpiyxvGDlDI4BcMNEgHr/svR/BTR3i MpRfJHVyZwYBc2WmfuRfExT3i/wJ5BZ/IlKZo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=whgQk9plIov4PRLXPpI18EnXC6vPvHHmi8SaPKH4QMdDNfEtPqLwHWC78XgFshraoD xZNBc3UcVBf/QH3Kp8B03kcZzTNMABvCKwXTFbs8M45zCOftAtnK4PzeU7y33IShok/7 5/mF67iTr4lv+knT+e/e610zQ7jh4VdD5BwT8= Received: by 10.204.25.207 with SMTP id a15mr1947118bkc.83.1279392507912; Sat, 17 Jul 2010 11:48:27 -0700 (PDT) Received: from riccoc20.at.omicron.at (vs162244.vserver.de [62.75.162.244]) by mx.google.com with ESMTPS id 24sm17011819bkr.19.2010.07.17.11.48.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 17 Jul 2010 11:48:27 -0700 (PDT) Date: Sat, 17 Jul 2010 20:48:28 +0200 From: Richard Cochran To: netdev@vger.kernel.org Subject: [PATCH 1/4] net: add driver hook for tx time stamping. Message-ID: <4398135dc3c471239cc8f349c2c3a85cd87ac017.1279391885.git.richard.cochran@omicron.at> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds a hook for transmit time stamps. The transmit hook allows a software fallback for transmit time stamps, for MACs lacking time stamping hardware. Using the hook will still require adding an inline function call to each MAC driver. Signed-off-by: Richard Cochran --- include/linux/skbuff.h | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ac74ee0..a1b0400 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1947,6 +1947,27 @@ static inline ktime_t net_invalid_timestamp(void) extern void skb_tstamp_tx(struct sk_buff *orig_skb, struct skb_shared_hwtstamps *hwtstamps); +static inline void sw_tx_timestamp(struct sk_buff *skb) +{ + union skb_shared_tx *shtx = skb_tx(skb); + if (shtx->software && !shtx->in_progress) + skb_tstamp_tx(skb, NULL); +} + +/** + * skb_tx_timestamp() - Driver hook for transmit timestamping + * + * Ethernet MAC Drivers should call this function in their hard_xmit() + * function as soon as possible after giving the sk_buff to the MAC + * hardware, but before freeing the sk_buff. + * + * @skb: A socket buffer. + */ +static inline void skb_tx_timestamp(struct sk_buff *skb) +{ + sw_tx_timestamp(skb); +} + extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); extern __sum16 __skb_checksum_complete(struct sk_buff *skb);