109009f30SSjur Braendeland /* 209009f30SSjur Braendeland * Copyright (C) ST-Ericsson AB 2010 309009f30SSjur Braendeland * Author: Sjur Brendeland/sjur.brandeland@stericsson.com 409009f30SSjur Braendeland * License terms: GNU General Public License (GPL) version 2 509009f30SSjur Braendeland */ 609009f30SSjur Braendeland 709009f30SSjur Braendeland #ifndef CFCNFG_H_ 809009f30SSjur Braendeland #define CFCNFG_H_ 909009f30SSjur Braendeland #include <linux/spinlock.h> 102aa40aefSSjur Braendeland #include <linux/netdevice.h> 1109009f30SSjur Braendeland #include <net/caif/caif_layer.h> 1209009f30SSjur Braendeland #include <net/caif/cfctrl.h> 1309009f30SSjur Braendeland 1409009f30SSjur Braendeland struct cfcnfg; 1509009f30SSjur Braendeland 1609009f30SSjur Braendeland /** 1709009f30SSjur Braendeland * enum cfcnfg_phy_type - Types of physical layers defined in CAIF Stack 1809009f30SSjur Braendeland * 1909009f30SSjur Braendeland * @CFPHYTYPE_FRAG: Fragmented frames physical interface. 2009009f30SSjur Braendeland * @CFPHYTYPE_CAIF: Generic CAIF physical interface 2109009f30SSjur Braendeland */ 2209009f30SSjur Braendeland enum cfcnfg_phy_type { 2309009f30SSjur Braendeland CFPHYTYPE_FRAG = 1, 2409009f30SSjur Braendeland CFPHYTYPE_CAIF, 2509009f30SSjur Braendeland CFPHYTYPE_MAX 2609009f30SSjur Braendeland }; 2709009f30SSjur Braendeland 2809009f30SSjur Braendeland /** 2909009f30SSjur Braendeland * enum cfcnfg_phy_preference - Physical preference HW Abstraction 3009009f30SSjur Braendeland * 3109009f30SSjur Braendeland * @CFPHYPREF_UNSPECIFIED: Default physical interface 3209009f30SSjur Braendeland * 3309009f30SSjur Braendeland * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency 3409009f30SSjur Braendeland * traffic 3509009f30SSjur Braendeland * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth 3609009f30SSjur Braendeland * traffic 3709009f30SSjur Braendeland * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem 3809009f30SSjur Braendeland * responses. 3909009f30SSjur Braendeland * 4009009f30SSjur Braendeland */ 4109009f30SSjur Braendeland enum cfcnfg_phy_preference { 4209009f30SSjur Braendeland CFPHYPREF_UNSPECIFIED, 4309009f30SSjur Braendeland CFPHYPREF_LOW_LAT, 4409009f30SSjur Braendeland CFPHYPREF_HIGH_BW, 4509009f30SSjur Braendeland CFPHYPREF_LOOP 4609009f30SSjur Braendeland }; 4709009f30SSjur Braendeland 4809009f30SSjur Braendeland /** 49bee925dbSsjur.brandeland@stericsson.com * cfcnfg_create() - Get the CAIF configuration object given network. 50bee925dbSsjur.brandeland@stericsson.com * @net: Network for the CAIF configuration object. 51bee925dbSsjur.brandeland@stericsson.com */ 52bee925dbSsjur.brandeland@stericsson.com struct cfcnfg *get_cfcnfg(struct net *net); 53bee925dbSsjur.brandeland@stericsson.com 54bee925dbSsjur.brandeland@stericsson.com /** 5509009f30SSjur Braendeland * cfcnfg_create() - Create the CAIF configuration object. 5609009f30SSjur Braendeland */ 5709009f30SSjur Braendeland struct cfcnfg *cfcnfg_create(void); 5809009f30SSjur Braendeland 5909009f30SSjur Braendeland /** 6009009f30SSjur Braendeland * cfcnfg_remove() - Remove the CFCNFG object 6109009f30SSjur Braendeland * @cfg: config object 6209009f30SSjur Braendeland */ 6309009f30SSjur Braendeland void cfcnfg_remove(struct cfcnfg *cfg); 6409009f30SSjur Braendeland 6509009f30SSjur Braendeland /** 6609009f30SSjur Braendeland * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. 6709009f30SSjur Braendeland * @cnfg: Pointer to a CAIF configuration object, created by 6809009f30SSjur Braendeland * cfcnfg_create(). 6909009f30SSjur Braendeland * @phy_type: Specifies the type of physical interface, e.g. 7009009f30SSjur Braendeland * CFPHYTYPE_FRAG. 7109009f30SSjur Braendeland * @dev: Pointer to link layer device 7209009f30SSjur Braendeland * @phy_layer: Specify the physical layer. The transmit function 7309009f30SSjur Braendeland * MUST be set in the structure. 7409009f30SSjur Braendeland * @pref: The phy (link layer) preference. 75*7c18d220Ssjur.brandeland@stericsson.com * @link_support: Protocol implementation for link layer specific protocol. 7609009f30SSjur Braendeland * @fcs: Specify if checksum is used in CAIF Framing Layer. 77*7c18d220Ssjur.brandeland@stericsson.com * @head_room: Head space needed by link specific protocol. 7809009f30SSjur Braendeland */ 7909009f30SSjur Braendeland void 80*7c18d220Ssjur.brandeland@stericsson.com cfcnfg_add_phy_layer(struct cfcnfg *cnfg, 812aa40aefSSjur Braendeland struct net_device *dev, struct cflayer *phy_layer, 82bee925dbSsjur.brandeland@stericsson.com enum cfcnfg_phy_preference pref, 83*7c18d220Ssjur.brandeland@stericsson.com struct cflayer *link_support, 84*7c18d220Ssjur.brandeland@stericsson.com bool fcs, int head_room); 8509009f30SSjur Braendeland 8609009f30SSjur Braendeland /** 8709009f30SSjur Braendeland * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. 8809009f30SSjur Braendeland * 8909009f30SSjur Braendeland * @cnfg: Pointer to a CAIF configuration object, created by 9009009f30SSjur Braendeland * cfcnfg_create(). 9109009f30SSjur Braendeland * @phy_layer: Adaptation layer to be removed. 9209009f30SSjur Braendeland */ 9309009f30SSjur Braendeland int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); 9409009f30SSjur Braendeland 9509009f30SSjur Braendeland /** 96bd30ce4bSsjur.brandeland@stericsson.com * cfcnfg_set_phy_state() - Set the state of the physical interface device. 97bd30ce4bSsjur.brandeland@stericsson.com * @cnfg: Configuration object 98bd30ce4bSsjur.brandeland@stericsson.com * @phy_layer: Physical Layer representation 99bd30ce4bSsjur.brandeland@stericsson.com * @up: State of device 100bd30ce4bSsjur.brandeland@stericsson.com */ 101bd30ce4bSsjur.brandeland@stericsson.com int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer, 102bd30ce4bSsjur.brandeland@stericsson.com bool up); 103bd30ce4bSsjur.brandeland@stericsson.com 10409009f30SSjur Braendeland #endif /* CFCNFG_H_ */ 105