MOST network protocol
Subsystems (5)
cover MOST network protocol
This patch set includes known-working code, developed by Wind River and Intel, published at http://sourceforge.net/projects/sta2x11/ .
We fixed a number of things in the code, porting to the current linux-next and upstream sta2x11 code, factorizing replicated code, making stuff more readable and fixing buglets. (We is Federico Vaga, Alessandro Rubini, Giancarlo Asnaghi).
Patch 1 is the core, patch 2 is an interface driver and patch 3 is a pci fixup in the chipset that hosts the logic block for the interface.
Unfortunately, the code implements network-specific system calls but doesn't fit in the kernel network subsystem. Instead of using skbuffs and network interfaces, it sets up a direct connection between the system calls and custom-defined operations for the hardware driver.
We are aware patch 1/3 and 2/3 cannot be merged without serious refactoring, and for this reason we are not adding signed-off-by markers.
Still, we think the current code may be useful to other people
nonetheless: the MOST protocol is not very common, but it is not an exotic single-vendor thing, either.
We plan to work on resubmitting this in the upcoming months, adapting to the proper conventions for a network protocol.
Giancarlo Asnaghi (3):
net: add support for MOST protocol
drivers/net/most: add MediaLB driver for sta2x11 arch/x86/pci/sta2x11-fixup.c: reset and enable STA2X11 MediaLB clock
arch/x86/pci/sta2x11-fixup.c | 17 + drivers/net/Makefile | 1 + drivers/net/most/Kconfig | 10 + drivers/net/most/Makefile | 6 + drivers/net/most/sta2x11mlb.c | 1181 +++++++++++++++++++++++++++++++++++++++++ drivers/net/most/sta2x11mlb.h | 275 ++++++++++ include/linux/socket.h | 4 +- include/net/most/most.h | 238 +++++++++ net/Kconfig | 1 + net/Makefile | 1 + net/core/sock.c | 9 +- net/most/Kconfig | 15 + net/most/Makefile | 6 + net/most/af_most.c | 967 +++++++++++++++++++++++++++++++++ 14 files changed, 2727 insertions(+), 4 deletions(-) create mode 100644 drivers/net/most/Kconfig create mode 100644 drivers/net/most/Makefile create mode 100644 drivers/net/most/sta2x11mlb.c create mode 100644 drivers/net/most/sta2x11mlb.h create mode 100644 include/net/most/most.h create mode 100644 net/most/Kconfig create mode 100644 net/most/Makefile create mode 100644 net/most/af_most.c
Signature · 1 line
1.7.7.2
PATCH 1/3 net: add support for MOST protocol
This patch adds core support for the MOST protocol. More information about the protocol can be found at: http://www.mostcooperation.com/
See the lkml message "[PATCH 0/3] MOST network protocol" sent on Jun 10th 2013 about this code and the missing "Signed-off" lines.
--- include/linux/socket.h | 4 +- include/net/most/most.h | 238 ++++++++++++ net/Kconfig | 1 + net/Makefile | 1 + net/core/sock.c | 9 +- net/most/Kconfig | 15 + net/most/Makefile | 6 + net/most/af_most.c | 967 +++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 1237 insertions(+), 4 deletions(-) create mode 100644 include/net/most/most.h create mode 100644 net/most/Kconfig create mode 100644 net/most/Makefile create mode 100644 net/most/af_most.c
include/linux/socket.h +3 -1
@@ -179,7 +179,8 @@ struct ucred {#define AF_ALG 38/* Algorithm sockets */ #define AF_NFC 39/* NFC sockets */ #define AF_VSOCK 40/* vSockets */ -#define AF_MAX 41/* For now.. */ +#define AF_MOST 41/* MOST sockets */ +#define AF_MAX 42/* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC
@@ -223,6 +224,7 @@ struct ucred {#define PF_ALG AF_ALG#define PF_NFC AF_NFC#define PF_VSOCK AF_VSOCK +#define PF_MOST AF_MOST#define PF_MAX AF_MAX/* Maximum queue length specifiable by listen. */
include/net/most/most.h new file +238 -0
238 lines not on this page · raw message
net/Kconfig +1 -0
@@ -327,6 +327,7 @@ source "net/can/Kconfig" source "net/irda/Kconfig" source "net/bluetooth/Kconfig" source "net/rxrpc/Kconfig" +source "net/most/Kconfig" config FIB_RULES bool
net/Makefile +1 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_ATM) += atm/ obj-$(CONFIG_L2TP) += l2tp/ obj-$(CONFIG_DECNET) += decnet/ obj-$(CONFIG_PHONET) += phonet/ +obj-$(CONFIG_MOST) += most/ ifneq ($(CONFIG_VLAN_8021Q),) obj-y += 8021q/ endif
net/core/sock.c +6 -3
@@ -210,7 +210,8 @@ static const char *const af_family_key_strings[AF_MAX+1] = {"sk_lock-AF_TIPC" ,"sk_lock-AF_BLUETOOTH" ,"sk_lock-IUCV" ,"sk_lock-AF_RXRPC" ,"sk_lock-AF_ISDN" ,"sk_lock-AF_PHONET" ,"sk_lock-AF_IEEE802154" ,"sk_lock-AF_CAIF" ,"sk_lock-AF_ALG" , -"sk_lock-AF_NFC" ,"sk_lock-AF_VSOCK" ,"sk_lock-AF_MAX" +"sk_lock-AF_NFC" ,"sk_lock-AF_VSOCK" ,"sk_lock-AF_MOST" , +"sk_lock-AF_MAX" };static const char *const af_family_slock_key_strings[AF_MAX +1 ] = { "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" ,
@@ -226,7 +227,8 @@ static const char *const af_family_slock_key_strings[AF_MAX+1] = {"slock-AF_TIPC" ,"slock-AF_BLUETOOTH" ,"slock-AF_IUCV" ,"slock-AF_RXRPC" ,"slock-AF_ISDN" ,"slock-AF_PHONET" ,"slock-AF_IEEE802154" ,"slock-AF_CAIF" ,"slock-AF_ALG" , -"slock-AF_NFC" ,"slock-AF_VSOCK" ,"slock-AF_MAX" +"slock-AF_NFC" ,"slock-AF_VSOCK" ,"slock-AF_MOST" , +"slock-AF_MAX" };static const char *const af_family_clock_key_strings[AF_MAX +1 ] = { "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" ,
@@ -242,7 +244,8 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = {"clock-AF_TIPC" ,"clock-AF_BLUETOOTH" ,"clock-AF_IUCV" ,"clock-AF_RXRPC" ,"clock-AF_ISDN" ,"clock-AF_PHONET" ,"clock-AF_IEEE802154" ,"clock-AF_CAIF" ,"clock-AF_ALG" , -"clock-AF_NFC" ,"clock-AF_VSOCK" ,"clock-AF_MAX" +"clock-AF_NFC" ,"clock-AF_VSOCK" ,"clock-AF_MOST" , +"clock-AF_MAX" };/*
net/most/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# +# Media Oriented Systems Transport (MOST) network layer core configuration +# + +menuconfig MOST + depends on NET + tristate "MOST bus subsystem support" + ---help--- + Media Oriented Systems Transport (MOST) is a multimedia + communications protocol in the automotive industry. + You also need a low level for the hardware. + Isochronous channels are currently not supported. + If you want MOST support you should say Y here. + +source "drivers/net/most/Kconfig"
net/most/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for the Linux Media Oriented Systems Transport core. +# + +obj-$(CONFIG_MOST) += most.o +most-objs := af_most.o
net/most/af_most.c new file +967 -0
967 lines not on this page · raw message
Signature · 1 line
1.7.7.2
David Miller
maintainerRe: [PATCH 1/3] net: add support for MOST protocol
From: Giancarlo Asnaghi <[email protected]>
Date: Mon, 10 Jun 2013 14:52:25 +0200
Quoted 5 lines
This patch adds core support for the MOST protocol. More information about the protocol can be found at: http://www.mostcooperation.com/
See the lkml message "[PATCH 0/3] MOST network protocol" sent on Jun 10th 2013 about this code and the missing "Signed-off" lines.
There are a lot of coding style issues in these patches, I'm only going to point out one:
net/most/af_most.c line 84
Quoted 4 lines
net/most/af_most.c new file +4
-0+if (most_sk (sk)->dev_id == dev_id && +most_sk (sk)->channel_type ==most_cb (skb)->channel_type + &&most_sk (sk)->rx_channel ==most_cb (skb)->channel && + sk->sk_state ==MOST_BOUND ) {
Frankly, this is very ugly, even ignoring the standard coding style rules.
First of all, never put the operators at the beginning of the line. This code not only does that, but it mixes style every other line, that's terrible.
Secondly, each line of the conditional after the first must line up at the first column after the openning parenthesis of the if() statement (or any inner parenthetical grouping the expression is a part of).
You achieve such alignment using the appropriate number of TAB and space characters necessary to do so, for example:
if (x &&
y &&
z) {
...
}PATCH 2/3 drivers/net/most: add MediaLB driver for sta2x11
In reply to Giancarlo AsnaghiSee the lkml message "[PATCH 0/3] MOST network protocol" sent on Jun 10th 2013 about this code and the missing "Signed-off" lines.
--- drivers/net/Makefile | 1 + drivers/net/most/Kconfig | 10 + drivers/net/most/Makefile | 6 + drivers/net/most/sta2x11mlb.c | 1181 +++++++++++++++++++++++++++++++++++++++++ drivers/net/most/sta2x11mlb.h | 275 ++++++++++ 5 files changed, 1473 insertions(+), 0 deletions(-) create mode 100644 drivers/net/most/Kconfig create mode 100644 drivers/net/most/Makefile create mode 100644 drivers/net/most/sta2x11mlb.c create mode 100644 drivers/net/most/sta2x11mlb.h
drivers/net/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_FDDI) += fddi/ obj-$(CONFIG_HIPPI) += hippi/ obj-$(CONFIG_HAMRADIO) += hamradio/ obj-$(CONFIG_IRDA) += irda/ +obj-$(CONFIG_MOST) += most/ obj-$(CONFIG_PLIP) += plip/ obj-$(CONFIG_PPP) += ppp/ obj-$(CONFIG_PPP_ASYNC) += ppp/
drivers/net/most/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +menu "MOST Device Drivers" + depends on MOST + +config MOST_STA2X11_MLB + tristate "The STA2X11 MOST block" + depends on MOST && STA2X11 + ---help--- + Adds support for MLB on the sta2x11 + +endmenu
drivers/net/most/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for the Linux Media Oriented Systems Transport drivers. +# + +obj-$(CONFIG_MOST_TIMB_MLB) += timbmlb.o +obj-$(CONFIG_MOST_STA2X11_MLB) += sta2x11mlb.o
drivers/net/most/sta2x11mlb.c new file +1181 -0
1,181 lines not on this page · raw message
drivers/net/most/sta2x11mlb.h new file +275 -0
275 lines not on this page · raw message
Signature · 1 line
1.7.7.2
PATCH 3/3 arch/x86/pci/sta2x11-fixup.c: reset and enable STA2X11 MediaLB clock
In reply to Giancarlo AsnaghiThe MediaLB peripheral, devoted to the MOST protocol, must be reset using chipset registers, so this code is not part of the MLB PCI driver.
--- arch/x86/pci/sta2x11-fixup.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
arch/x86/pci/sta2x11-fixup.c +17 -0
@@ -26,6 +26,9 @@#include <linux/pci_ids.h> #include <linux/export.h> #include <linux/list.h> +#include <linux/delay.h> +#include <linux/mfd/sta2x11-mfd.h> +#include <asm/sta2x11.h> #define STA2X11_SWIOTLB_SIZE (4*1024*1024)extern int swiotlb_late_init_with_default_size (size_t default_size);
@@ -212,6 +215,20 @@ static void sta2x11_setup_pdev(struct pci_dev *pdev) }DECLARE_PCI_FIXUP_ENABLE (PCI_VENDOR_ID_STMICRO ,PCI_ANY_ID , sta2x11_setup_pdev); +static void sta2x11_most_enable (struct pci_dev *pdev) +{ +/* trying to reset the MLB */ +sta2x11_apbreg_mask (pdev,APBREG_PCG ,APBREG_MLB ,0 ); +sta2x11_apbreg_mask (pdev,APBREG_PUR ,APBREG_MLB ,0 ); +msleep_interruptible (100 ); + +/* Config clock and release device from reset */ +sta2x11_apbreg_mask (pdev,APBREG_PCG ,APBREG_MLB ,APBREG_MLB ); +sta2x11_apbreg_mask (pdev,APBREG_PUR ,APBREG_MLB ,APBREG_MLB ); +msleep_interruptible (100 ); +} +DECLARE_PCI_FIXUP_ENABLE (PCI_VENDOR_ID_STMICRO ,0xcc12 , sta2x11_most_enable); +/* * The following three functions are exported (used in swiotlb: FIXME) */
Signature · 1 line
1.7.7.2