blob: 52224de798aa977eda13f1982581d322a2e222eb [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are
4 * created for each DLCI associated with a FRAD. The FRAD driver
5 * is not truly a network device, but the lower level device
6 * handler. This allows other FRAD manufacturers to use the DLCI
7 * code, including its RFC1490 encapsulation alongside the current
8 * implementation for the Sangoma cards.
9 *
10 * Version: @(#)if_ifrad.h 0.15 31 Mar 96
11 *
12 * Author: Mike McLagan <mike.mclagan@linux.org>
13 *
14 * Changes:
15 * 0.15 Mike McLagan changed structure defs (packed)
16 * re-arranged flags
17 * added DLCI_RET vars
Linus Torvalds1da177e2005-04-16 15:20:36 -070018 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#ifndef _FRAD_H_
20#define _FRAD_H_
21
David Howells607ca462012-10-13 10:46:48 +010022#include <uapi/linux/if_frad.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Krzysztof Hałasa3121a482009-01-26 12:30:12 -080025#if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
26
Linus Torvalds1da177e2005-04-16 15:20:36 -070027/* these are the fields of an RFC 1490 header */
28struct frhdr
29{
Jan Blunck6a878182006-01-08 01:05:07 -080030 unsigned char control;
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32 /* for IP packets, this can be the NLPID */
Jan Blunck6a878182006-01-08 01:05:07 -080033 unsigned char pad;
Linus Torvalds1da177e2005-04-16 15:20:36 -070034
Jan Blunck6a878182006-01-08 01:05:07 -080035 unsigned char NLPID;
36 unsigned char OUI[3];
Al Viro904584012007-12-22 17:52:52 +000037 __be16 PID;
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39#define IP_NLPID pad
Eric Dumazetbc105022010-06-03 03:21:52 -070040} __packed;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42/* see RFC 1490 for the definition of the following */
43#define FRAD_I_UI 0x03
44
45#define FRAD_P_PADDING 0x00
46#define FRAD_P_Q933 0x08
47#define FRAD_P_SNAP 0x80
48#define FRAD_P_CLNP 0x81
49#define FRAD_P_IP 0xCC
50
51struct dlci_local
52{
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 struct net_device *master;
54 struct net_device *slave;
55 struct dlci_conf config;
56 int configured;
57 struct list_head list;
58
59 /* callback function */
60 void (*receive)(struct sk_buff *skb, struct net_device *);
61};
62
63struct frad_local
64{
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 /* devices which this FRAD is slaved to */
66 struct net_device *master[CONFIG_DLCI_MAX];
67 short dlci[CONFIG_DLCI_MAX];
68
69 struct frad_conf config;
70 int configured; /* has this device been configured */
71 int initialized; /* mem_start, port, irq set ? */
72
73 /* callback functions */
74 int (*activate)(struct net_device *, struct net_device *);
75 int (*deactivate)(struct net_device *, struct net_device *);
76 int (*assoc)(struct net_device *, struct net_device *);
77 int (*deassoc)(struct net_device *, struct net_device *);
78 int (*dlci_conf)(struct net_device *, struct net_device *, int get);
79
80 /* fields that are used by the Sangoma SDLA cards */
81 struct timer_list timer;
Kees Cook032cfd62017-10-25 03:53:59 -070082 struct net_device *dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 int type; /* adapter type */
84 int state; /* state of the S502/8 control latch */
85 int buffer; /* current buffer for S508 firmware */
86};
87
Linus Torvalds1da177e2005-04-16 15:20:36 -070088#endif /* CONFIG_DLCI || CONFIG_DLCI_MODULE */
89
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030090extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
Krzysztof Hałasa3121a482009-01-26 12:30:12 -080091
Linus Torvalds1da177e2005-04-16 15:20:36 -070092#endif