cfcnfg.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (C) ST-Ericsson AB 2010
  3. * Author: Sjur Brendeland/sjur.brandeland@stericsson.com
  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_type - Types of physical layers defined in CAIF Stack
  15. *
  16. * @CFPHYTYPE_FRAG: Fragmented frames physical interface.
  17. * @CFPHYTYPE_CAIF: Generic CAIF physical interface
  18. */
  19. enum cfcnfg_phy_type {
  20. CFPHYTYPE_FRAG = 1,
  21. CFPHYTYPE_CAIF,
  22. CFPHYTYPE_MAX
  23. };
  24. /**
  25. * enum cfcnfg_phy_preference - Physical preference HW Abstraction
  26. *
  27. * @CFPHYPREF_UNSPECIFIED: Default physical interface
  28. *
  29. * @CFPHYPREF_LOW_LAT: Default physical interface for low-latency
  30. * traffic
  31. * @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth
  32. * traffic
  33. * @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem
  34. * responses.
  35. *
  36. */
  37. enum cfcnfg_phy_preference {
  38. CFPHYPREF_UNSPECIFIED,
  39. CFPHYPREF_LOW_LAT,
  40. CFPHYPREF_HIGH_BW,
  41. CFPHYPREF_LOOP
  42. };
  43. /**
  44. * cfcnfg_create() - Create the CAIF configuration object.
  45. */
  46. struct cfcnfg *cfcnfg_create(void);
  47. /**
  48. * cfcnfg_remove() - Remove the CFCNFG object
  49. * @cfg: config object
  50. */
  51. void cfcnfg_remove(struct cfcnfg *cfg);
  52. /**
  53. * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
  54. * @cnfg: Pointer to a CAIF configuration object, created by
  55. * cfcnfg_create().
  56. * @phy_type: Specifies the type of physical interface, e.g.
  57. * CFPHYTYPE_FRAG.
  58. * @dev: Pointer to link layer device
  59. * @phy_layer: Specify the physical layer. The transmit function
  60. * MUST be set in the structure.
  61. * @phyid: The assigned physical ID for this layer, used in
  62. * cfcnfg_add_adapt_layer to specify PHY for the link.
  63. * @pref: The phy (link layer) preference.
  64. * @fcs: Specify if checksum is used in CAIF Framing Layer.
  65. * @stx: Specify if Start Of Frame eXtention is used.
  66. */
  67. void
  68. cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
  69. struct net_device *dev, struct cflayer *phy_layer,
  70. u16 *phyid, enum cfcnfg_phy_preference pref,
  71. bool fcs, bool stx);
  72. /**
  73. * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
  74. *
  75. * @cnfg: Pointer to a CAIF configuration object, created by
  76. * cfcnfg_create().
  77. * @phy_layer: Adaptation layer to be removed.
  78. */
  79. int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
  80. /**
  81. * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer.
  82. *
  83. * @cnfg: Pointer to a CAIF configuration object, created by
  84. * cfcnfg_create().
  85. * @adap_layer: Adaptation layer to be removed.
  86. */
  87. int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg,
  88. struct cflayer *adap_layer);
  89. /**
  90. * cfcnfg_release_adap_layer - Used by client to release the adaptation layer.
  91. *
  92. * @adap_layer: Adaptation layer.
  93. */
  94. void cfcnfg_release_adap_layer(struct cflayer *adap_layer);
  95. /**
  96. * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack.
  97. *
  98. * The adaptation Layer is where the interface to application or higher-level
  99. * driver functionality is implemented.
  100. *
  101. * @cnfg: Pointer to a CAIF configuration object, created by
  102. * cfcnfg_create().
  103. * @param: Link setup parameters.
  104. * @adap_layer: Specify the adaptation layer; the receive and
  105. * flow-control functions MUST be set in the structure.
  106. * @ifindex: Link layer interface index used for this connection.
  107. * @proto_head: Protocol head-space needed by CAIF protocol,
  108. * excluding link layer.
  109. * @proto_tail: Protocol tail-space needed by CAIF protocol,
  110. * excluding link layer.
  111. */
  112. int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg,
  113. struct cfctrl_link_param *param,
  114. struct cflayer *adap_layer,
  115. int *ifindex,
  116. int *proto_head,
  117. int *proto_tail);
  118. /**
  119. * cfcnfg_get_phyid() - Get physical ID, given type.
  120. * Returns one of the physical interfaces matching the given type.
  121. * Zero if no match is found.
  122. * @cnfg: Configuration object
  123. * @phy_pref: Caif Link Layer preference
  124. */
  125. struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg,
  126. enum cfcnfg_phy_preference phy_pref);
  127. /**
  128. * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer
  129. * @cnfg: Configuration object
  130. * @name: Name of the Physical Layer (Caif Link Layer)
  131. */
  132. int cfcnfg_get_named(struct cfcnfg *cnfg, char *name);
  133. #endif /* CFCNFG_H_ */