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
8 + case SO_ATMQOS_COMPAT:
10 + struct atm_qos_compat qos_compat;
13 + if (copy_from_sockptr(&qos_compat,optval,sizeof(qos_compat)))
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;
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;
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)
42 + set_bit(ATM_VF_HASQOS,&vcc->flags);
52 + case SO_ATMQOS_COMPAT:
54 + struct atm_qos_compat qos_compat;
56 + if (!test_bit(ATM_VF_HASQOS,&vcc->flags))
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;
74 + return copy_to_user(optval,&qos_compat,sizeof(qos_compat)) ?
78 if (!test_bit(ATM_VF_HASQOS, &vcc->flags))
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
84 /* connection identifier range; socket must be
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)
93 #define ATM_NONE 0 /* no traffic */
97 +#define ATM_VBR_NRT 3
98 +#define ATM_VBR ATM_VBR_NRT /* for backward compatibility */
100 #define ATM_ANYCLASS 5 /* compatible with everything */
101 +#define ATM_VBR_RT 6
103 #define ATM_MAX_PCR -1 /* maximum available PCR */
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 */
110 + /* extra params for VBR */
111 + int scr; /* sustained rate in cells per second */
112 + int mbs; /* maximum burst size (MBS) in cells */
114 /* extra params for ABR */
115 unsigned int icr; /* Initial Cell Rate (24-bit) */
116 unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
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 */
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;
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 */