Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/891/?format=api
{ "id": 891, "url": "http://patchwork.ozlabs.org/api/patches/891/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1222098445-26175-1-git-send-email-remi.denis-courmont@nokia.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1222098445-26175-1-git-send-email-remi.denis-courmont@nokia.com>", "list_archive_url": null, "date": "2008-09-22T15:47:15", "name": "[01/11] Phonet global definitions", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "00ef13f6bedb949e356cd4531209727de30adfce", "submitter": { "id": 204, "url": "http://patchwork.ozlabs.org/api/people/204/?format=api", "name": "Rémi Denis-Courmont", "email": "remi.denis-courmont@nokia.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1222098445-26175-1-git-send-email-remi.denis-courmont@nokia.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/891/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/891/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id F27C4DDF0C\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 01:48:35 +1000 (EST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753068AbYIVPsJ (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 11:48:09 -0400", "(majordomo@vger.kernel.org) by vger.kernel.org id S1752992AbYIVPsI\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 11:48:08 -0400", "from smtp.nokia.com ([192.100.122.233]:53009 \"EHLO\n\tmgw-mx06.nokia.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753239AbYIVPrs (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 11:47:48 -0400", "from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com\n\t[10.160.244.31])\n\tby mgw-mx06.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id\n\tm8MFlZFf027641\n\tfor <netdev@vger.kernel.org>; Mon, 22 Sep 2008 18:47:45 +0300", "from vaebh102.NOE.Nokia.com ([10.160.244.23]) by\n\tvaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); \n\tMon, 22 Sep 2008 18:47:44 +0300", "from localhost.localdomain ([172.21.41.115]) by\n\tvaebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); \n\tMon, 22 Sep 2008 18:47:26 +0300" ], "From": "=?utf-8?q?R=C3=A9mi=20Denis-Courmont?= <remi.denis-courmont@nokia.com>", "To": "netdev@vger.kernel.org", "Subject": "[PATCH 01/11] Phonet global definitions", "Date": "Mon, 22 Sep 2008 18:47:15 +0300", "Message-Id": "<1222098445-26175-1-git-send-email-remi.denis-courmont@nokia.com>", "X-Mailer": "git-send-email 1.5.4.3", "In-Reply-To": "<200809221845.54736.remi.denis-courmont@nokia.com>", "References": "<200809221845.54736.remi.denis-courmont@nokia.com>", "X-OriginalArrivalTime": "22 Sep 2008 15:47:26.0241 (UTC)\n\tFILETIME=[82EE8110:01C91CCA]", "X-Nokia-AV": "Clean", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Signed-off-by: Remi Denis-Courmont <remi.denis-courmont@nokia.com>\n---\n include/linux/if_ether.h | 1 +\n include/linux/if_phonet.h | 14 +++++\n include/linux/phonet.h | 125 +++++++++++++++++++++++++++++++++++++++++++++\n include/linux/rtnetlink.h | 4 ++\n include/linux/socket.h | 4 +-\n net/core/sock.c | 9 ++-\n 6 files changed, 153 insertions(+), 4 deletions(-)\n create mode 100644 include/linux/if_phonet.h\n create mode 100644 include/linux/phonet.h", "diff": "diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h\nindex 5028e0b..723a1c5 100644\n--- a/include/linux/if_ether.h\n+++ b/include/linux/if_ether.h\n@@ -100,6 +100,7 @@\n #define ETH_P_ECONET\t0x0018\t\t/* Acorn Econet\t\t\t*/\n #define ETH_P_HDLC\t0x0019\t\t/* HDLC frames\t\t\t*/\n #define ETH_P_ARCNET\t0x001A\t\t/* 1A for ArcNet :-) */\n+#define ETH_P_PHONET\t0x00F5\t\t/* Nokia Phonet frames */\n \n /*\n *\tThis is an Ethernet frame header.\ndiff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h\nnew file mode 100644\nindex 0000000..22df25f\n--- /dev/null\n+++ b/include/linux/if_phonet.h\n@@ -0,0 +1,14 @@\n+/*\n+ * File: if_phonet.h\n+ *\n+ * Phonet interface kernel definitions\n+ *\n+ * Copyright (C) 2008 Nokia Corporation. All rights reserved.\n+ */\n+\n+#define PHONET_HEADER_LEN\t8\t/* Phonet header length */\n+\n+#define PHONET_MIN_MTU\t\t6\n+/* 6 bytes header + 65535 bytes payload */\n+#define PHONET_MAX_MTU\t\t65541\n+#define PHONET_DEV_MTU\t\tPHONET_MAX_MTU\ndiff --git a/include/linux/phonet.h b/include/linux/phonet.h\nnew file mode 100644\nindex 0000000..6a764f8\n--- /dev/null\n+++ b/include/linux/phonet.h\n@@ -0,0 +1,125 @@\n+/**\n+ * file phonet.h\n+ *\n+ * Phonet sockets kernel interface\n+ *\n+ * Copyright (C) 2008 Nokia Corporation. All rights reserved.\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU General Public License\n+ * version 2 as published by the Free Software Foundation.\n+ *\n+ * This program is distributed in the hope that it will be useful, but\n+ * WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, write to the Free Software\n+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n+ * 02110-1301 USA\n+ */\n+\n+#ifndef LINUX_PHONET_H\n+#define LINUX_PHONET_H\n+\n+/* Automatic protocol selection */\n+#define PN_PROTO_TRANSPORT\t0\n+/* Phonet datagram socket */\n+#define PN_PROTO_PHONET\t\t1\n+#define PHONET_NPROTO\t\t2\n+\n+#define PNADDR_ANY\t\t0\n+#define PNPORT_RESOURCE_ROUTING\t0\n+\n+/* Phonet protocol header */\n+struct phonethdr {\n+\t__u8\tpn_rdev;\n+\t__u8\tpn_sdev;\n+\t__u8\tpn_res;\n+\t__be16\tpn_length;\n+\t__u8\tpn_robj;\n+\t__u8\tpn_sobj;\n+} __attribute__((packed));\n+\n+/* Phonet socket address structure */\n+struct sockaddr_pn {\n+\tsa_family_t spn_family;\n+\t__u8 spn_obj;\n+\t__u8 spn_dev;\n+\t__u8 spn_resource;\n+\t__u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];\n+} __attribute__ ((packed));\n+\n+static inline __u16 pn_object(__u8 addr, __u16 port)\n+{\n+\treturn (addr << 8) | (port & 0x3ff);\n+}\n+\n+static inline __u8 pn_obj(__u16 handle)\n+{\n+\treturn handle & 0xff;\n+}\n+\n+static inline __u8 pn_dev(__u16 handle)\n+{\n+\treturn handle >> 8;\n+}\n+\n+static inline __u16 pn_port(__u16 handle)\n+{\n+\treturn handle & 0x3ff;\n+}\n+\n+static inline __u8 pn_addr(__u16 handle)\n+{\n+\treturn (handle >> 8) & 0xfc;\n+}\n+\n+static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr)\n+{\n+\tspn->spn_dev &= 0x03;\n+\tspn->spn_dev |= addr & 0xfc;\n+}\n+\n+static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port)\n+{\n+\tspn->spn_dev &= 0xfc;\n+\tspn->spn_dev |= (port >> 8) & 0x03;\n+\tspn->spn_obj = port & 0xff;\n+}\n+\n+static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn,\n+\t\t\t\t\t\t__u16 handle)\n+{\n+\tspn->spn_dev = pn_dev(handle);\n+\tspn->spn_obj = pn_obj(handle);\n+}\n+\n+static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn,\n+\t\t\t\t\t\t__u8 resource)\n+{\n+\tspn->spn_resource = resource;\n+}\n+\n+static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn)\n+{\n+\treturn spn->spn_dev & 0xfc;\n+}\n+\n+static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn)\n+{\n+\treturn ((spn->spn_dev & 0x03) << 8) | spn->spn_obj;\n+}\n+\n+static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn)\n+{\n+\treturn pn_object(spn->spn_dev, spn->spn_obj);\n+}\n+\n+static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)\n+{\n+\treturn spn->spn_resource;\n+}\n+\n+#endif\ndiff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h\nindex ca643b1..2b3d51c 100644\n--- a/include/linux/rtnetlink.h\n+++ b/include/linux/rtnetlink.h\n@@ -582,6 +582,10 @@ enum rtnetlink_groups {\n #define RTNLGRP_IPV6_RULE\tRTNLGRP_IPV6_RULE\n \tRTNLGRP_ND_USEROPT,\n #define RTNLGRP_ND_USEROPT\tRTNLGRP_ND_USEROPT\n+\tRTNLGRP_PHONET_IFADDR,\n+#define RTNLGRP_PHONET_IFADDR\tRTNLGRP_PHONET_IFADDR\n+\tRTNLGRP_PHONET_ROUTE,\n+#define RTNLGRP_PHONET_ROUTE\tRTNLGRP_PHONET_ROUTE\n \t__RTNLGRP_MAX\n };\n #define RTNLGRP_MAX\t(__RTNLGRP_MAX - 1)\ndiff --git a/include/linux/socket.h b/include/linux/socket.h\nindex dc5086f..818ca33 100644\n--- a/include/linux/socket.h\n+++ b/include/linux/socket.h\n@@ -190,7 +190,8 @@ struct ucred {\n #define AF_IUCV\t\t32\t/* IUCV sockets\t\t\t*/\n #define AF_RXRPC\t33\t/* RxRPC sockets \t\t*/\n #define AF_ISDN\t\t34\t/* mISDN sockets \t\t*/\n-#define AF_MAX\t\t35\t/* For now.. */\n+#define AF_PHONET\t35\t/* Phonet sockets\t\t*/\n+#define AF_MAX\t\t36\t/* For now.. */\n \n /* Protocol families, same as address families. */\n #define PF_UNSPEC\tAF_UNSPEC\n@@ -227,6 +228,7 @@ struct ucred {\n #define PF_IUCV\t\tAF_IUCV\n #define PF_RXRPC\tAF_RXRPC\n #define PF_ISDN\t\tAF_ISDN\n+#define PF_PHONET\tAF_PHONET\n #define PF_MAX\t\tAF_MAX\n \n /* Maximum queue length specifiable by listen. */\ndiff --git a/net/core/sock.c b/net/core/sock.c\nindex 23b8b9d..2d358dd 100644\n--- a/net/core/sock.c\n+++ b/net/core/sock.c\n@@ -154,7 +154,8 @@ static const char *af_family_key_strings[AF_MAX+1] = {\n \"sk_lock-AF_PPPOX\" , \"sk_lock-AF_WANPIPE\" , \"sk_lock-AF_LLC\" ,\n \"sk_lock-27\" , \"sk_lock-28\" , \"sk_lock-AF_CAN\" ,\n \"sk_lock-AF_TIPC\" , \"sk_lock-AF_BLUETOOTH\", \"sk_lock-IUCV\" ,\n- \"sk_lock-AF_RXRPC\" , \"sk_lock-AF_ISDN\" , \"sk_lock-AF_MAX\"\n+ \"sk_lock-AF_RXRPC\" , \"sk_lock-AF_ISDN\" , \"sk_lock-AF_PHONET\" ,\n+ \"sk_lock-AF_MAX\"\n };\n static const char *af_family_slock_key_strings[AF_MAX+1] = {\n \"slock-AF_UNSPEC\", \"slock-AF_UNIX\" , \"slock-AF_INET\" ,\n@@ -168,7 +169,8 @@ static const char *af_family_slock_key_strings[AF_MAX+1] = {\n \"slock-AF_PPPOX\" , \"slock-AF_WANPIPE\" , \"slock-AF_LLC\" ,\n \"slock-27\" , \"slock-28\" , \"slock-AF_CAN\" ,\n \"slock-AF_TIPC\" , \"slock-AF_BLUETOOTH\", \"slock-AF_IUCV\" ,\n- \"slock-AF_RXRPC\" , \"slock-AF_ISDN\" , \"slock-AF_MAX\"\n+ \"slock-AF_RXRPC\" , \"slock-AF_ISDN\" , \"slock-AF_PHONET\" ,\n+ \"slock-AF_MAX\"\n };\n static const char *af_family_clock_key_strings[AF_MAX+1] = {\n \"clock-AF_UNSPEC\", \"clock-AF_UNIX\" , \"clock-AF_INET\" ,\n@@ -182,7 +184,8 @@ static const char *af_family_clock_key_strings[AF_MAX+1] = {\n \"clock-AF_PPPOX\" , \"clock-AF_WANPIPE\" , \"clock-AF_LLC\" ,\n \"clock-27\" , \"clock-28\" , \"clock-AF_CAN\" ,\n \"clock-AF_TIPC\" , \"clock-AF_BLUETOOTH\", \"clock-AF_IUCV\" ,\n- \"clock-AF_RXRPC\" , \"clock-AF_ISDN\" , \"clock-AF_MAX\"\n+ \"clock-AF_RXRPC\" , \"clock-AF_ISDN\" , \"clock-AF_PHONET\" ,\n+ \"clock-AF_MAX\"\n };\n #endif\n \n", "prefixes": [ "01/11" ] }