1af873fceSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 209009f30SSjur Braendeland /* 309009f30SSjur Braendeland * Copyright (C) ST-Ericsson AB 2010 426ee65e6Ssjur.brandeland@stericsson.com * Author: Sjur Brendeland 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_preference - Physical preference HW Abstraction 1809009f30SSjur Braendeland * 1909009f30SSjur Braendeland * @CFPHYPREF_UNSPECIFIED: Default physical interface 2009009f30SSjur Braendeland * 2109009f30SSjur Braendeland * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency 2209009f30SSjur Braendeland * traffic 2309009f30SSjur Braendeland * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth 2409009f30SSjur Braendeland * traffic 2509009f30SSjur Braendeland * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem 2609009f30SSjur Braendeland * responses. 2709009f30SSjur Braendeland * 2809009f30SSjur Braendeland */ 2909009f30SSjur Braendeland enum cfcnfg_phy_preference { 3009009f30SSjur Braendeland CFPHYPREF_UNSPECIFIED, 3109009f30SSjur Braendeland CFPHYPREF_LOW_LAT, 3209009f30SSjur Braendeland CFPHYPREF_HIGH_BW, 3309009f30SSjur Braendeland CFPHYPREF_LOOP 3409009f30SSjur Braendeland }; 3509009f30SSjur Braendeland 3609009f30SSjur Braendeland /** 37bee925dbSsjur.brandeland@stericsson.com * cfcnfg_create() - Get the CAIF configuration object given network. 38bee925dbSsjur.brandeland@stericsson.com * @net: Network for the CAIF configuration object. 39bee925dbSsjur.brandeland@stericsson.com */ 40bee925dbSsjur.brandeland@stericsson.com struct cfcnfg *get_cfcnfg(struct net *net); 41bee925dbSsjur.brandeland@stericsson.com 42bee925dbSsjur.brandeland@stericsson.com /** 4309009f30SSjur Braendeland * cfcnfg_create() - Create the CAIF configuration object. 4409009f30SSjur Braendeland */ 4509009f30SSjur Braendeland struct cfcnfg *cfcnfg_create(void); 4609009f30SSjur Braendeland 4709009f30SSjur Braendeland /** 4809009f30SSjur Braendeland * cfcnfg_remove() - Remove the CFCNFG object 4909009f30SSjur Braendeland * @cfg: config object 5009009f30SSjur Braendeland */ 5109009f30SSjur Braendeland void cfcnfg_remove(struct cfcnfg *cfg); 5209009f30SSjur Braendeland 5309009f30SSjur Braendeland /** 5409009f30SSjur Braendeland * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. 5509009f30SSjur Braendeland * @cnfg: Pointer to a CAIF configuration object, created by 5609009f30SSjur Braendeland * cfcnfg_create(). 5709009f30SSjur Braendeland * @dev: Pointer to link layer device 5809009f30SSjur Braendeland * @phy_layer: Specify the physical layer. The transmit function 5909009f30SSjur Braendeland * MUST be set in the structure. 6009009f30SSjur Braendeland * @pref: The phy (link layer) preference. 617c18d220Ssjur.brandeland@stericsson.com * @link_support: Protocol implementation for link layer specific protocol. 6209009f30SSjur Braendeland * @fcs: Specify if checksum is used in CAIF Framing Layer. 637c18d220Ssjur.brandeland@stericsson.com * @head_room: Head space needed by link specific protocol. 6409009f30SSjur Braendeland */ 65*a2805dcaSPavel Skripkin int 667c18d220Ssjur.brandeland@stericsson.com cfcnfg_add_phy_layer(struct cfcnfg *cnfg, 672aa40aefSSjur Braendeland struct net_device *dev, struct cflayer *phy_layer, 68bee925dbSsjur.brandeland@stericsson.com enum cfcnfg_phy_preference pref, 697c18d220Ssjur.brandeland@stericsson.com struct cflayer *link_support, 707c18d220Ssjur.brandeland@stericsson.com bool fcs, int head_room); 7109009f30SSjur Braendeland 7209009f30SSjur Braendeland /** 7309009f30SSjur Braendeland * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. 7409009f30SSjur Braendeland * 7509009f30SSjur Braendeland * @cnfg: Pointer to a CAIF configuration object, created by 7609009f30SSjur Braendeland * cfcnfg_create(). 7709009f30SSjur Braendeland * @phy_layer: Adaptation layer to be removed. 7809009f30SSjur Braendeland */ 7909009f30SSjur Braendeland int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); 8009009f30SSjur Braendeland 8109009f30SSjur Braendeland /** 82bd30ce4bSsjur.brandeland@stericsson.com * cfcnfg_set_phy_state() - Set the state of the physical interface device. 83bd30ce4bSsjur.brandeland@stericsson.com * @cnfg: Configuration object 84bd30ce4bSsjur.brandeland@stericsson.com * @phy_layer: Physical Layer representation 85bd30ce4bSsjur.brandeland@stericsson.com * @up: State of device 86bd30ce4bSsjur.brandeland@stericsson.com */ 87bd30ce4bSsjur.brandeland@stericsson.com int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer, 88bd30ce4bSsjur.brandeland@stericsson.com bool up); 89bd30ce4bSsjur.brandeland@stericsson.com 9009009f30SSjur Braendeland #endif /* CFCNFG_H_ */ 91