mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 00:21:17 +00:00
caif: prepare support for namespaces
Use struct net to reference CAIF configuration object instead of static variables. Refactor functions caif_connect_client, caif_disconnect_client and squach files cfcnfg.c and caif_config_utils. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b3ccfbe409
commit
bee925db9a
8 changed files with 176 additions and 261 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <net/caif/cfcnfg.h>
|
||||
#include <linux/caif/caif_socket.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/net.h>
|
||||
|
||||
/**
|
||||
* struct caif_param - CAIF parameters.
|
||||
|
@ -62,16 +63,18 @@ struct caif_connect_request {
|
|||
* E.g. CAIF Socket will call this function for each socket it connects
|
||||
* and have one client_layer instance for each socket.
|
||||
*/
|
||||
int caif_connect_client(struct caif_connect_request *conn_req,
|
||||
int caif_connect_client(struct net *net,
|
||||
struct caif_connect_request *conn_req,
|
||||
struct cflayer *client_layer, int *ifindex,
|
||||
int *headroom, int *tailroom);
|
||||
|
||||
/**
|
||||
* caif_disconnect_client - Disconnects a client from the CAIF stack.
|
||||
*
|
||||
* @client_layer: Client layer to be removed.
|
||||
* @client_layer: Client layer to be disconnected.
|
||||
*/
|
||||
int caif_disconnect_client(struct cflayer *client_layer);
|
||||
int caif_disconnect_client(struct net *net, struct cflayer *client_layer);
|
||||
|
||||
|
||||
/**
|
||||
* caif_client_register_refcnt - register ref-count functions provided by client.
|
||||
|
@ -90,21 +93,6 @@ int caif_disconnect_client(struct cflayer *client_layer);
|
|||
void caif_client_register_refcnt(struct cflayer *adapt_layer,
|
||||
void (*hold)(struct cflayer *lyr),
|
||||
void (*put)(struct cflayer *lyr));
|
||||
/**
|
||||
* caif_connect_req_to_link_param - Translate configuration parameters
|
||||
* from socket format to internal format.
|
||||
* @cnfg: Pointer to configuration handler
|
||||
* @con_req: Configuration parameters supplied in function
|
||||
* caif_connect_client
|
||||
* @channel_setup_param: Parameters supplied to the CAIF Core stack for
|
||||
* setting up channels.
|
||||
*
|
||||
*/
|
||||
|
||||
int caif_connect_req_to_link_param(struct cfcnfg *cnfg,
|
||||
struct caif_connect_request *con_req,
|
||||
struct cfctrl_link_param *setup_param);
|
||||
|
||||
/**
|
||||
* caif_free_client - Free memory used to manage the client in the CAIF Stack.
|
||||
*
|
||||
|
|
|
@ -45,6 +45,12 @@ enum cfcnfg_phy_preference {
|
|||
CFPHYPREF_LOOP
|
||||
};
|
||||
|
||||
/**
|
||||
* cfcnfg_create() - Get the CAIF configuration object given network.
|
||||
* @net: Network for the CAIF configuration object.
|
||||
*/
|
||||
struct cfcnfg *get_cfcnfg(struct net *net);
|
||||
|
||||
/**
|
||||
* cfcnfg_create() - Create the CAIF configuration object.
|
||||
*/
|
||||
|
@ -65,17 +71,15 @@ void cfcnfg_remove(struct cfcnfg *cfg);
|
|||
* @dev: Pointer to link layer device
|
||||
* @phy_layer: Specify the physical layer. The transmit function
|
||||
* MUST be set in the structure.
|
||||
* @phyid: The assigned physical ID for this layer, used in
|
||||
* cfcnfg_add_adapt_layer to specify PHY for the link.
|
||||
* @pref: The phy (link layer) preference.
|
||||
* @fcs: Specify if checksum is used in CAIF Framing Layer.
|
||||
* @stx: Specify if Start Of Frame extension is used.
|
||||
* @stx: Specify if Start Of Frame eXtention is used.
|
||||
*/
|
||||
|
||||
void
|
||||
cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
|
||||
struct net_device *dev, struct cflayer *phy_layer,
|
||||
u16 *phyid, enum cfcnfg_phy_preference pref,
|
||||
enum cfcnfg_phy_preference pref,
|
||||
bool fcs, bool stx);
|
||||
|
||||
/**
|
||||
|
@ -87,65 +91,6 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
|
|||
*/
|
||||
int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
|
||||
|
||||
/**
|
||||
* cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer.
|
||||
*
|
||||
* @cnfg: Pointer to a CAIF configuration object, created by
|
||||
* cfcnfg_create().
|
||||
* @adap_layer: Adaptation layer to be removed.
|
||||
*/
|
||||
int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg,
|
||||
struct cflayer *adap_layer);
|
||||
|
||||
/**
|
||||
* cfcnfg_release_adap_layer - Used by client to release the adaptation layer.
|
||||
*
|
||||
* @adap_layer: Adaptation layer.
|
||||
*/
|
||||
void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
|
||||
|
||||
/**
|
||||
* cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack.
|
||||
*
|
||||
* The adaptation Layer is where the interface to application or higher-level
|
||||
* driver functionality is implemented.
|
||||
*
|
||||
* @cnfg: Pointer to a CAIF configuration object, created by
|
||||
* cfcnfg_create().
|
||||
* @param: Link setup parameters.
|
||||
* @adap_layer: Specify the adaptation layer; the receive and
|
||||
* flow-control functions MUST be set in the structure.
|
||||
* @ifindex: Link layer interface index used for this connection.
|
||||
* @proto_head: Protocol head-space needed by CAIF protocol,
|
||||
* excluding link layer.
|
||||
* @proto_tail: Protocol tail-space needed by CAIF protocol,
|
||||
* excluding link layer.
|
||||
*/
|
||||
int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
|
||||
struct cfctrl_link_param *param,
|
||||
struct cflayer *adap_layer,
|
||||
int *ifindex,
|
||||
int *proto_head,
|
||||
int *proto_tail);
|
||||
|
||||
/**
|
||||
* cfcnfg_get_phyid() - Get physical ID, given type.
|
||||
* Returns one of the physical interfaces matching the given type.
|
||||
* Zero if no match is found.
|
||||
* @cnfg: Configuration object
|
||||
* @phy_pref: Caif Link Layer preference
|
||||
*/
|
||||
struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
|
||||
enum cfcnfg_phy_preference phy_pref);
|
||||
|
||||
/**
|
||||
* cfcnfg_get_id_from_ifi() - Get the Physical Identifier of ifindex,
|
||||
* it matches caif physical id with the kernel interface id.
|
||||
* @cnfg: Configuration object
|
||||
* @ifi: ifindex obtained from socket.c bindtodevice.
|
||||
*/
|
||||
int cfcnfg_get_id_from_ifi(struct cfcnfg *cnfg, int ifi);
|
||||
|
||||
/**
|
||||
* cfcnfg_set_phy_state() - Set the state of the physical interface device.
|
||||
* @cnfg: Configuration object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue