get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/567108/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 567108,
    "url": "http://patchwork.ozlabs.org/api/patches/567108/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1452687149-11281-9-git-send-email-christopher.s.hall@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1452687149-11281-9-git-send-email-christopher.s.hall@intel.com>",
    "list_archive_url": null,
    "date": "2016-01-13T12:12:28",
    "name": "[v6,8/9] Add PTP_SYS_OFFSET_PRECISE for driver crosstimestamping",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "bbe718cd95dec893f662aa1b834b34a1e277310f",
    "submitter": {
        "id": 66720,
        "url": "http://patchwork.ozlabs.org/api/people/66720/?format=api",
        "name": "Hall, Christopher S",
        "email": "christopher.s.hall@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/1452687149-11281-9-git-send-email-christopher.s.hall@intel.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/567108/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/567108/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@lists.osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ozlabs.org (Postfix) with ESMTP id 79C041402C4\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Jan 2016 06:18:45 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id C7D8D944E0;\n\tWed, 13 Jan 2016 19:18:44 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id avKgzS6UrlFE; Wed, 13 Jan 2016 19:18:43 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 6642D949BF;\n\tWed, 13 Jan 2016 19:18:43 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id EDC921C0F8E\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:41 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 040BE8C949\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:41 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id hbkjZejwdw3h for <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:40 +0000 (UTC)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 3D40E8C841\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tWed, 13 Jan 2016 19:18:40 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga102.fm.intel.com with ESMTP; 13 Jan 2016 11:18:41 -0800",
            "from foofoo.jf.intel.com (HELO localhost.localdomain)\n\t([134.134.172.151])\n\tby FMSMGA003.fm.intel.com with ESMTP; 13 Jan 2016 11:18:40 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.22,290,1449561600\"; d=\"scan'208\";a=\"632939119\"",
        "From": "\"Christopher S. Hall\" <christopher.s.hall@intel.com>",
        "To": "tglx@linutronix.de, richardcochran@gmail.com, mingo@redhat.com,\n\tjohn.stultz@linaro.org, hpa@zytor.com, jeffrey.t.kirsher@intel.com",
        "Date": "Wed, 13 Jan 2016 04:12:28 -0800",
        "Message-Id": "<1452687149-11281-9-git-send-email-christopher.s.hall@intel.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1452687149-11281-1-git-send-email-christopher.s.hall@intel.com>",
        "References": "<1452687149-11281-1-git-send-email-christopher.s.hall@intel.com>",
        "Cc": "\"Christopher S. Hall\" <christopher.s.hall@intel.com>,\n\tkevin.b.stanton@intel.com, netdev@vger.kernel.org, x86@kernel.org,\n\tlinux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org",
        "Subject": "[Intel-wired-lan] [PATCH v6 8/9] Add PTP_SYS_OFFSET_PRECISE for\n\tdriver crosstimestamping",
        "X-BeenThere": "intel-wired-lan@lists.osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>",
        "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>",
        "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>"
    },
    "content": "Currently, network /system cross-timestamping is performed in the\nPTP_SYS_OFFSET ioctl. The PTP clock driver reads gettimeofday() and\nthe gettime64() callback provided by the driver. The cross-timestamp\nis best effort where the latency between the capture of system time\n(getnstimeofday()) and the device time (driver callback) may be\nsignificant.\n\nThe getcrosststamp() callback and corresponding PTP_SYS_OFFSET_PRECISE\nioctl allows the driver to perform this device/system correlation when\nfor example cross timestamp hardware is available. Modern Intel\nsystems can do this for onboard Ethernet controllers using the ART\ncounter. There is virtually zero latency between captures of the ART\nand network device clock.\n\nThe capabilities ioctl (PTP_CLOCK_GETCAPS), is augmented allowing\napplications to query whether or not drivers implement the\ngetcrosststamp callback, providing more precise cross timestamping.\n\nSigned-off-by: Christopher S. Hall <christopher.s.hall@intel.com>\n---\n Documentation/ptp/testptp.c      |  6 ++++--\n drivers/ptp/ptp_chardev.c        | 27 +++++++++++++++++++++++++++\n include/linux/ptp_clock_kernel.h |  8 ++++++++\n include/uapi/linux/ptp_clock.h   | 13 ++++++++++++-\n 4 files changed, 51 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c\nindex 6c6247a..d99012f 100644\n--- a/Documentation/ptp/testptp.c\n+++ b/Documentation/ptp/testptp.c\n@@ -277,13 +277,15 @@ int main(int argc, char *argv[])\n \t\t\t       \"  %d external time stamp channels\\n\"\n \t\t\t       \"  %d programmable periodic signals\\n\"\n \t\t\t       \"  %d pulse per second\\n\"\n-\t\t\t       \"  %d programmable pins\\n\",\n+\t\t\t       \"  %d programmable pins\\n\"\n+\t\t\t       \"  %d cross timestamping\\n\",\n \t\t\t       caps.max_adj,\n \t\t\t       caps.n_alarm,\n \t\t\t       caps.n_ext_ts,\n \t\t\t       caps.n_per_out,\n \t\t\t       caps.pps,\n-\t\t\t       caps.n_pins);\n+\t\t\t       caps.n_pins,\n+\t\t\t       caps.cross_timestamping);\n \t\t}\n \t}\n \ndiff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c\nindex da7bae9..579fd65 100644\n--- a/drivers/ptp/ptp_chardev.c\n+++ b/drivers/ptp/ptp_chardev.c\n@@ -22,6 +22,7 @@\n #include <linux/poll.h>\n #include <linux/sched.h>\n #include <linux/slab.h>\n+#include <linux/timekeeping.h>\n \n #include \"ptp_private.h\"\n \n@@ -120,11 +121,13 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)\n \tstruct ptp_clock_caps caps;\n \tstruct ptp_clock_request req;\n \tstruct ptp_sys_offset *sysoff = NULL;\n+\tstruct ptp_sys_offset_precise precise_offset;\n \tstruct ptp_pin_desc pd;\n \tstruct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);\n \tstruct ptp_clock_info *ops = ptp->info;\n \tstruct ptp_clock_time *pct;\n \tstruct timespec64 ts;\n+\tstruct system_device_crosststamp xtstamp;\n \tint enable, err = 0;\n \tunsigned int i, pin_index;\n \n@@ -138,6 +141,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)\n \t\tcaps.n_per_out = ptp->info->n_per_out;\n \t\tcaps.pps = ptp->info->pps;\n \t\tcaps.n_pins = ptp->info->n_pins;\n+\t\tcaps.cross_timestamping = ptp->info->getcrosststamp != NULL;\n \t\tif (copy_to_user((void __user *)arg, &caps, sizeof(caps)))\n \t\t\terr = -EFAULT;\n \t\tbreak;\n@@ -180,6 +184,29 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)\n \t\terr = ops->enable(ops, &req, enable);\n \t\tbreak;\n \n+\tcase PTP_SYS_OFFSET_PRECISE:\n+\t\tif (!ptp->info->getcrosststamp) {\n+\t\t\terr = -EOPNOTSUPP;\n+\t\t\tbreak;\n+\t\t}\n+\t\terr = ptp->info->getcrosststamp(ptp->info, &xtstamp);\n+\t\tif (err)\n+\t\t\tbreak;\n+\n+\t\tts = ktime_to_timespec64(xtstamp.device);\n+\t\tprecise_offset.device.sec = ts.tv_sec;\n+\t\tprecise_offset.device.nsec = ts.tv_nsec;\n+\t\tts = ktime_to_timespec64(xtstamp.sys_realtime);\n+\t\tprecise_offset.sys_realtime.sec = ts.tv_sec;\n+\t\tprecise_offset.sys_realtime.nsec = ts.tv_nsec;\n+\t\tts = ktime_to_timespec64(xtstamp.sys_monoraw);\n+\t\tprecise_offset.sys_monoraw.sec = ts.tv_sec;\n+\t\tprecise_offset.sys_monoraw.nsec = ts.tv_nsec;\n+\t\tif (copy_to_user((void __user *)arg, &precise_offset,\n+\t\t\t\t sizeof(precise_offset)))\n+\t\t\terr = -EFAULT;\n+\t\tbreak;\n+\n \tcase PTP_SYS_OFFSET:\n \t\tsysoff = kmalloc(sizeof(*sysoff), GFP_KERNEL);\n \t\tif (!sysoff) {\ndiff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h\nindex b8b7306..6b15e16 100644\n--- a/include/linux/ptp_clock_kernel.h\n+++ b/include/linux/ptp_clock_kernel.h\n@@ -38,6 +38,7 @@ struct ptp_clock_request {\n \t};\n };\n \n+struct system_device_crosststamp;\n /**\n  * struct ptp_clock_info - decribes a PTP hardware clock\n  *\n@@ -67,6 +68,11 @@ struct ptp_clock_request {\n  * @gettime64:  Reads the current time from the hardware clock.\n  *              parameter ts: Holds the result.\n  *\n+ * @getcrosststamp:  Reads the current time from the hardware clock and\n+ *                   system clock simultaneously.\n+ *                   parameter cts: Contains timestamp (device,system) pair,\n+ *                   where system time is realtime and monotonic.\n+ *\n  * @settime64:  Set the current time on the hardware clock.\n  *              parameter ts: Time value to set.\n  *\n@@ -105,6 +111,8 @@ struct ptp_clock_info {\n \tint (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);\n \tint (*adjtime)(struct ptp_clock_info *ptp, s64 delta);\n \tint (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts);\n+\tint (*getcrosststamp)(struct ptp_clock_info *ptp,\n+\t\t\t      struct system_device_crosststamp *cts);\n \tint (*settime64)(struct ptp_clock_info *p, const struct timespec64 *ts);\n \tint (*enable)(struct ptp_clock_info *ptp,\n \t\t      struct ptp_clock_request *request, int on);\ndiff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h\nindex f0b7bfe..ac6dded 100644\n--- a/include/uapi/linux/ptp_clock.h\n+++ b/include/uapi/linux/ptp_clock.h\n@@ -51,7 +51,9 @@ struct ptp_clock_caps {\n \tint n_per_out; /* Number of programmable periodic signals. */\n \tint pps;       /* Whether the clock supports a PPS callback. */\n \tint n_pins;    /* Number of input/output pins. */\n-\tint rsv[14];   /* Reserved for future use. */\n+\t/* Whether the clock supports precise system-device cross timestamps */\n+\tint cross_timestamping;\n+\tint rsv[13];   /* Reserved for future use. */\n };\n \n struct ptp_extts_request {\n@@ -81,6 +83,13 @@ struct ptp_sys_offset {\n \tstruct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];\n };\n \n+struct ptp_sys_offset_precise {\n+\tstruct ptp_clock_time device;\n+\tstruct ptp_clock_time sys_realtime;\n+\tstruct ptp_clock_time sys_monoraw;\n+\tunsigned int rsv[4];    /* Reserved for future use. */\n+};\n+\n enum ptp_pin_function {\n \tPTP_PF_NONE,\n \tPTP_PF_EXTTS,\n@@ -124,6 +133,8 @@ struct ptp_pin_desc {\n #define PTP_SYS_OFFSET     _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset)\n #define PTP_PIN_GETFUNC    _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc)\n #define PTP_PIN_SETFUNC    _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc)\n+#define PTP_SYS_OFFSET_PRECISE \\\n+\t_IOWR(PTP_CLK_MAGIC, 8, struct ptp_sys_offset_precise)\n \n struct ptp_extts_event {\n \tstruct ptp_clock_time t; /* Time event occured. */\n",
    "prefixes": [
        "v6",
        "8/9"
    ]
}