blob: 90b4ff8bad838819d62d5a230bd970090b0e8808 [file] [log] [blame]
Sjur Braendeland09009f32010-03-30 13:56:21 +00001/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef CFCNFG_H_
8#define CFCNFG_H_
9#include <linux/spinlock.h>
Sjur Braendeland2aa40ae2010-06-17 06:55:40 +000010#include <linux/netdevice.h>
Sjur Braendeland09009f32010-03-30 13:56:21 +000011#include <net/caif/caif_layer.h>
12#include <net/caif/cfctrl.h>
13
14struct cfcnfg;
15
16/**
Sjur Braendeland09009f32010-03-30 13:56:21 +000017 * enum cfcnfg_phy_preference - Physical preference HW Abstraction
18 *
19 * @CFPHYPREF_UNSPECIFIED: Default physical interface
20 *
21 * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency
22 * traffic
23 * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth
24 * traffic
25 * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem
26 * responses.
27 *
28 */
29enum cfcnfg_phy_preference {
30 CFPHYPREF_UNSPECIFIED,
31 CFPHYPREF_LOW_LAT,
32 CFPHYPREF_HIGH_BW,
33 CFPHYPREF_LOOP
34};
35
36/**
sjur.brandeland@stericsson.combee925d2011-05-13 02:44:05 +000037 * cfcnfg_create() - Get the CAIF configuration object given network.
38 * @net: Network for the CAIF configuration object.
39 */
40struct cfcnfg *get_cfcnfg(struct net *net);
41
42/**
Sjur Braendeland09009f32010-03-30 13:56:21 +000043 * cfcnfg_create() - Create the CAIF configuration object.
44 */
45struct cfcnfg *cfcnfg_create(void);
46
47/**
48 * cfcnfg_remove() - Remove the CFCNFG object
49 * @cfg: config object
50 */
51void cfcnfg_remove(struct cfcnfg *cfg);
52
53/**
54 * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
55 * @cnfg: Pointer to a CAIF configuration object, created by
56 * cfcnfg_create().
Sjur Braendeland09009f32010-03-30 13:56:21 +000057 * @dev: Pointer to link layer device
58 * @phy_layer: Specify the physical layer. The transmit function
59 * MUST be set in the structure.
Sjur Braendeland09009f32010-03-30 13:56:21 +000060 * @pref: The phy (link layer) preference.
sjur.brandeland@stericsson.com7c18d222011-11-30 09:22:47 +000061 * @link_support: Protocol implementation for link layer specific protocol.
Sjur Braendeland09009f32010-03-30 13:56:21 +000062 * @fcs: Specify if checksum is used in CAIF Framing Layer.
sjur.brandeland@stericsson.com7c18d222011-11-30 09:22:47 +000063 * @head_room: Head space needed by link specific protocol.
Sjur Braendeland09009f32010-03-30 13:56:21 +000064 */
Sjur Braendeland09009f32010-03-30 13:56:21 +000065void
sjur.brandeland@stericsson.com7c18d222011-11-30 09:22:47 +000066cfcnfg_add_phy_layer(struct cfcnfg *cnfg,
Sjur Braendeland2aa40ae2010-06-17 06:55:40 +000067 struct net_device *dev, struct cflayer *phy_layer,
sjur.brandeland@stericsson.combee925d2011-05-13 02:44:05 +000068 enum cfcnfg_phy_preference pref,
sjur.brandeland@stericsson.com7c18d222011-11-30 09:22:47 +000069 struct cflayer *link_support,
70 bool fcs, int head_room);
Sjur Braendeland09009f32010-03-30 13:56:21 +000071
72/**
73 * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
74 *
75 * @cnfg: Pointer to a CAIF configuration object, created by
76 * cfcnfg_create().
77 * @phy_layer: Adaptation layer to be removed.
78 */
79int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
80
81/**
sjur.brandeland@stericsson.combd30ce42011-05-13 02:44:00 +000082 * cfcnfg_set_phy_state() - Set the state of the physical interface device.
83 * @cnfg: Configuration object
84 * @phy_layer: Physical Layer representation
85 * @up: State of device
86 */
87int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer,
88 bool up);
89
Sjur Braendeland09009f32010-03-30 13:56:21 +000090#endif /* CFCNFG_H_ */