aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/caif
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/net/caif
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/net/caif')
-rw-r--r--include/net/caif/caif_dev.h21
-rw-r--r--include/net/caif/caif_hsi.h122
-rw-r--r--include/net/caif/caif_layer.h4
-rw-r--r--include/net/caif/caif_spi.h4
-rw-r--r--include/net/caif/cfcnfg.h23
-rw-r--r--include/net/caif/cfpkt.h9
-rw-r--r--include/net/caif/cfserl.h4
7 files changed, 60 insertions, 127 deletions
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index ef2dd9438bb..c011281d92c 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -9,7 +9,6 @@
9 9
10#include <net/caif/caif_layer.h> 10#include <net/caif/caif_layer.h>
11#include <net/caif/cfcnfg.h> 11#include <net/caif/cfcnfg.h>
12#include <net/caif/caif_device.h>
13#include <linux/caif/caif_socket.h> 12#include <linux/caif/caif_socket.h>
14#include <linux/if.h> 13#include <linux/if.h>
15#include <linux/net.h> 14#include <linux/net.h>
@@ -105,24 +104,4 @@ void caif_client_register_refcnt(struct cflayer *adapt_layer,
105 */ 104 */
106void caif_free_client(struct cflayer *adap_layer); 105void caif_free_client(struct cflayer *adap_layer);
107 106
108/**
109 * struct caif_enroll_dev - Enroll a net-device as a CAIF Link layer
110 * @dev: Network device to enroll.
111 * @caifdev: Configuration information from CAIF Link Layer
112 * @link_support: Link layer support layer
113 * @head_room: Head room needed by link support layer
114 * @layer: Lowest layer in CAIF stack
115 * @rcv_fun: Receive function for CAIF stack.
116 *
117 * This function enroll a CAIF link layer into CAIF Stack and
118 * expects the interface to be able to handle CAIF payload.
119 * The link_support layer is used to add any Link Layer specific
120 * framing.
121 */
122void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev,
123 struct cflayer *link_support, int head_room,
124 struct cflayer **layer, int (**rcv_func)(
125 struct sk_buff *, struct net_device *,
126 struct packet_type *, struct net_device *));
127
128#endif /* CAIF_DEV_H_ */ 107#endif /* CAIF_DEV_H_ */
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index bcb9cc3ce98..c5dedd87b4c 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -52,9 +52,8 @@ struct cfhsi_desc {
52/* 52/*
53 * Maximum bytes transferred in one transfer. 53 * Maximum bytes transferred in one transfer.
54 */ 54 */
55#define CFHSI_MAX_CAIF_FRAME_SZ 4096 55/* TODO: 4096 is temporary... */
56 56#define CFHSI_MAX_PAYLOAD_SZ (CFHSI_MAX_PKTS * 4096)
57#define CFHSI_MAX_PAYLOAD_SZ (CFHSI_MAX_PKTS * CFHSI_MAX_CAIF_FRAME_SZ)
58 57
59/* Size of the complete HSI TX buffer. */ 58/* Size of the complete HSI TX buffer. */
60#define CFHSI_BUF_SZ_TX (CFHSI_DESC_SZ + CFHSI_MAX_PAYLOAD_SZ) 59#define CFHSI_BUF_SZ_TX (CFHSI_DESC_SZ + CFHSI_MAX_PAYLOAD_SZ)
@@ -76,69 +75,38 @@ struct cfhsi_desc {
76#define CFHSI_WAKE_UP_ACK 1 75#define CFHSI_WAKE_UP_ACK 1
77#define CFHSI_WAKE_DOWN_ACK 2 76#define CFHSI_WAKE_DOWN_ACK 2
78#define CFHSI_AWAKE 3 77#define CFHSI_AWAKE 3
79#define CFHSI_WAKELOCK_HELD 4 78#define CFHSI_PENDING_RX 4
80#define CFHSI_SHUTDOWN 5 79#define CFHSI_SHUTDOWN 6
81#define CFHSI_FLUSH_FIFO 6 80#define CFHSI_FLUSH_FIFO 7
82 81
83#ifndef CFHSI_INACTIVITY_TOUT 82#ifndef CFHSI_INACTIVITY_TOUT
84#define CFHSI_INACTIVITY_TOUT (1 * HZ) 83#define CFHSI_INACTIVITY_TOUT (1 * HZ)
85#endif /* CFHSI_INACTIVITY_TOUT */ 84#endif /* CFHSI_INACTIVITY_TOUT */
86 85
87#ifndef CFHSI_WAKE_TOUT 86#ifndef CFHSI_WAKEUP_TOUT
88#define CFHSI_WAKE_TOUT (3 * HZ) 87#define CFHSI_WAKEUP_TOUT (3 * HZ)
89#endif /* CFHSI_WAKE_TOUT */ 88#endif /* CFHSI_WAKEUP_TOUT */
90 89
91#ifndef CFHSI_MAX_RX_RETRIES
92#define CFHSI_MAX_RX_RETRIES (10 * HZ)
93#endif
94 90
95/* Structure implemented by the CAIF HSI driver. */ 91/* Structure implemented by the CAIF HSI driver. */
96struct cfhsi_cb_ops { 92struct cfhsi_drv {
97 void (*tx_done_cb) (struct cfhsi_cb_ops *drv); 93 void (*tx_done_cb) (struct cfhsi_drv *drv);
98 void (*rx_done_cb) (struct cfhsi_cb_ops *drv); 94 void (*rx_done_cb) (struct cfhsi_drv *drv);
99 void (*wake_up_cb) (struct cfhsi_cb_ops *drv); 95 void (*wake_up_cb) (struct cfhsi_drv *drv);
100 void (*wake_down_cb) (struct cfhsi_cb_ops *drv); 96 void (*wake_down_cb) (struct cfhsi_drv *drv);
101}; 97};
102 98
103/* Structure implemented by HSI device. */ 99/* Structure implemented by HSI device. */
104struct cfhsi_ops { 100struct cfhsi_dev {
105 int (*cfhsi_up) (struct cfhsi_ops *dev); 101 int (*cfhsi_up) (struct cfhsi_dev *dev);
106 int (*cfhsi_down) (struct cfhsi_ops *dev); 102 int (*cfhsi_down) (struct cfhsi_dev *dev);
107 int (*cfhsi_tx) (u8 *ptr, int len, struct cfhsi_ops *dev); 103 int (*cfhsi_tx) (u8 *ptr, int len, struct cfhsi_dev *dev);
108 int (*cfhsi_rx) (u8 *ptr, int len, struct cfhsi_ops *dev); 104 int (*cfhsi_rx) (u8 *ptr, int len, struct cfhsi_dev *dev);
109 int (*cfhsi_wake_up) (struct cfhsi_ops *dev); 105 int (*cfhsi_wake_up) (struct cfhsi_dev *dev);
110 int (*cfhsi_wake_down) (struct cfhsi_ops *dev); 106 int (*cfhsi_wake_down) (struct cfhsi_dev *dev);
111 int (*cfhsi_get_peer_wake) (struct cfhsi_ops *dev, bool *status); 107 int (*cfhsi_fifo_occupancy)(struct cfhsi_dev *dev, size_t *occupancy);
112 int (*cfhsi_fifo_occupancy) (struct cfhsi_ops *dev, size_t *occupancy); 108 int (*cfhsi_rx_cancel)(struct cfhsi_dev *dev);
113 int (*cfhsi_rx_cancel)(struct cfhsi_ops *dev); 109 struct cfhsi_drv *drv;
114 struct cfhsi_cb_ops *cb_ops;
115};
116
117/* Structure holds status of received CAIF frames processing */
118struct cfhsi_rx_state {
119 int state;
120 int nfrms;
121 int pld_len;
122 int retries;
123 bool piggy_desc;
124};
125
126/* Priority mapping */
127enum {
128 CFHSI_PRIO_CTL = 0,
129 CFHSI_PRIO_VI,
130 CFHSI_PRIO_VO,
131 CFHSI_PRIO_BEBK,
132 CFHSI_PRIO_LAST,
133};
134
135struct cfhsi_config {
136 u32 inactivity_timeout;
137 u32 aggregation_timeout;
138 u32 head_align;
139 u32 tail_align;
140 u32 q_high_mark;
141 u32 q_low_mark;
142}; 110};
143 111
144/* Structure implemented by CAIF HSI drivers. */ 112/* Structure implemented by CAIF HSI drivers. */
@@ -146,56 +114,32 @@ struct cfhsi {
146 struct caif_dev_common cfdev; 114 struct caif_dev_common cfdev;
147 struct net_device *ndev; 115 struct net_device *ndev;
148 struct platform_device *pdev; 116 struct platform_device *pdev;
149 struct sk_buff_head qhead[CFHSI_PRIO_LAST]; 117 struct sk_buff_head qhead;
150 struct cfhsi_cb_ops cb_ops; 118 struct cfhsi_drv drv;
151 struct cfhsi_ops *ops; 119 struct cfhsi_dev *dev;
152 int tx_state; 120 int tx_state;
153 struct cfhsi_rx_state rx_state; 121 int rx_state;
154 struct cfhsi_config cfg;
155 int rx_len; 122 int rx_len;
156 u8 *rx_ptr; 123 u8 *rx_ptr;
157 u8 *tx_buf; 124 u8 *tx_buf;
158 u8 *rx_buf; 125 u8 *rx_buf;
159 u8 *rx_flip_buf;
160 spinlock_t lock; 126 spinlock_t lock;
161 int flow_off_sent; 127 int flow_off_sent;
128 u32 q_low_mark;
129 u32 q_high_mark;
162 struct list_head list; 130 struct list_head list;
163 struct work_struct wake_up_work; 131 struct work_struct wake_up_work;
164 struct work_struct wake_down_work; 132 struct work_struct wake_down_work;
165 struct work_struct out_of_sync_work; 133 struct work_struct rx_done_work;
134 struct work_struct tx_done_work;
166 struct workqueue_struct *wq; 135 struct workqueue_struct *wq;
167 wait_queue_head_t wake_up_wait; 136 wait_queue_head_t wake_up_wait;
168 wait_queue_head_t wake_down_wait; 137 wait_queue_head_t wake_down_wait;
169 wait_queue_head_t flush_fifo_wait; 138 wait_queue_head_t flush_fifo_wait;
170 struct timer_list inactivity_timer; 139 struct timer_list timer;
171 struct timer_list rx_slowpath_timer;
172
173 /* TX aggregation */
174 int aggregation_len;
175 struct timer_list aggregation_timer;
176
177 unsigned long bits; 140 unsigned long bits;
178}; 141};
179extern struct platform_driver cfhsi_driver;
180 142
181/** 143extern struct platform_driver cfhsi_driver;
182 * enum ifla_caif_hsi - CAIF HSI NetlinkRT parameters.
183 * @IFLA_CAIF_HSI_INACTIVITY_TOUT: Inactivity timeout before
184 * taking the HSI wakeline down, in milliseconds.
185 * When using RT Netlink to create, destroy or configure a CAIF HSI interface,
186 * enum ifla_caif_hsi is used to specify the configuration attributes.
187 */
188enum ifla_caif_hsi {
189 __IFLA_CAIF_HSI_UNSPEC,
190 __IFLA_CAIF_HSI_INACTIVITY_TOUT,
191 __IFLA_CAIF_HSI_AGGREGATION_TOUT,
192 __IFLA_CAIF_HSI_HEAD_ALIGN,
193 __IFLA_CAIF_HSI_TAIL_ALIGN,
194 __IFLA_CAIF_HSI_QHIGH_WATERMARK,
195 __IFLA_CAIF_HSI_QLOW_WATERMARK,
196 __IFLA_CAIF_HSI_MAX
197};
198
199extern struct cfhsi_ops *cfhsi_get_ops(void);
200 144
201#endif /* CAIF_HSI_H_ */ 145#endif /* CAIF_HSI_H_ */
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 0f3a39125f9..35bc7883cf9 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -121,7 +121,9 @@ enum caif_direction {
121 * @transmit: Packet transmit funciton. 121 * @transmit: Packet transmit funciton.
122 * @ctrlcmd: Used for control signalling upwards in the stack. 122 * @ctrlcmd: Used for control signalling upwards in the stack.
123 * @modemcmd: Used for control signaling downwards in the stack. 123 * @modemcmd: Used for control signaling downwards in the stack.
124 * @prio: Priority of this layer.
124 * @id: The identity of this layer 125 * @id: The identity of this layer
126 * @type: The type of this layer
125 * @name: Name of the layer. 127 * @name: Name of the layer.
126 * 128 *
127 * This structure defines the layered structure in CAIF. 129 * This structure defines the layered structure in CAIF.
@@ -228,7 +230,9 @@ struct cflayer {
228 */ 230 */
229 int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl); 231 int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl);
230 232
233 unsigned short prio;
231 unsigned int id; 234 unsigned int id;
235 unsigned int type;
232 char name[CAIF_LAYER_NAME_SZ]; 236 char name[CAIF_LAYER_NAME_SZ];
233}; 237};
234 238
diff --git a/include/net/caif/caif_spi.h b/include/net/caif/caif_spi.h
index aa6a485b054..87c3d11b8e5 100644
--- a/include/net/caif/caif_spi.h
+++ b/include/net/caif/caif_spi.h
@@ -55,8 +55,8 @@
55struct cfspi_xfer { 55struct cfspi_xfer {
56 u16 tx_dma_len; 56 u16 tx_dma_len;
57 u16 rx_dma_len; 57 u16 rx_dma_len;
58 void *va_tx[2]; 58 void *va_tx;
59 dma_addr_t pa_tx[2]; 59 dma_addr_t pa_tx;
60 void *va_rx; 60 void *va_rx;
61 dma_addr_t pa_rx; 61 dma_addr_t pa_rx;
62}; 62};
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 90b4ff8bad8..3e93a4a4b67 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -14,6 +14,18 @@
14struct cfcnfg; 14struct cfcnfg;
15 15
16/** 16/**
17 * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack
18 *
19 * @CFPHYTYPE_FRAG: Fragmented frames physical interface.
20 * @CFPHYTYPE_CAIF: Generic CAIF physical interface
21 */
22enum cfcnfg_phy_type {
23 CFPHYTYPE_FRAG = 1,
24 CFPHYTYPE_CAIF,
25 CFPHYTYPE_MAX
26};
27
28/**
17 * enum cfcnfg_phy_preference - Physical preference HW Abstraction 29 * enum cfcnfg_phy_preference - Physical preference HW Abstraction
18 * 30 *
19 * @CFPHYPREF_UNSPECIFIED: Default physical interface 31 * @CFPHYPREF_UNSPECIFIED: Default physical interface
@@ -54,20 +66,21 @@ void cfcnfg_remove(struct cfcnfg *cfg);
54 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. 66 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
55 * @cnfg: Pointer to a CAIF configuration object, created by 67 * @cnfg: Pointer to a CAIF configuration object, created by
56 * cfcnfg_create(). 68 * cfcnfg_create().
69 * @phy_type: Specifies the type of physical interface, e.g.
70 * CFPHYTYPE_FRAG.
57 * @dev: Pointer to link layer device 71 * @dev: Pointer to link layer device
58 * @phy_layer: Specify the physical layer. The transmit function 72 * @phy_layer: Specify the physical layer. The transmit function
59 * MUST be set in the structure. 73 * MUST be set in the structure.
60 * @pref: The phy (link layer) preference. 74 * @pref: The phy (link layer) preference.
61 * @link_support: Protocol implementation for link layer specific protocol.
62 * @fcs: Specify if checksum is used in CAIF Framing Layer. 75 * @fcs: Specify if checksum is used in CAIF Framing Layer.
63 * @head_room: Head space needed by link specific protocol. 76 * @stx: Specify if Start Of Frame eXtention is used.
64 */ 77 */
78
65void 79void
66cfcnfg_add_phy_layer(struct cfcnfg *cnfg, 80cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
67 struct net_device *dev, struct cflayer *phy_layer, 81 struct net_device *dev, struct cflayer *phy_layer,
68 enum cfcnfg_phy_preference pref, 82 enum cfcnfg_phy_preference pref,
69 struct cflayer *link_support, 83 bool fcs, bool stx);
70 bool fcs, int head_room);
71 84
72/** 85/**
73 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. 86 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h
index 83a89ba3005..6bd200a4754 100644
--- a/include/net/caif/cfpkt.h
+++ b/include/net/caif/cfpkt.h
@@ -188,18 +188,11 @@ struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt);
188 */ 188 */
189void *cfpkt_tonative(struct cfpkt *pkt); 189void *cfpkt_tonative(struct cfpkt *pkt);
190 190
191
191/* 192/*
192 * Returns packet information for a packet. 193 * Returns packet information for a packet.
193 * pkt Packet to get info from; 194 * pkt Packet to get info from;
194 * @return Packet information 195 * @return Packet information
195 */ 196 */
196struct caif_payload_info *cfpkt_info(struct cfpkt *pkt); 197struct caif_payload_info *cfpkt_info(struct cfpkt *pkt);
197
198/** cfpkt_set_prio - set priority for a CAIF packet.
199 *
200 * @pkt: The CAIF packet to be adjusted.
201 * @prio: one of TC_PRIO_ constants.
202 */
203void cfpkt_set_prio(struct cfpkt *pkt, int prio);
204
205#endif /* CFPKT_H_ */ 198#endif /* CFPKT_H_ */
diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h
index f121299a342..b8374321b36 100644
--- a/include/net/caif/cfserl.h
+++ b/include/net/caif/cfserl.h
@@ -8,5 +8,5 @@
8#define CFSERL_H_ 8#define CFSERL_H_
9#include <net/caif/caif_layer.h> 9#include <net/caif/caif_layer.h>
10 10
11struct cflayer *cfserl_create(int instance, bool use_stx); 11struct cflayer *cfserl_create(int type, int instance, bool use_stx);
12#endif 12#endif /* CFSERL_H_ */