diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/if_mhi.h | 39 | ||||
-rw-r--r-- | include/linux/l2mux.h | 102 | ||||
-rw-r--r-- | include/linux/mhi.h | 55 | ||||
-rw-r--r-- | include/linux/socket.h | 6 | ||||
-rw-r--r-- | include/net/af_mhi.h | 38 | ||||
-rw-r--r-- | include/net/mhdp.h | 43 | ||||
-rw-r--r-- | include/net/mhi/dgram.h | 41 | ||||
-rw-r--r-- | include/net/mhi/mhdp.h | 35 | ||||
-rw-r--r-- | include/net/mhi/raw.h | 41 | ||||
-rw-r--r-- | include/net/mhi/sched.h | 35 | ||||
-rw-r--r-- | include/net/mhi/sock.h | 42 | ||||
-rw-r--r-- | include/uapi/linux/if_ether.h | 3 |
12 files changed, 479 insertions, 1 deletions
diff --git a/include/linux/if_mhi.h b/include/linux/if_mhi.h new file mode 100644 index 000000000000..98f20f429009 --- /dev/null +++ b/include/linux/if_mhi.h @@ -0,0 +1,39 @@ +/* + * File: if_mhi.h + * + * 'Modem-Host Interface' kernel definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * +*/ + +#ifndef LINUX_IF_MHI_H +#define LINUX_IF_MHI_H + +/* + * Packet sizes + */ + +#define MHI_MIN_MTU 260 +#define MHI_MAX_MTU 65540 + +#define MHI_MTU MHI_MAX_MTU + +/* + * Ioctl definitions + */ + + +#endif /* LINUX_IF_MHI_H */ diff --git a/include/linux/l2mux.h b/include/linux/l2mux.h new file mode 100644 index 000000000000..4f9dab8cf78a --- /dev/null +++ b/include/linux/l2mux.h @@ -0,0 +1,102 @@ +/* + * File: l2mux.h + * + * MHI L2MUX kernel definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef LINUX_L2MUX_H +#define LINUX_L2MUX_H + +#include <linux/types.h> +#include <linux/socket.h> + +#include <net/sock.h> + + +/* Official L3 protocol IDs */ +#define MHI_L3_PHONET 0x00 +#define MHI_L3_FILE 0x01 +#define MHI_L3_AUDIO 0x02 +#define MHI_L3_SECURITY 0x03 +#define MHI_L3_TEST 0x04 +#define MHI_L3_TEST_PRIO 0x05 +#define MHI_L3_XFILE 0x06 +#define MHI_L3_MHDP_DL 0x07 +#define MHI_L3_MHDP_UL 0x08 +#define MHI_L3_AUX_HOST 0x09 +#define MHI_L3_THERMAL 0xC1 +#define MHI_L3_HIGH_PRIO_TEST 0xFD +#define MHI_L3_MED_PRIO_TEST 0xFE +#define MHI_L3_LOW_PRIO_TEST 0xFF + +/* 256 possible protocols */ +#define MHI_L3_NPROTO 256 + +/* Special value for ANY */ +#define MHI_L3_ANY 0xFFFF + +typedef int (l2mux_skb_fn)(struct sk_buff *skb, struct net_device *dev); + +struct l2muxhdr { + __u8 l3_len[3]; + __u8 l3_prot; +} __packed; + +#define L2MUX_HDR_SIZE (sizeof(struct l2muxhdr)) + + +static inline struct l2muxhdr *l2mux_hdr(struct sk_buff *skb) +{ + return (struct l2muxhdr *)skb_mac_header(skb); +} + +static inline void l2mux_set_proto(struct l2muxhdr *hdr, int proto) +{ + hdr->l3_prot = proto; +} + +static inline int l2mux_get_proto(struct l2muxhdr *hdr) +{ + return hdr->l3_prot; +} + +static inline void l2mux_set_length(struct l2muxhdr *hdr, unsigned len) +{ + hdr->l3_len[0] = (len) & 0xFF; + hdr->l3_len[1] = (len >> 8) & 0xFF; + hdr->l3_len[2] = (len >> 16) & 0xFF; +} + +static inline unsigned l2mux_get_length(struct l2muxhdr *hdr) +{ + return (((unsigned)hdr->l3_len[2]) << 16) | + (((unsigned)hdr->l3_len[1]) << 8) | + ((unsigned)hdr->l3_len[0]); +} + +extern int l2mux_netif_rx_register(int l3, l2mux_skb_fn *rx_fn); +extern int l2mux_netif_rx_unregister(int l3); + +extern int l2mux_netif_tx_register(int pt, l2mux_skb_fn *rx_fn); +extern int l2mux_netif_tx_unregister(int pt); + +extern int l2mux_skb_rx(struct sk_buff *skb, struct net_device *dev); +extern int l2mux_skb_tx(struct sk_buff *skb, struct net_device *dev); + + +#endif /* LINUX_L2MUX_H */ diff --git a/include/linux/mhi.h b/include/linux/mhi.h new file mode 100644 index 000000000000..ba131350ee80 --- /dev/null +++ b/include/linux/mhi.h @@ -0,0 +1,55 @@ +/* + * file mhi.h + * + * Modem-Host Interface (MHI) kernel interface + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef LINUX_MHI_H +#define LINUX_MHI_H + +#include <linux/types.h> +#include <linux/socket.h> +#include <net/sock.h> +#include <asm/byteorder.h> + + +struct mhi_sock { + struct sock sk; + int sk_l3proto; + int sk_ifindex; +}; + +struct sockaddr_mhi { + sa_family_t sa_family; + int sa_ifindex; + __u8 sa_zero[sizeof(struct sockaddr) + - sizeof(sa_family_t) - sizeof(int)]; +}; + + +static inline struct mhi_sock *mhi_sk(struct sock *sk) +{ + return (struct mhi_sock *)sk; +} + +static inline struct sockaddr_mhi *sa_mhi(struct sockaddr *sa) +{ + return (struct sockaddr_mhi *)sa; +} + +#endif diff --git a/include/linux/socket.h b/include/linux/socket.h index b10ce4b341ea..1bdbcf26cb9e 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -179,7 +179,9 @@ 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_MHI 41 /* MHI sockets */ +#define AF_RAW 42 /* RAW sockets */ +#define AF_MAX 43 /* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC @@ -223,6 +225,8 @@ struct ucred { #define PF_ALG AF_ALG #define PF_NFC AF_NFC #define PF_VSOCK AF_VSOCK +#define PF_MHI AF_MHI +#define PF_RAW AF_RAW #define PF_MAX AF_MAX /* Maximum queue length specifiable by listen. */ diff --git a/include/net/af_mhi.h b/include/net/af_mhi.h new file mode 100644 index 000000000000..be571b7c28a8 --- /dev/null +++ b/include/net/af_mhi.h @@ -0,0 +1,38 @@ +/* + * File: net/af_mhi.h + * + * MHI Protocol Family kernel definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef __LINUX_NET_AFMHI_H +#define __LINUX_NET_AFMHI_H + +#include <linux/types.h> +#include <linux/socket.h> + +#include <net/sock.h> + + +extern int mhi_register_protocol(int protocol); +extern int mhi_unregister_protocol(int protocol); +extern int mhi_protocol_registered(int protocol); + +extern int mhi_skb_send(struct sk_buff *skb, struct net_device *dev, u8 proto); + + +#endif /* __LINUX_NET_AFMHI_H */ diff --git a/include/net/mhdp.h b/include/net/mhdp.h new file mode 100644 index 000000000000..1b8558e74ab9 --- /dev/null +++ b/include/net/mhdp.h @@ -0,0 +1,43 @@ +/* + * File: mhdp.h + * + * Modem-Host Interface (MHI) - MHDP kernel interface + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef __NET_MHDP_H +#define __NET_MHDP_H + +struct mhdp_tunnel_parm { + char name[IFNAMSIZ]; + int pdn_id; + char master_interface[IFNAMSIZ]; +}; + +struct mhdp_tunnel { + struct mhdp_tunnel *next; + struct net_device *dev; + struct mhdp_tunnel_parm parms; + struct net_device *master_dev; + struct sk_buff *skb; +}; + +#define SIOCADDPDNID (SIOCDEVPRIVATE + 1) +#define SIOCDELPDNID (SIOCDEVPRIVATE + 2) +#define SIOCRESETMHDP (SIOCDEVPRIVATE + 3) + +#endif /* __NET_MHDP_H */ diff --git a/include/net/mhi/dgram.h b/include/net/mhi/dgram.h new file mode 100644 index 000000000000..ceb34d58f5ae --- /dev/null +++ b/include/net/mhi/dgram.h @@ -0,0 +1,41 @@ +/* + * File: mhi/dgram.h + * + * MHI DGRAM socket definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef MHI_DGRAM_H +#define MHI_DGRAM_H + +#include <linux/types.h> +#include <linux/socket.h> + +#include <net/sock.h> + + +extern int mhi_dgram_sock_create( + struct net *net, + struct socket *sock, + int proto, + int kern); + +extern int mhi_dgram_proto_init(void); +extern void mhi_dgram_proto_exit(void); + + +#endif /* MHI_DGRAM_H */ diff --git a/include/net/mhi/mhdp.h b/include/net/mhi/mhdp.h new file mode 100644 index 000000000000..7ec1591cb8d3 --- /dev/null +++ b/include/net/mhi/mhdp.h @@ -0,0 +1,35 @@ +/* + * File: mhdp.h + * + * Modem-Host Interface (MHI) - MHDP kernel interface + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef __NET_MHI_MHDP_H +#define __NET_MHI_MHDP_H + +struct mhdp_tunnel_parm { + char name[IFNAMSIZ]; + char master[IFNAMSIZ]; + int pdn_id; +}; + +#define SIOCADDPDNID (SIOCDEVPRIVATE + 1) +#define SIOCDELPDNID (SIOCDEVPRIVATE + 2) +#define SIOCRESETMHDP (SIOCDEVPRIVATE + 3) + +#endif /* __NET_MHI_MHDP_H */ diff --git a/include/net/mhi/raw.h b/include/net/mhi/raw.h new file mode 100644 index 000000000000..7c2edba4f111 --- /dev/null +++ b/include/net/mhi/raw.h @@ -0,0 +1,41 @@ +/* + * File: mhi/raw.h + * + * MHI RAW socket definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef MHI_RAW_H +#define MHI_RAW_H + +#include <linux/types.h> +#include <linux/socket.h> + +#include <net/sock.h> + + +extern int mhi_raw_sock_create( + struct net *net, + struct socket *sock, + int proto, + int kern); + +extern int mhi_raw_proto_init(void); +extern void mhi_raw_proto_exit(void); + + +#endif /* MHI_RAW_H */ diff --git a/include/net/mhi/sched.h b/include/net/mhi/sched.h new file mode 100644 index 000000000000..8ff4b420c70a --- /dev/null +++ b/include/net/mhi/sched.h @@ -0,0 +1,35 @@ +/* + * File: mhi/sock.h + * + * MHI socket definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef MHI_SCHED_H +#define MHI_SCHED_H + +#define MHI_NOTIFY_QUEUE_LOW 19 +#define MHI_NOTIFY_QUEUE_HIGH 20 + +extern int mhi_register_queue_notifier(struct Qdisc *sch, + struct notifier_block *nb, unsigned long cl); + +extern int mhi_unregister_queue_notifier(struct Qdisc *sch, + struct notifier_block *nb, unsigned long cl); + + +#endif /* MHI_SCHED_H */ diff --git a/include/net/mhi/sock.h b/include/net/mhi/sock.h new file mode 100644 index 000000000000..170c892ec171 --- /dev/null +++ b/include/net/mhi/sock.h @@ -0,0 +1,42 @@ +/* + * File: mhi/sock.h + * + * MHI socket definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA + * + */ + +#ifndef MHI_SOCK_H +#define MHI_SOCK_H + +#include <linux/types.h> +#include <linux/socket.h> + +#include <net/sock.h> + +extern const struct proto_ops mhi_socket_ops; + +extern int mhi_sock_rcv_unicast(struct sk_buff *skb, u8 l3prot, u32 l3len); +extern int mhi_sock_rcv_multicast(struct sk_buff *skb, u8 l3prot, u32 l3len); + +extern void mhi_sock_hash(struct sock *sk); +extern void mhi_sock_unhash(struct sock *sk); + +extern int mhi_sock_init(void); +extern void mhi_sock_exit(void); + + +#endif /* MHI_SOCK_H */ diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index ade07f1c491a..c7e57ee54e97 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -125,6 +125,9 @@ #define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ #define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ #define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ +#define ETH_P_MHI 0x00F8 /* Renesas MHI protocol */ +#define ETH_P_RAW 0x00F9 /* RAW access to frames */ +#define ETH_P_MHDP 0x00FA /* MHDP data frames */ /* * This is an Ethernet frame header. |