^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) ST-Ericsson AB 2010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Author: Sjur Brendeland
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef CFCNFG_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define CFCNFG_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/netdevice.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <net/caif/caif_layer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <net/caif/cfctrl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct cfcnfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * enum cfcnfg_phy_preference - Physical preference HW Abstraction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * @CFPHYPREF_UNSPECIFIED: Default physical interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * traffic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * traffic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * responses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) enum cfcnfg_phy_preference {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) CFPHYPREF_UNSPECIFIED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) CFPHYPREF_LOW_LAT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) CFPHYPREF_HIGH_BW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) CFPHYPREF_LOOP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * cfcnfg_create() - Get the CAIF configuration object given network.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * @net: Network for the CAIF configuration object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct cfcnfg *get_cfcnfg(struct net *net);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * cfcnfg_create() - Create the CAIF configuration object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct cfcnfg *cfcnfg_create(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * cfcnfg_remove() - Remove the CFCNFG object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * @cfg: config object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) void cfcnfg_remove(struct cfcnfg *cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * @cnfg: Pointer to a CAIF configuration object, created by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * cfcnfg_create().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * @dev: Pointer to link layer device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * @phy_layer: Specify the physical layer. The transmit function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * MUST be set in the structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * @pref: The phy (link layer) preference.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * @link_support: Protocol implementation for link layer specific protocol.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * @fcs: Specify if checksum is used in CAIF Framing Layer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * @head_room: Head space needed by link specific protocol.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) cfcnfg_add_phy_layer(struct cfcnfg *cnfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct net_device *dev, struct cflayer *phy_layer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) enum cfcnfg_phy_preference pref,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct cflayer *link_support,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) bool fcs, int head_room);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * @cnfg: Pointer to a CAIF configuration object, created by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * cfcnfg_create().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * @phy_layer: Adaptation layer to be removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * cfcnfg_set_phy_state() - Set the state of the physical interface device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * @cnfg: Configuration object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * @phy_layer: Physical Layer representation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * @up: State of device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) bool up);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #endif /* CFCNFG_H_ */