{"id":889,"url":"http://patchwork.ozlabs.org/api/1.0/patches/889/?format=json","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.0/projects/7/?format=json","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},"msgid":"<1222098445-26175-11-git-send-email-remi.denis-courmont@nokia.com>","date":"2008-09-22T15:47:25","name":"[11/11] Phonet: kernel documentation","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"a1c05d5f0cb11034ef92df2507322701230da892","submitter":{"id":204,"url":"http://patchwork.ozlabs.org/api/1.0/people/204/?format=json","name":"Rémi Denis-Courmont","email":"remi.denis-courmont@nokia.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.0/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1222098445-26175-11-git-send-email-remi.denis-courmont@nokia.com/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/889/checks/","tags":{},"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 60D09DDF25\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 01:48:34 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753868AbYIVPr6 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 11:47:58 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1753859AbYIVPr5\n\t(ORCPT <rfc822; netdev-outgoing>); Mon, 22 Sep 2008 11:47:57 -0400","from smtp.nokia.com ([192.100.122.233]:53013 \"EHLO\n\tmgw-mx06.nokia.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1753619AbYIVPru (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Mon, 22 Sep 2008 11:47:50 -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\tm8MFlZFj027641\n\tfor <netdev@vger.kernel.org>; Mon, 22 Sep 2008 18:47:47 +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:45 +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 11/11] Phonet: kernel documentation","Date":"Mon, 22 Sep 2008 18:47:25 +0300","Message-Id":"<1222098445-26175-11-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>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"8bit","X-OriginalArrivalTime":"22 Sep 2008 15:47:26.0835 (UTC)\n\tFILETIME=[83492430: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: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>\n---\n Documentation/networking/phonet.txt |  111 +++++++++++++++++++++++++++++++++++\n 1 files changed, 111 insertions(+), 0 deletions(-)\n create mode 100644 Documentation/networking/phonet.txt","diff":"diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt\nnew file mode 100644\nindex 0000000..f3c72e0\n--- /dev/null\n+++ b/Documentation/networking/phonet.txt\n@@ -0,0 +1,111 @@\n+Linux Phonet protocol family\n+============================\n+\n+Introduction\n+------------\n+\n+Phonet is a packet protocol used by Nokia cellular modems for both IPC\n+and RPC. With the Linux Phonet socket family, Linux host processes can\n+receive and send messages from/to the modem, or any other external\n+device attached to the modem. The modem takes care of routing.\n+\n+Phonet packets can be exchanged through various hardware connections\n+depending on the device, such as:\n+  - USB with the CDC Phonet interface,\n+  - infrared,\n+  - Bluetooth,\n+  - an RS232 serial port (with a dedicated \"FBUS\" line discipline),\n+  - the SSI bus with some TI OMAP processors.\n+\n+\n+Packets format\n+--------------\n+\n+Phonet packet have a common header as follow:\n+\n+  struct phonethdr {\n+    uint8_t  pn_media;  /* Media type (link-layer identifier) */\n+    uint8_t  pn_rdev;   /* Receiver device ID */\n+    uint8_t  pn_sdev;   /* Sender device ID */\n+    uint8_t  pn_res;    /* Resource ID or function */\n+    uint16_t pn_length; /* Big-endian message byte length (minus 6) */\n+    uint8_t  pn_robj;   /* Receiver object ID */\n+    uint8_t  pn_sobj;   /* Sender object ID */\n+  };\n+\n+The device ID is split: the 6 higher order bits consitutes the device\n+address, while the 2 lower order bits are used for multiplexing, as are\n+the 8-bits object identifiers. As such, Phonet can be considered as a\n+network layer with 6 bits of address space and 10 bits for transport\n+protocol (much like port numbers in IP world).\n+\n+The modem always has address number zero. Each other device has a its\n+own 6-bits address.\n+\n+\n+Link layer\n+----------\n+\n+Phonet links are always point-to-point links. The link layer header\n+consists of a single Phonet media type byte. It uniquely identifies the\n+link through which the packet is transmitted, from the modem's\n+perspective.\n+\n+Linux Phonet network interfaces use a dedicated link layer type\n+(ETH_P_PHONET) which is out of the Ethernet type range. They can only\n+send and receive Phonet packets.\n+\n+Note that Phonet interfaces are not allowed to re-order packets, so\n+only the (default) Linux FIFO qdisc should be used with them.\n+\n+\n+Network layer\n+-------------\n+\n+The Phonet socket address family maps the Phonet packet header:\n+\n+  struct sockaddr_pn {\n+    sa_family_t spn_family;    /* AF_PHONET */\n+    uint8_t     spn_obj;       /* Object ID */\n+    uint8_t     spn_dev;       /* Device ID */\n+    uint8_t     spn_resource;  /* Resource or function */\n+    uint8_t     spn_zero[...]; /* Padding */\n+  };\n+\n+The resource field is only used when sending and receiving;\n+It is ignored by bind() and getsockname().\n+\n+\n+Low-level datagram protocol\n+---------------------------\n+\n+Applications can send Phonet messages using the Phonet datagram socket\n+protocol from the PF_PHONET family. Each socket is bound to one of the\n+2^10 object IDs available, and can send and receive packets with any\n+other peer.\n+\n+  struct sockaddr_pn addr = { .spn_family = AF_PHONET, };\n+  ssize_t len;\n+  socklen_t addrlen = sizeof(addr);\n+  int fd;\n+\n+  fd = socket(PF_PHONET, SOCK_DGRAM, 0);\n+  bind(fd, (struct sockaddr *)&addr, sizeof(addr));\n+  /* ... */\n+\n+  sendto(fd, msg, msglen, 0, (struct sockaddr *)&addr, sizeof(addr));\n+  len = recvfrom(fd, buf, sizeof(buf), 0,\n+                 (struct sockaddr *)&addr, &addrlen);\n+\n+This protocol follows the SOCK_DGRAM connection-less semantics.\n+However, connect() and getpeername() are not supported, as they did\n+not seem useful with Phonet usages (could be added easily).\n+\n+\n+Authors\n+-------\n+\n+Linux Phonet was initially written by Sakari Ailus.\n+Other contributors include Mikä Liljeberg, Andras Domokos,\n+Carlos Chinea and Rémi Denis-Courmont.\n+Copyright (C) 2008 Nokia Corporation.\n","prefixes":["11/11"]}