Skip to content

Commit 2721c5b

Browse files
Sjur Braendelanddavem330
authored andcommitted
net-caif: add CAIF Link layer device header files
Header files for CAIF Link layer net-device, and link-layer registration. Signed-off-by: Sjur Braendeland <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 09009f3 commit 2721c5b

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

include/net/caif/caif_dev.h

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* Copyright (C) ST-Ericsson AB 2010
3+
* Author: Sjur Brendeland/ [email protected]
4+
* License terms: GNU General Public License (GPL) version 2
5+
*/
6+
7+
#ifndef CAIF_DEV_H_
8+
#define CAIF_DEV_H_
9+
10+
#include <net/caif/caif_layer.h>
11+
#include <net/caif/cfcnfg.h>
12+
#include <linux/caif/caif_socket.h>
13+
#include <linux/if.h>
14+
15+
/**
16+
* struct caif_param - CAIF parameters.
17+
* @size: Length of data
18+
* @data: Binary Data Blob
19+
*/
20+
struct caif_param {
21+
u16 size;
22+
u8 data[256];
23+
};
24+
25+
/**
26+
* caif_connect_request - Request data for CAIF channel setup.
27+
* @sockaddr: Socket address to connect.
28+
* @priority: Priority of the connection.
29+
* @link_selector: Link selector (high bandwidth or low latency)
30+
* @link_name: Name of the CAIF Link Layer to use.
31+
*
32+
* This struct is used when connecting a CAIF channel.
33+
* It contains all CAIF channel configuration options.
34+
*/
35+
struct caif_connect_request {
36+
int protocol;
37+
struct sockaddr_caif sockaddr;
38+
enum caif_channel_priority priority;
39+
enum caif_link_selector link_selector;
40+
char link_name[16];
41+
struct caif_param param;
42+
};
43+
44+
/**
45+
* caif_connect_client - Connect a client to CAIF Core Stack.
46+
* @config: Channel setup parameters, specifying what address
47+
* to connect on the Modem.
48+
* @client_layer: User implementation of client layer. This layer
49+
* MUST have receive and control callback functions
50+
* implemented.
51+
*
52+
* This function connects a CAIF channel. The Client must implement
53+
* the struct cflayer. This layer represents the Client layer and holds
54+
* receive functions and control callback functions. Control callback
55+
* function will receive information about connect/disconnect responses,
56+
* flow control etc (see enum caif_control).
57+
* E.g. CAIF Socket will call this function for each socket it connects
58+
* and have one client_layer instance for each socket.
59+
*/
60+
int caif_connect_client(struct caif_connect_request *config,
61+
struct cflayer *client_layer);
62+
63+
/**
64+
* caif_disconnect_client - Disconnects a client from the CAIF stack.
65+
*
66+
* @client_layer: Client layer to be removed.
67+
*/
68+
int caif_disconnect_client(struct cflayer *client_layer);
69+
70+
/**
71+
* connect_req_to_link_param - Translate configuration parameters
72+
* from socket format to internal format.
73+
* @cnfg: Pointer to configuration handler
74+
* @con_req: Configuration parameters supplied in function
75+
* caif_connect_client
76+
* @channel_setup_param: Parameters supplied to the CAIF Core stack for
77+
* setting up channels.
78+
*
79+
*/
80+
int connect_req_to_link_param(struct cfcnfg *cnfg,
81+
struct caif_connect_request *con_req,
82+
struct cfctrl_link_param *channel_setup_param);
83+
84+
/**
85+
* get_caif_conf() - Get the configuration handler.
86+
*/
87+
struct cfcnfg *get_caif_conf(void);
88+
89+
90+
#endif /* CAIF_DEV_H_ */

include/net/caif/caif_device.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (C) ST-Ericsson AB 2010
3+
* Author: Sjur Brendeland/ [email protected]
4+
* License terms: GNU General Public License (GPL) version 2
5+
*/
6+
7+
#ifndef CAIF_DEVICE_H_
8+
#define CAIF_DEVICE_H_
9+
#include <linux/kernel.h>
10+
#include <linux/net.h>
11+
#include <linux/netdevice.h>
12+
#include <linux/caif/caif_socket.h>
13+
#include <net/caif/caif_device.h>
14+
15+
/**
16+
* struct caif_dev_common - data shared between CAIF drivers and stack.
17+
* @flowctrl: Flow Control callback function. This function is
18+
* supplied by CAIF Core Stack and is used by CAIF
19+
* Link Layer to send flow-stop to CAIF Core.
20+
* The flow information will be distributed to all
21+
* clients of CAIF.
22+
*
23+
* @link_select: Profile of device, either high-bandwidth or
24+
* low-latency. This member is set by CAIF Link
25+
* Layer Device in order to indicate if this device
26+
* is a high bandwidth or low latency device.
27+
*
28+
* @use_frag: CAIF Frames may be fragmented.
29+
* Is set by CAIF Link Layer in order to indicate if the
30+
* interface receives fragmented frames that must be
31+
* assembled by CAIF Core Layer.
32+
*
33+
* @use_fcs: Indicate if Frame CheckSum (fcs) is used.
34+
* Is set if the physical interface is
35+
* using Frame Checksum on the CAIF Frames.
36+
*
37+
* @use_stx: Indicate STart of frame eXtension (stx) in use.
38+
* Is set if the CAIF Link Layer expects
39+
* CAIF Frames to start with the STX byte.
40+
*
41+
* This structure is shared between the CAIF drivers and the CAIF stack.
42+
* It is used by the device to register its behavior.
43+
* CAIF Core layer must set the member flowctrl in order to supply
44+
* CAIF Link Layer with the flow control function.
45+
*
46+
*/
47+
struct caif_dev_common {
48+
void (*flowctrl)(struct net_device *net, int on);
49+
enum caif_link_selector link_select;
50+
int use_frag;
51+
int use_fcs;
52+
int use_stx;
53+
};
54+
55+
#endif /* CAIF_DEVICE_H_ */

0 commit comments

Comments
 (0)