cfcnfg.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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() - Get the CAIF configuration object given network.
  45. * @net: Network for the CAIF configuration object.
  46. */
  47. struct cfcnfg *get_cfcnfg(struct net *net);
  48. /**
  49. * cfcnfg_create() - Create the CAIF configuration object.
  50. */
  51. struct cfcnfg *cfcnfg_create(void);
  52. /**
  53. * cfcnfg_remove() - Remove the CFCNFG object
  54. * @cfg: config object
  55. */
  56. void cfcnfg_remove(struct cfcnfg *cfg);
  57. /**
  58. * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack.
  59. * @cnfg: Pointer to a CAIF configuration object, created by
  60. * cfcnfg_create().
  61. * @phy_type: Specifies the type of physical interface, e.g.
  62. * CFPHYTYPE_FRAG.
  63. * @dev: Pointer to link layer device
  64. * @phy_layer: Specify the physical layer. The transmit function
  65. * MUST be set in the structure.
  66. * @pref: The phy (link layer) preference.
  67. * @fcs: Specify if checksum is used in CAIF Framing Layer.
  68. * @stx: Specify if Start Of Frame eXtention is used.
  69. */
  70. void
  71. cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type,
  72. struct net_device *dev, struct cflayer *phy_layer,
  73. enum cfcnfg_phy_preference pref,
  74. bool fcs, bool stx);
  75. /**
  76. * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack.
  77. *
  78. * @cnfg: Pointer to a CAIF configuration object, created by
  79. * cfcnfg_create().
  80. * @phy_layer: Adaptation layer to be removed.
  81. */
  82. int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer);
  83. /**
  84. * cfcnfg_set_phy_state() - Set the state of the physical interface device.
  85. * @cnfg: Configuration object
  86. * @phy_layer: Physical Layer representation
  87. * @up: State of device
  88. */
  89. int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer,
  90. bool up);
  91. #endif /* CFCNFG_H_ */