Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/8661/?format=api
https://patches.dpdk.org/api/patches/8661/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1446631581-4040-3-git-send-email-danielx.t.mrzyglod@intel.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1446631581-4040-3-git-send-email-danielx.t.mrzyglod@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1446631581-4040-3-git-send-email-danielx.t.mrzyglod@intel.com", "date": "2015-11-04T10:06:16", "name": "[dpdk-dev,v4,2/7] net: Add common PTP structures and functions", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "31dedb75d7e435c7ec9a2e8b5fae9eaf4fab9b08", "submitter": { "id": 23, "url": "https://patches.dpdk.org/api/people/23/?format=api", "name": "Daniel Mrzyglod", "email": "danielx.t.mrzyglod@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1446631581-4040-3-git-send-email-danielx.t.mrzyglod@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/8661/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/8661/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 907108E9E;\n\tWed, 4 Nov 2015 11:06:38 +0100 (CET)", "from mga09.intel.com (mga09.intel.com [134.134.136.24])\n\tby dpdk.org (Postfix) with ESMTP id 4048D91A0\n\tfor <dev@dpdk.org>; Wed, 4 Nov 2015 11:06:36 +0100 (CET)", "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga102.jf.intel.com with ESMTP; 04 Nov 2015 02:06:36 -0800", "from unknown ([10.217.248.15])\n\tby orsmga001.jf.intel.com with SMTP; 04 Nov 2015 02:06:34 -0800", "by (sSMTP sendmail emulation); Wed, 04 Nov 2015 11:06:33 +0100" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.20,242,1444719600\"; d=\"scan'208\";a=\"811444791\"", "From": "Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>", "To": "dev@dpdk.org", "Date": "Wed, 4 Nov 2015 11:06:16 +0100", "Message-Id": "<1446631581-4040-3-git-send-email-danielx.t.mrzyglod@intel.com>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1446631581-4040-1-git-send-email-danielx.t.mrzyglod@intel.com>", "References": "<1443799208-9408-1-git-send-email-danielx.t.mrzyglod@intel.com>\n\t<1446631581-4040-1-git-send-email-danielx.t.mrzyglod@intel.com>", "Subject": "[dpdk-dev] [PATCH v4 2/7] net: Add common PTP structures and\n\tfunctions", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch add common functions and structures used for PTP processing.\n\nSigned-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>\n---\n lib/librte_net/Makefile | 2 +-\n lib/librte_net/rte_ptp.h | 105 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 106 insertions(+), 1 deletion(-)\n create mode 100644 lib/librte_net/rte_ptp.h", "diff": "diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile\nindex ad2e482..1d33618 100644\n--- a/lib/librte_net/Makefile\n+++ b/lib/librte_net/Makefile\n@@ -34,7 +34,7 @@ include $(RTE_SDK)/mk/rte.vars.mk\n CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3\n \n # install includes\n-SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_sctp.h rte_icmp.h rte_arp.h\n+SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_sctp.h rte_icmp.h rte_arp.h rte_ptp.h\n \n \n include $(RTE_SDK)/mk/rte.install.mk\ndiff --git a/lib/librte_net/rte_ptp.h b/lib/librte_net/rte_ptp.h\nnew file mode 100644\nindex 0000000..8a4c83c\n--- /dev/null\n+++ b/lib/librte_net/rte_ptp.h\n@@ -0,0 +1,105 @@\n+/*-\n+ * BSD LICENSE\n+ *\n+ * Copyright(c) 2015 Intel Corporation. All rights reserved.\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions\n+ * are met:\n+ *\n+ * * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ * * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in\n+ * the documentation and/or other materials provided with the\n+ * distribution.\n+ * * Neither the name of Intel Corporation nor the names of its\n+ * contributors may be used to endorse or promote products derived\n+ * from this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#define NSEC_PER_SEC 1000000000L\n+\n+/*\n+ * Structure for cyclecounter IEEE1588 functionality.\n+ */\n+struct cyclecounter {\n+\tuint64_t (*read)(struct rte_eth_dev *dev);\n+\tuint64_t mask;\n+\tuint32_t shift;\n+};\n+\n+/*\n+ * Structure to hold and calculate Unix epoch time.\n+ */\n+struct timecounter {\n+\tstruct cyclecounter *cc;\n+\tuint64_t cycle_last;\n+\tuint64_t nsec;\n+\tuint64_t mask;\n+\tuint64_t frac;\n+};\n+\n+\n+/* Utility functions for PTP/IEEE1588 support. */\n+\n+static inline uint64_t\n+timespec_to_ns(const struct timespec *ts)\n+{\n+\treturn ((uint64_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec;\n+}\n+\n+static inline struct timespec\n+ns_to_timespec(uint64_t nsec)\n+{\n+\tstruct timespec ts = {0, 0};\n+\n+\tif (nsec == 0)\n+\t\treturn ts;\n+\n+\tts.tv_sec = nsec / NSEC_PER_SEC;\n+\tts.tv_nsec = nsec % NSEC_PER_SEC;\n+\n+\treturn ts;\n+}\n+\n+/*\n+ * Converts cycle counter cycles to nanoseconds.\n+ */\n+static inline uint64_t\n+cyclecounter_cycles_to_ns(const struct cyclecounter *cc,\n+\t\t uint64_t cycles, uint64_t mask, uint64_t *frac)\n+{\n+\tuint64_t ns;\n+\n+\t/* Add fractional nanoseconds */\n+\tns = cycles + *frac;\n+\t*frac = ns & mask;\n+\n+\t/* Shift to get only nanoseconds. */\n+\treturn ns >> cc->shift;\n+}\n+\n+/*\n+ * Like cyclecounter_cycles_to_ns(), but this is used when\n+ * computing a time previous to the stored in the cycle counter.\n+ */\n+static inline uint64_t\n+cyclecounter_cycles_to_ns_backwards(const struct cyclecounter *cc,\n+\t\t\t uint64_t cycles, uint64_t frac)\n+{\n+\treturn ((cycles - frac) >> cc->shift);\n+}\n", "prefixes": [ "dpdk-dev", "v4", "2/7" ] }{ "id": 8661, "url": "