cfcnfg.h 2.5 KB

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