Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2005738ybz; Thu, 30 Apr 2020 09:12:27 -0700 (PDT) X-Google-Smtp-Source: APiQypLsUc3/62lQsBydyx5aUA4uK07kvJjnXoTO9DjopivpFlH3yQafwHEqTUMHb6Cf4fYZ7hOB X-Received: by 2002:a05:6402:1515:: with SMTP id f21mr3506590edw.370.1588263147414; Thu, 30 Apr 2020 09:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588263147; cv=none; d=google.com; s=arc-20160816; b=ZAsCOq4HcZ0Q+kOysWmzt+B53M9Whgse7d5vPhrfVxwcIoM/5iKERzWQ7ExcI8/ZWP ZKMArlX6mD8np3WjOlNFEs8X0vWUEAiwevxcgBMS17iKgC0U4rJ/ao13pENEVgQbt1Ab hrGqKNKiXXd/03xYdiu4L6ZR0JQ4KQ1KuScn3Dck84/A0veOrM6oIgNhwzb7IHoyHn8E Q99vWUicwcSvJDdrb87iuyjFXjM1j8Gy4oo/3DZNP7k882tfgpbezArD7cEFgwzyszpg PzLBAjLHaFKdZLkv0AjwCkGR27runfX7RX+YgE5GjAwfdLWCaf6ykCaVWl0kolnIIqDL FHUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ak1FeVPQx23buJPH7p7wxd2T55e80xW/9UCvPHd3hv8=; b=JG/k/c9AMPYA+y3ITB7un8J1NfM46UvyVf+8gNHIQx+vpQdOM8no7NdnLFsnaF9d7Q C5ebPbbKsvI8ERXQULXcd/KU1r7+9MPHxjYJCbmg30PwAGdbfP1ZhwjpaN4sli4vyqHH am9ygIndgK9nvbu1XG361R4BM+N5vra6HrzgBokMI3+PEBUeHz4LJyajSq/o4TYgAUlk suPnLiXUV7RMw726+y8cZLTgH/UXX3DK4vJGi/EzxDbXTgkRgdHuzjYMJZhpHxy+uuAG izndJhNNhMSeAYGtYMmgHgb8qg9dyzRScBmw1ad50wwqHZcy9l3MCenOivjpiBTUkbOt YD7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZwE5aS2k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si18439edz.32.2020.04.30.09.12.03; Thu, 30 Apr 2020 09:12:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZwE5aS2k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728466AbgD3QG4 (ORCPT + 99 others); Thu, 30 Apr 2020 12:06:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:50892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbgD3QEi (ORCPT ); Thu, 30 Apr 2020 12:04:38 -0400 Received: from mail.kernel.org (ip5f5ad5c5.dynamic.kabel-deutschland.de [95.90.213.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 289DE24964; Thu, 30 Apr 2020 16:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588262676; bh=aYPeW3IqG9lVg2I9kmZNk4mbS6HsxCxvZcoR6oz+QKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZwE5aS2k2cfrMPA6I5wlEh4Ce/YUcKtv8lsyqqm+ZvKnlGpMSZl0WNtV1gd6nLBSt Z/IPRbGmtgADNIXX6sQDymcVp/w0OEQRxcqxHhqEM0+CCMiBMokeAgMQgZwKik9ElI ocGvbRQ6U794fdm9Xgt0pXXaqhzc8sjxtw4qyXys= Received: from mchehab by mail.kernel.org with local (Exim 4.92.3) (envelope-from ) id 1jUBfu-00AxFT-EE; Thu, 30 Apr 2020 18:04:34 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , "David S. Miller" , Jakub Kicinski , Remi Denis-Courmont , netdev@vger.kernel.org Subject: [PATCH 17/37] docs: networking: convert phonet.txt to ReST Date: Thu, 30 Apr 2020 18:04:12 +0200 Message-Id: <423e28fd2a70f7128a99bc52231fdc6e2a244f65.1588261997.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - add SPDX header; - adjust title markup; - use copyright symbol; - add notes markups; - mark code blocks and literals as such; - adjust identation, whitespaces and blank lines where needed; - add to networking/index.rst. Signed-off-by: Mauro Carvalho Chehab --- Documentation/networking/index.rst | 1 + Documentation/networking/packet_mmap.rst | 2 +- .../networking/{phonet.txt => phonet.rst} | 56 ++++++++++++------- MAINTAINERS | 2 +- 4 files changed, 39 insertions(+), 22 deletions(-) rename Documentation/networking/{phonet.txt => phonet.rst} (82%) diff --git a/Documentation/networking/index.rst b/Documentation/networking/index.rst index 8262b535a83e..e460026331c6 100644 --- a/Documentation/networking/index.rst +++ b/Documentation/networking/index.rst @@ -90,6 +90,7 @@ Contents: openvswitch operstates packet_mmap + phonet .. only:: subproject and html diff --git a/Documentation/networking/packet_mmap.rst b/Documentation/networking/packet_mmap.rst index 5f213d17652f..884c7222b9e9 100644 --- a/Documentation/networking/packet_mmap.rst +++ b/Documentation/networking/packet_mmap.rst @@ -1076,7 +1076,7 @@ Miscellaneous bits ================== - Packet sockets work well together with Linux socket filters, thus you also - might want to have a look at Documentation/networking/filter.txt + might want to have a look at Documentation/networking/filter.rst THANKS ====== diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.rst similarity index 82% rename from Documentation/networking/phonet.txt rename to Documentation/networking/phonet.rst index 81003581f47a..8668dcbc5e6a 100644 --- a/Documentation/networking/phonet.txt +++ b/Documentation/networking/phonet.rst @@ -1,3 +1,7 @@ +.. SPDX-License-Identifier: GPL-2.0 +.. include:: + +============================ Linux Phonet protocol family ============================ @@ -11,6 +15,7 @@ device attached to the modem. The modem takes care of routing. Phonet packets can be exchanged through various hardware connections depending on the device, such as: + - USB with the CDC Phonet interface, - infrared, - Bluetooth, @@ -21,7 +26,7 @@ depending on the device, such as: Packets format -------------- -Phonet packets have a common header as follows: +Phonet packets have a common header as follows:: struct phonethdr { uint8_t pn_media; /* Media type (link-layer identifier) */ @@ -72,7 +77,7 @@ only the (default) Linux FIFO qdisc should be used with them. Network layer ------------- -The Phonet socket address family maps the Phonet packet header: +The Phonet socket address family maps the Phonet packet header:: struct sockaddr_pn { sa_family_t spn_family; /* AF_PHONET */ @@ -94,6 +99,8 @@ protocol from the PF_PHONET family. Each socket is bound to one of the 2^10 object IDs available, and can send and receive packets with any other peer. +:: + struct sockaddr_pn addr = { .spn_family = AF_PHONET, }; ssize_t len; socklen_t addrlen = sizeof(addr); @@ -105,7 +112,7 @@ other peer. sendto(fd, msg, msglen, 0, (struct sockaddr *)&addr, sizeof(addr)); len = recvfrom(fd, buf, sizeof(buf), 0, - (struct sockaddr *)&addr, &addrlen); + (struct sockaddr *)&addr, &addrlen); This protocol follows the SOCK_DGRAM connection-less semantics. However, connect() and getpeername() are not supported, as they did @@ -116,7 +123,7 @@ Resource subscription --------------------- A Phonet datagram socket can be subscribed to any number of 8-bits -Phonet resources, as follow: +Phonet resources, as follow:: uint32_t res = 0xXX; ioctl(fd, SIOCPNADDRESOURCE, &res); @@ -137,6 +144,8 @@ socket paradigm. The listening socket is bound to an unique free object ID. Each listening socket can handle up to 255 simultaneous connections, one per accept()'d socket. +:: + int lfd, cfd; lfd = socket(PF_PHONET, SOCK_SEQPACKET, PN_PROTO_PIPE); @@ -161,7 +170,7 @@ Connections are traditionally established between two endpoints by a As of Linux kernel version 2.6.39, it is also possible to connect two endpoints directly, using connect() on the active side. This is intended to support the newer Nokia Wireless Modem API, as found in -e.g. the Nokia Slim Modem in the ST-Ericsson U8500 platform: +e.g. the Nokia Slim Modem in the ST-Ericsson U8500 platform:: struct sockaddr_spn spn; int fd; @@ -177,38 +186,45 @@ e.g. the Nokia Slim Modem in the ST-Ericsson U8500 platform: close(fd); -WARNING: -When polling a connected pipe socket for writability, there is an -intrinsic race condition whereby writability might be lost between the -polling and the writing system calls. In this case, the socket will -block until write becomes possible again, unless non-blocking mode -is enabled. +.. Warning: + + When polling a connected pipe socket for writability, there is an + intrinsic race condition whereby writability might be lost between the + polling and the writing system calls. In this case, the socket will + block until write becomes possible again, unless non-blocking mode + is enabled. The pipe protocol provides two socket options at the SOL_PNPIPE level: PNPIPE_ENCAP accepts one integer value (int) of: - PNPIPE_ENCAP_NONE: The socket operates normally (default). + PNPIPE_ENCAP_NONE: + The socket operates normally (default). - PNPIPE_ENCAP_IP: The socket is used as a backend for a virtual IP + PNPIPE_ENCAP_IP: + The socket is used as a backend for a virtual IP interface. This requires CAP_NET_ADMIN capability. GPRS data support on Nokia modems can use this. Note that the socket cannot be reliably poll()'d or read() from while in this mode. - PNPIPE_IFINDEX is a read-only integer value. It contains the - interface index of the network interface created by PNPIPE_ENCAP, - or zero if encapsulation is off. + PNPIPE_IFINDEX + is a read-only integer value. It contains the + interface index of the network interface created by PNPIPE_ENCAP, + or zero if encapsulation is off. - PNPIPE_HANDLE is a read-only integer value. It contains the underlying - identifier ("pipe handle") of the pipe. This is only defined for - socket descriptors that are already connected or being connected. + PNPIPE_HANDLE + is a read-only integer value. It contains the underlying + identifier ("pipe handle") of the pipe. This is only defined for + socket descriptors that are already connected or being connected. Authors ------- Linux Phonet was initially written by Sakari Ailus. + Other contributors include Mikä Liljeberg, Andras Domokos, Carlos Chinea and Rémi Denis-Courmont. -Copyright (C) 2008 Nokia Corporation. + +Copyright |copy| 2008 Nokia Corporation. diff --git a/MAINTAINERS b/MAINTAINERS index 1546ecb855b5..0d2005e8380e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13297,7 +13297,7 @@ F: drivers/input/joystick/pxrc.c PHONET PROTOCOL M: Remi Denis-Courmont S: Supported -F: Documentation/networking/phonet.txt +F: Documentation/networking/phonet.rst F: include/linux/phonet.h F: include/net/phonet/ F: include/uapi/linux/phonet.h -- 2.25.4