aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjur Braendeland <sjur.brandeland@stericsson.com>2010-06-17 02:55:40 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-20 22:46:06 -0400
commit2aa40aef9debc77d55cc87a50d335b6fe97fbeb0 (patch)
tree0dccf47cf6cb861c7efa72601fab9511760c7e74
parenta7da1f55a826c621251874e7684c234972fc3216 (diff)
caif: Use link layer MTU instead of fixed MTU
Previously CAIF supported maximum transfer size of ~4050. The transfer size is now calculated dynamically based on the link layers mtu size. Signed-off-by: Sjur Braendeland@stericsson.com Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/caif/caif_serial.c1
-rw-r--r--include/net/caif/caif_dev.h8
-rw-r--r--include/net/caif/caif_layer.h6
-rw-r--r--include/net/caif/cfcnfg.h16
-rw-r--r--net/caif/caif_dev.c12
-rw-r--r--net/caif/caif_socket.c54
-rw-r--r--net/caif/cfcnfg.c44
-rw-r--r--net/caif/cfctrl.c6
-rw-r--r--net/caif/cfdgml.c5
-rw-r--r--net/caif/cfpkt_skbuff.c4
-rw-r--r--net/caif/cfserl.c7
-rw-r--r--net/caif/cfsrvl.c1
-rw-r--r--net/caif/cfutill.c6
-rw-r--r--net/caif/cfveil.c5
-rw-r--r--net/caif/chnl_net.c67
15 files changed, 173 insertions, 69 deletions
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 3e706f00a0d3..3df0c0f8b8bf 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -403,7 +403,6 @@ static void caifdev_setup(struct net_device *dev)
403 dev->type = ARPHRD_CAIF; 403 dev->type = ARPHRD_CAIF;
404 dev->flags = IFF_POINTOPOINT | IFF_NOARP; 404 dev->flags = IFF_POINTOPOINT | IFF_NOARP;
405 dev->mtu = CAIF_MAX_MTU; 405 dev->mtu = CAIF_MAX_MTU;
406 dev->hard_header_len = CAIF_NEEDED_HEADROOM;
407 dev->tx_queue_len = 0; 406 dev->tx_queue_len = 0;
408 dev->destructor = free_netdev; 407 dev->destructor = free_netdev;
409 skb_queue_head_init(&serdev->head); 408 skb_queue_head_init(&serdev->head);
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h
index 318ab9478a44..6da573c75d54 100644
--- a/include/net/caif/caif_dev.h
+++ b/include/net/caif/caif_dev.h
@@ -50,6 +50,9 @@ struct caif_connect_request {
50 * @client_layer: User implementation of client layer. This layer 50 * @client_layer: User implementation of client layer. This layer
51 * MUST have receive and control callback functions 51 * MUST have receive and control callback functions
52 * implemented. 52 * implemented.
53 * @ifindex: Link layer interface index used for this connection.
54 * @headroom: Head room needed by CAIF protocol.
55 * @tailroom: Tail room needed by CAIF protocol.
53 * 56 *
54 * This function connects a CAIF channel. The Client must implement 57 * This function connects a CAIF channel. The Client must implement
55 * the struct cflayer. This layer represents the Client layer and holds 58 * the struct cflayer. This layer represents the Client layer and holds
@@ -59,8 +62,9 @@ struct caif_connect_request {
59 * E.g. CAIF Socket will call this function for each socket it connects 62 * E.g. CAIF Socket will call this function for each socket it connects
60 * and have one client_layer instance for each socket. 63 * and have one client_layer instance for each socket.
61 */ 64 */
62int caif_connect_client(struct caif_connect_request *config, 65int caif_connect_client(struct caif_connect_request *conn_req,
63 struct cflayer *client_layer); 66 struct cflayer *client_layer, int *ifindex,
67 int *headroom, int *tailroom);
64 68
65/** 69/**
66 * caif_disconnect_client - Disconnects a client from the CAIF stack. 70 * caif_disconnect_client - Disconnects a client from the CAIF stack.
diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h
index 25c472f0e5b8..c8b07a904e78 100644
--- a/include/net/caif/caif_layer.h
+++ b/include/net/caif/caif_layer.h
@@ -15,14 +15,8 @@ struct cfpktq;
15struct caif_payload_info; 15struct caif_payload_info;
16struct caif_packet_funcs; 16struct caif_packet_funcs;
17 17
18#define CAIF_MAX_FRAMESIZE 4096
19#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64)
20#define CAIF_NEEDED_HEADROOM (10)
21#define CAIF_NEEDED_TAILROOM (2)
22 18
23#define CAIF_LAYER_NAME_SZ 16 19#define CAIF_LAYER_NAME_SZ 16
24#define CAIF_SUCCESS 1
25#define CAIF_FAILURE 0
26 20
27/** 21/**
28 * caif_assert() - Assert function for CAIF. 22 * caif_assert() - Assert function for CAIF.
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h
index 9fc2fc20b884..bd646faffa47 100644
--- a/include/net/caif/cfcnfg.h
+++ b/include/net/caif/cfcnfg.h
@@ -7,6 +7,7 @@
7#ifndef CFCNFG_H_ 7#ifndef CFCNFG_H_
8#define CFCNFG_H_ 8#define CFCNFG_H_
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/netdevice.h>
10#include <net/caif/caif_layer.h> 11#include <net/caif/caif_layer.h>
11#include <net/caif/cfctrl.h> 12#include <net/caif/cfctrl.h>
12 13
@@ -73,8 +74,8 @@ void cfcnfg_remove(struct cfcnfg *cfg);
73 74
74void 75void
75cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, 76cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
76 void *dev, struct cflayer *phy_layer, u16 *phyid, 77 struct net_device *dev, struct cflayer *phy_layer,
77 enum cfcnfg_phy_preference pref, 78 u16 *phyid, enum cfcnfg_phy_preference pref,
78 bool fcs, bool stx); 79 bool fcs, bool stx);
79 80
80/** 81/**
@@ -114,11 +115,18 @@ void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
114 * @param: Link setup parameters. 115 * @param: Link setup parameters.
115 * @adap_layer: Specify the adaptation layer; the receive and 116 * @adap_layer: Specify the adaptation layer; the receive and
116 * flow-control functions MUST be set in the structure. 117 * flow-control functions MUST be set in the structure.
117 * 118 * @ifindex: Link layer interface index used for this connection.
119 * @proto_head: Protocol head-space needed by CAIF protocol,
120 * excluding link layer.
121 * @proto_tail: Protocol tail-space needed by CAIF protocol,
122 * excluding link layer.
118 */ 123 */
119int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, 124int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
120 struct cfctrl_link_param *param, 125 struct cfctrl_link_param *param,
121 struct cflayer *adap_layer); 126 struct cflayer *adap_layer,
127 int *ifindex,
128 int *proto_head,
129 int *proto_tail);
122 130
123/** 131/**
124 * cfcnfg_get_phyid() - Get physical ID, given type. 132 * cfcnfg_get_phyid() - Get physical ID, given type.
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index e2b86f1f5a47..0b586e9d1378 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -255,7 +255,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
255 pref = CFPHYPREF_HIGH_BW; 255 pref = CFPHYPREF_HIGH_BW;
256 break; 256 break;
257 } 257 }
258 258 dev_hold(dev);
259 cfcnfg_add_phy_layer(get_caif_conf(), 259 cfcnfg_add_phy_layer(get_caif_conf(),
260 phy_type, 260 phy_type,
261 dev, 261 dev,
@@ -285,6 +285,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
285 caifd->layer.up->ctrlcmd(caifd->layer.up, 285 caifd->layer.up->ctrlcmd(caifd->layer.up,
286 _CAIF_CTRLCMD_PHYIF_DOWN_IND, 286 _CAIF_CTRLCMD_PHYIF_DOWN_IND,
287 caifd->layer.id); 287 caifd->layer.id);
288 might_sleep();
288 res = wait_event_interruptible_timeout(caifd->event, 289 res = wait_event_interruptible_timeout(caifd->event,
289 atomic_read(&caifd->in_use) == 0, 290 atomic_read(&caifd->in_use) == 0,
290 TIMEOUT); 291 TIMEOUT);
@@ -300,6 +301,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what,
300 "Unregistering an active CAIF device: %s\n", 301 "Unregistering an active CAIF device: %s\n",
301 __func__, dev->name); 302 __func__, dev->name);
302 cfcnfg_del_phy_layer(get_caif_conf(), &caifd->layer); 303 cfcnfg_del_phy_layer(get_caif_conf(), &caifd->layer);
304 dev_put(dev);
303 atomic_set(&caifd->state, what); 305 atomic_set(&caifd->state, what);
304 break; 306 break;
305 307
@@ -326,7 +328,8 @@ struct cfcnfg *get_caif_conf(void)
326EXPORT_SYMBOL(get_caif_conf); 328EXPORT_SYMBOL(get_caif_conf);
327 329
328int caif_connect_client(struct caif_connect_request *conn_req, 330int caif_connect_client(struct caif_connect_request *conn_req,
329 struct cflayer *client_layer) 331 struct cflayer *client_layer, int *ifindex,
332 int *headroom, int *tailroom)
330{ 333{
331 struct cfctrl_link_param param; 334 struct cfctrl_link_param param;
332 int ret; 335 int ret;
@@ -334,8 +337,9 @@ int caif_connect_client(struct caif_connect_request *conn_req,
334 if (ret) 337 if (ret)
335 return ret; 338 return ret;
336 /* Hook up the adaptation layer. */ 339 /* Hook up the adaptation layer. */
337 return cfcnfg_add_adaptation_layer(get_caif_conf(), 340 return cfcnfg_add_adaptation_layer(get_caif_conf(), &param,
338 &param, client_layer); 341 client_layer, ifindex,
342 headroom, tailroom);
339} 343}
340EXPORT_SYMBOL(caif_connect_client);