]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-atm-vbr.patch
- unconditional noarch packages
[packages/kernel.git] / kernel-atm-vbr.patch
CommitLineData
e8791d4f
AM
1diff -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
4@@ -70,7 +70,7 @@
2380c486
JR
5 /* connection identifier range; socket must be
6 bound or connected */
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)
e8791d4f 13@@ -126,9 +126,11 @@
2380c486
JR
14 #define ATM_NONE 0 /* no traffic */
15 #define ATM_UBR 1
16 #define ATM_CBR 2
17-#define ATM_VBR 3
18+#define ATM_VBR_NRT 3
19+#define ATM_VBR ATM_VBR_NRT /* for backward compatibility */
20 #define ATM_ABR 4
21 #define ATM_ANYCLASS 5 /* compatible with everything */
22+#define ATM_VBR_RT 6
23
24 #define ATM_MAX_PCR -1 /* maximum available PCR */
25
e8791d4f 26@@ -139,6 +141,11 @@ struct atm_trafprm {
2380c486
JR
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 */
30+
31+ /* extra params for VBR */
32+ int scr; /* sustained rate in cells per second */
33+ int mbs; /* maximum burst size (MBS) in cells */
34+
35 /* extra params for ABR */
36 unsigned int icr; /* Initial Cell Rate (24-bit) */
37 unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
e8791d4f
AM
38@@ -238,4 +245,37 @@ struct atmif_sioc {
39
2380c486
JR
40
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 */
64+};
65+
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;
71+};
72+
73+#define SO_ATMQOS_COMPAT __SO_ENCODE(SOL_ATM,2,struct atm_qos_compat)
74+ /* Quality of Service setting (no vbr support) */
537831f9 75 #endif /* _UAPI_LINUX_ATM_H */
e8791d4f
AM
76diff -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,
2380c486
JR
80
81 vcc = ATM_SD(sock);
82 switch (optname) {
83+ case SO_ATMQOS_COMPAT:
84+ {
85+ struct atm_qos_compat qos_compat;
86+ struct atm_qos qos;
87+
88+ if (copy_from_user(&qos_compat,optval,sizeof(qos_compat)))
89+ return -EFAULT;
90+
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;
99+ qos.rxtp.scr = 0;
100+ qos.rxtp.mbs = 0;
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;
107+ qos.txtp.scr = 0;
108+ qos.txtp.mbs = 0;
109+
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)
115+ return -EBADFD;
116+ vcc->qos = qos;
117+ set_bit(ATM_VF_HASQOS,&vcc->flags);
118+ return 0;
119+ }
d031c9d6 120 case SO_ATMQOS:
121 {
122 struct atm_qos qos;
e8791d4f 123@@ -800,6 +837,31 @@ int vcc_getsockopt(struct socket *sock,
2380c486
JR
124
125 vcc = ATM_SD(sock);
126 switch (optname) {
127+ case SO_ATMQOS_COMPAT:
128+ {
129+ struct atm_qos_compat qos_compat;
130+
131+ if (!test_bit(ATM_VF_HASQOS,&vcc->flags))
132+ return -EINVAL;
133+
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;
148+
149+ return copy_to_user(optval,&qos_compat,sizeof(qos_compat)) ?
150+ -EFAULT : 0;
151+ }
d031c9d6 152 case SO_ATMQOS:
e8791d4f 153 if (!test_bit(ATM_VF_HASQOS, &vcc->flags))
d031c9d6 154 return -EINVAL;
This page took 0.105853 seconds and 4 git commands to generate.