]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-atm-vbr.patch
- up to 5.11.8
[packages/kernel.git] / kernel-atm-vbr.patch
1 diff -urN linux-5.9/net.org/atm/common.c linux-5.9/net/atm/common.c
2 --- linux-5.9/net.org/atm/common.c      2020-10-11 23:15:50.000000000 +0200
3 +++ linux-5.9/net/atm/common.c  2020-11-03 13:27:25.545142305 +0100
4 @@ -756,6 +756,43 @@
5  
6         vcc = ATM_SD(sock);
7         switch (optname) {
8 +               case SO_ATMQOS_COMPAT:
9 +                       {
10 +                               struct atm_qos_compat qos_compat;
11 +                               struct atm_qos qos;
12 +
13 +                               if (copy_from_sockptr(&qos_compat,optval,sizeof(qos_compat)))
14 +                                       return -EFAULT;
15 +
16 +                               /* convert old atm_qos to new atm_qos */
17 +                               qos.aal = qos_compat.aal;
18 +                               qos.rxtp.traffic_class = qos_compat.rxtp.traffic_class;
19 +                               qos.rxtp.max_pcr = qos_compat.rxtp.max_pcr;
20 +                               qos.rxtp.pcr = qos_compat.rxtp.pcr;
21 +                               qos.rxtp.min_pcr = qos_compat.rxtp.min_pcr;
22 +                               qos.rxtp.max_cdv = qos_compat.rxtp.max_cdv;
23 +                               qos.rxtp.max_sdu = qos_compat.rxtp.max_sdu;
24 +                               qos.rxtp.scr = 0;
25 +                               qos.rxtp.mbs = 0;
26 +                               qos.txtp.traffic_class = qos_compat.txtp.traffic_class;
27 +                               qos.txtp.max_pcr = qos_compat.txtp.max_pcr;
28 +                               qos.txtp.pcr = qos_compat.txtp.pcr;
29 +                               qos.txtp.min_pcr = qos_compat.txtp.min_pcr;
30 +                               qos.txtp.max_cdv = qos_compat.txtp.max_cdv;
31 +                               qos.txtp.max_sdu = qos_compat.txtp.max_sdu;
32 +                               qos.txtp.scr = 0;
33 +                               qos.txtp.mbs = 0;
34 +
35 +                               error = check_qos(&qos);
36 +                               if (error) return error;
37 +                               if (sock->state == SS_CONNECTED)
38 +                                       return atm_change_qos(vcc,&qos);
39 +                               if (sock->state != SS_UNCONNECTED)
40 +                                       return -EBADFD;
41 +                               vcc->qos = qos;
42 +                               set_bit(ATM_VF_HASQOS,&vcc->flags);
43 +                               return 0;
44 +                       }
45         case SO_ATMQOS:
46         {
47                 struct atm_qos qos;
48 @@ -799,6 +836,31 @@
49  
50         vcc = ATM_SD(sock);
51         switch (optname) {
52 +               case SO_ATMQOS_COMPAT:
53 +                       {
54 +                               struct atm_qos_compat qos_compat;
55 +
56 +                               if (!test_bit(ATM_VF_HASQOS,&vcc->flags))
57 +                                       return -EINVAL;
58 +
59 +                               /* convert new atm_qos to old atm_qos */
60 +                               qos_compat.aal = vcc->qos.aal;
61 +                               qos_compat.rxtp.traffic_class = vcc->qos.rxtp.traffic_class;
62 +                               qos_compat.rxtp.max_pcr = vcc->qos.rxtp.max_pcr;
63 +                               qos_compat.rxtp.pcr = vcc->qos.rxtp.pcr;
64 +                               qos_compat.rxtp.min_pcr = vcc->qos.rxtp.min_pcr;
65 +                               qos_compat.rxtp.max_cdv = vcc->qos.rxtp.max_cdv;
66 +                               qos_compat.rxtp.max_sdu = vcc->qos.rxtp.max_sdu;
67 +                               qos_compat.txtp.traffic_class = vcc->qos.txtp.traffic_class;
68 +                               qos_compat.txtp.max_pcr = vcc->qos.txtp.max_pcr;
69 +                               qos_compat.txtp.pcr = vcc->qos.txtp.pcr;
70 +                               qos_compat.txtp.min_pcr = vcc->qos.txtp.min_pcr;
71 +                               qos_compat.txtp.max_cdv = vcc->qos.txtp.max_cdv;
72 +                               qos_compat.txtp.max_sdu = vcc->qos.txtp.max_sdu;
73 +
74 +                               return copy_to_user(optval,&qos_compat,sizeof(qos_compat)) ?
75 +                                   -EFAULT : 0;
76 +                       }
77         case SO_ATMQOS:
78                 if (!test_bit(ATM_VF_HASQOS, &vcc->flags))
79                         return -EINVAL;
80 diff -urN linux-5.9/include.org/uapi/linux/atm.h linux-5.9/include/uapi/linux/atm.h
81 --- linux-5.9/include.org/uapi/linux/atm.h      2020-10-11 23:15:50.000000000 +0200
82 +++ linux-5.9/include/uapi/linux/atm.h  2020-11-03 13:27:25.545142305 +0100
83 @@ -71,7 +71,7 @@
84                             /* connection identifier range; socket must be
85                                bound or connected */
86  #define SO_ATMQOS      __SO_ENCODE(SOL_ATM,2,struct atm_qos)
87 -                           /* Quality of Service setting */
88 +                           /* Quality of Service setting (with vbr support) */
89  #define SO_ATMSAP      __SO_ENCODE(SOL_ATM,3,struct atm_sap)
90                             /* Service Access Point */
91  #define SO_ATMPVC      __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
92 @@ -127,9 +127,11 @@
93  #define ATM_NONE       0               /* no traffic */
94  #define ATM_UBR                1
95  #define ATM_CBR                2
96 -#define ATM_VBR                3
97 +#define ATM_VBR_NRT    3
98 +#define ATM_VBR                ATM_VBR_NRT     /* for backward compatibility */
99  #define ATM_ABR                4
100  #define ATM_ANYCLASS   5               /* compatible with everything */
101 +#define ATM_VBR_RT     6
102  
103  #define ATM_MAX_PCR    -1              /* maximum available PCR */
104  
105 @@ -140,6 +142,11 @@
106         int             min_pcr;        /* minimum PCR in cells per second */
107         int             max_cdv;        /* maximum CDV in microseconds */
108         int             max_sdu;        /* maximum SDU in bytes */
109 +
110 +       /* extra params for VBR */
111 +       int             scr;            /* sustained rate in cells per second */
112 +       int             mbs;            /* maximum burst size (MBS) in cells */
113 +
114          /* extra params for ABR */
115          unsigned int   icr;            /* Initial Cell Rate (24-bit) */
116          unsigned int   tbe;            /* Transient Buffer Exposure (24-bit) */ 
117 @@ -239,4 +246,37 @@
118  
119  
120  typedef unsigned short atm_backend_t;
121 +struct atm_trafprm_compat {
122 +       unsigned char   traffic_class;  /* traffic class (ATM_UBR, ...) */
123 +       int             max_pcr;        /* maximum PCR in cells per second */
124 +       int             pcr;            /* desired PCR in cells per second */
125 +       int             min_pcr;        /* minimum PCR in cells per second */
126 +       int             max_cdv;        /* maximum CDV in microseconds */
127 +       int             max_sdu;        /* maximum SDU in bytes */
128 +        /* extra params for ABR */
129 +        unsigned int   icr;            /* Initial Cell Rate (24-bit) */
130 +        unsigned int   tbe;            /* Transient Buffer Exposure (24-bit) */ 
131 +        unsigned int   frtt : 24;      /* Fixed Round Trip Time (24-bit) */
132 +        unsigned int   rif  : 4;       /* Rate Increment Factor (4-bit) */
133 +        unsigned int   rdf  : 4;       /* Rate Decrease Factor (4-bit) */
134 +        unsigned int nrm_pres  :1;      /* nrm present bit */
135 +        unsigned int trm_pres  :1;             /* rm present bit */
136 +        unsigned int adtf_pres :1;             /* adtf present bit */
137 +        unsigned int cdf_pres  :1;     /* cdf present bit*/
138 +        unsigned int nrm       :3;             /* Max # of Cells for each forward RM cell (3-bit) */
139 +        unsigned int trm       :3;     /* Time between forward RM cells (3-bit) */    
140 +       unsigned int adtf      :10;     /* ACR Decrease Time Factor (10-bit) */
141 +       unsigned int cdf       :3;      /* Cutoff Decrease Factor (3-bit) */
142 +        unsigned int spare     :9;      /* spare bits */ 
143 +};
144 +
145 +struct atm_qos_compat {
146 +       struct atm_trafprm_compat txtp; /* parameters in TX direction */
147 +       struct atm_trafprm_compat rxtp __ATM_API_ALIGN;
148 +                                       /* parameters in RX direction */
149 +       unsigned char aal __ATM_API_ALIGN;
150 +};
151 +
152 +#define SO_ATMQOS_COMPAT __SO_ENCODE(SOL_ATM,2,struct atm_qos_compat)
153 +                           /* Quality of Service setting (no vbr support) */
154  #endif /* _UAPI_LINUX_ATM_H */
This page took 0.041064 seconds and 3 git commands to generate.