qos.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*********************************************************************
  2. *
  3. * Filename: qos.h
  4. * Version: 1.0
  5. * Description: Quality of Service definitions
  6. * Status: Experimental.
  7. * Author: Dag Brattli <dagb@cs.uit.no>
  8. * Created at: Fri Sep 19 23:21:09 1997
  9. * Modified at: Thu Dec 2 13:51:54 1999
  10. * Modified by: Dag Brattli <dagb@cs.uit.no>
  11. *
  12. * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  26. *
  27. ********************************************************************/
  28. #ifndef IRDA_QOS_H
  29. #define IRDA_QOS_H
  30. #include <linux/skbuff.h>
  31. #include <net/irda/parameters.h>
  32. #define PI_BAUD_RATE 0x01
  33. #define PI_MAX_TURN_TIME 0x82
  34. #define PI_DATA_SIZE 0x83
  35. #define PI_WINDOW_SIZE 0x84
  36. #define PI_ADD_BOFS 0x85
  37. #define PI_MIN_TURN_TIME 0x86
  38. #define PI_LINK_DISC 0x08
  39. #define IR_115200_MAX 0x3f
  40. /* Baud rates (first byte) */
  41. #define IR_2400 0x01
  42. #define IR_9600 0x02
  43. #define IR_19200 0x04
  44. #define IR_38400 0x08
  45. #define IR_57600 0x10
  46. #define IR_115200 0x20
  47. #define IR_576000 0x40
  48. #define IR_1152000 0x80
  49. /* Baud rates (second byte) */
  50. #define IR_4000000 0x01
  51. #define IR_16000000 0x02
  52. /* Quality of Service information */
  53. typedef struct {
  54. __u32 value;
  55. __u16 bits; /* LSB is first byte, MSB is second byte */
  56. } qos_value_t;
  57. struct qos_info {
  58. magic_t magic;
  59. qos_value_t baud_rate; /* IR_11520O | ... */
  60. qos_value_t max_turn_time;
  61. qos_value_t data_size;
  62. qos_value_t window_size;
  63. qos_value_t additional_bofs;
  64. qos_value_t min_turn_time;
  65. qos_value_t link_disc_time;
  66. qos_value_t power;
  67. };
  68. extern int sysctl_max_baud_rate;
  69. extern int sysctl_max_inactive_time;
  70. void irda_init_max_qos_capabilies(struct qos_info *qos);
  71. void irda_qos_compute_intersection(struct qos_info *, struct qos_info *);
  72. __u32 irlap_max_line_capacity(__u32 speed, __u32 max_turn_time);
  73. void irda_qos_bits_to_value(struct qos_info *qos);
  74. /* So simple, how could we not inline those two ?
  75. * Note : one byte is 10 bits if you include start and stop bits
  76. * Jean II */
  77. #define irlap_min_turn_time_in_bytes(speed, min_turn_time) ( \
  78. speed * min_turn_time / 10000000 \
  79. )
  80. #define irlap_xbofs_in_usec(speed, xbofs) ( \
  81. xbofs * 10000000 / speed \
  82. )
  83. #endif