1 diff -urNp -x '*.orig' linux-4.9/include/uapi/linux/atm.h linux-4.9/include/uapi/linux/atm.h
2 --- linux-4.9/include/uapi/linux/atm.h 2016-12-11 20:17:54.000000000 +0100
3 +++ linux-4.9/include/uapi/linux/atm.h 2021-02-24 15:38:08.999744543 +0100
5 /* connection identifier range; socket must be
7 #define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos)
8 - /* Quality of Service setting */
9 + /* Quality of Service setting (with vbr support) */
10 #define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap)
11 /* Service Access Point */
12 #define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
14 #define ATM_NONE 0 /* no traffic */
18 +#define ATM_VBR_NRT 3
19 +#define ATM_VBR ATM_VBR_NRT /* for backward compatibility */
21 #define ATM_ANYCLASS 5 /* compatible with everything */
24 #define ATM_MAX_PCR -1 /* maximum available PCR */
26 @@ -139,6 +141,11 @@ struct atm_trafprm {
27 int min_pcr; /* minimum PCR in cells per second */
28 int max_cdv; /* maximum CDV in microseconds */
29 int max_sdu; /* maximum SDU in bytes */
31 + /* extra params for VBR */
32 + int scr; /* sustained rate in cells per second */
33 + int mbs; /* maximum burst size (MBS) in cells */
35 /* extra params for ABR */
36 unsigned int icr; /* Initial Cell Rate (24-bit) */
37 unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
38 @@ -238,4 +245,37 @@ struct atmif_sioc {
41 typedef unsigned short atm_backend_t;
42 +struct atm_trafprm_compat {
43 + unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */
44 + int max_pcr; /* maximum PCR in cells per second */
45 + int pcr; /* desired PCR in cells per second */
46 + int min_pcr; /* minimum PCR in cells per second */
47 + int max_cdv; /* maximum CDV in microseconds */
48 + int max_sdu; /* maximum SDU in bytes */
49 + /* extra params for ABR */
50 + unsigned int icr; /* Initial Cell Rate (24-bit) */
51 + unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
52 + unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */
53 + unsigned int rif : 4; /* Rate Increment Factor (4-bit) */
54 + unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */
55 + unsigned int nrm_pres :1; /* nrm present bit */
56 + unsigned int trm_pres :1; /* rm present bit */
57 + unsigned int adtf_pres :1; /* adtf present bit */
58 + unsigned int cdf_pres :1; /* cdf present bit*/
59 + unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */
60 + unsigned int trm :3; /* Time between forward RM cells (3-bit) */
61 + unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */
62 + unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */
63 + unsigned int spare :9; /* spare bits */
66 +struct atm_qos_compat {
67 + struct atm_trafprm_compat txtp; /* parameters in TX direction */
68 + struct atm_trafprm_compat rxtp __ATM_API_ALIGN;
69 + /* parameters in RX direction */
70 + unsigned char aal __ATM_API_ALIGN;
73 +#define SO_ATMQOS_COMPAT __SO_ENCODE(SOL_ATM,2,struct atm_qos_compat)
74 + /* Quality of Service setting (no vbr support) */
75 #endif /* _UAPI_LINUX_ATM_H */
76 diff -urNp -x '*.orig' linux-4.9/net/atm/common.c linux-4.9/net/atm/common.c
77 --- linux-4.9/net/atm/common.c 2016-12-11 20:17:54.000000000 +0100
78 +++ linux-4.9/net/atm/common.c 2021-02-24 15:38:08.999744543 +0100
79 @@ -752,6 +752,43 @@ int vcc_setsockopt(struct socket *sock,
83 + case SO_ATMQOS_COMPAT:
85 + struct atm_qos_compat qos_compat;
88 + if (copy_from_user(&qos_compat,optval,sizeof(qos_compat)))
91 + /* convert old atm_qos to new atm_qos */
92 + qos.aal = qos_compat.aal;
93 + qos.rxtp.traffic_class = qos_compat.rxtp.traffic_class;
94 + qos.rxtp.max_pcr = qos_compat.rxtp.max_pcr;
95 + qos.rxtp.pcr = qos_compat.rxtp.pcr;
96 + qos.rxtp.min_pcr = qos_compat.rxtp.min_pcr;
97 + qos.rxtp.max_cdv = qos_compat.rxtp.max_cdv;
98 + qos.rxtp.max_sdu = qos_compat.rxtp.max_sdu;
101 + qos.txtp.traffic_class = qos_compat.txtp.traffic_class;
102 + qos.txtp.max_pcr = qos_compat.txtp.max_pcr;
103 + qos.txtp.pcr = qos_compat.txtp.pcr;
104 + qos.txtp.min_pcr = qos_compat.txtp.min_pcr;
105 + qos.txtp.max_cdv = qos_compat.txtp.max_cdv;
106 + qos.txtp.max_sdu = qos_compat.txtp.max_sdu;
110 + error = check_qos(&qos);
111 + if (error) return error;
112 + if (sock->state == SS_CONNECTED)
113 + return atm_change_qos(vcc,&qos);
114 + if (sock->state != SS_UNCONNECTED)
117 + set_bit(ATM_VF_HASQOS,&vcc->flags);
123 @@ -800,6 +837,31 @@ int vcc_getsockopt(struct socket *sock,
127 + case SO_ATMQOS_COMPAT:
129 + struct atm_qos_compat qos_compat;
131 + if (!test_bit(ATM_VF_HASQOS,&vcc->flags))
134 + /* convert new atm_qos to old atm_qos */
135 + qos_compat.aal = vcc->qos.aal;
136 + qos_compat.rxtp.traffic_class = vcc->qos.rxtp.traffic_class;
137 + qos_compat.rxtp.max_pcr = vcc->qos.rxtp.max_pcr;
138 + qos_compat.rxtp.pcr = vcc->qos.rxtp.pcr;
139 + qos_compat.rxtp.min_pcr = vcc->qos.rxtp.min_pcr;
140 + qos_compat.rxtp.max_cdv = vcc->qos.rxtp.max_cdv;
141 + qos_compat.rxtp.max_sdu = vcc->qos.rxtp.max_sdu;
142 + qos_compat.txtp.traffic_class = vcc->qos.txtp.traffic_class;
143 + qos_compat.txtp.max_pcr = vcc->qos.txtp.max_pcr;
144 + qos_compat.txtp.pcr = vcc->qos.txtp.pcr;
145 + qos_compat.txtp.min_pcr = vcc->qos.txtp.min_pcr;
146 + qos_compat.txtp.max_cdv = vcc->qos.txtp.max_cdv;
147 + qos_compat.txtp.max_sdu = vcc->qos.txtp.max_sdu;
149 + return copy_to_user(optval,&qos_compat,sizeof(qos_compat)) ?
153 if (!test_bit(ATM_VF_HASQOS, &vcc->flags))