difos/package/kernel/lantiq/vrx518_tc/patches/101-dcdp-atm_tc-drop-extra-qos-classes.patch
Sergey Ryazanov 6d6dc3a3c9 ipq40xx: fix compatibility with linux-atm tools
atm_qos struct should be the same both for user and kernel spaces. Via
the __SO_ENCODE() macro it is used to define the SO_ATMQOS socket IOC.

During the VRX518 support introduction, the atm_trafprm sturct nested
into the atm_qos stucture was update with newer fields that are
referenced by the ATM TC layer of the VRX518 TC driver. These new fields
are intended to communicate information for extra traffic classes
supported by the driver. But we are still using vanilla kernel headers
to build the toolchain. Due to the atm.h header incoherency br2684ctl
from linux-atm tools is incapable to configure the ATM bridge netdev:

  br2684ctl: Interface "dsl0" created sucessfully
  br2684ctl: Communicating over ATM 0.1.2, encapsulation: LLC
  br2684ctl: setsockopt SO_ATMQOS 22 <-- EINVAL errno
  br2684ctl: Fatal: failed to connect on socket; File descriptor in bad state

There are two options to fix this incoherency. (a) update the header
file in the toolchain to build linux-atm against updated atm_trafprm and
atm_qos structures, or (b) revert atm_trafprm changes.

Since there are no actual users of the extra ATM QoS traffic classes,
just drop these extra traffic classes from vrx518_tc ATM TC layer and
drop the kernel patch updating atm.h.

Besides fixing the compatibility with linux-atm tools, removing the
kernel patch should simplify kernel updates removing unneeded burden of
maintenance.

Run tested with FRITZ!Box 7530 with disabled extra traffic classes and
then removed them entirely before the submission.

CC: John Crispin <john@phrozen.org>
Fixes: cfd42a0098 ("ipq40xx: add Intel/Lantiq ATM hacks")
Suggested-by: Andre Heider <a.heider@gmail.com>
Reported-and-tested-by: nebibigon93@yandex.ru
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Link: https://patchwork.ozlabs.org/project/openwrt/patch/20250122222654.21833-4-ryazanov.s.a@gmail.com/
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-01-23 20:27:49 +01:00

144 lines
4.5 KiB
Diff

Extra ATM traffic classes requires atm_qos struct extension and a set of
new defines. What itself requires atm.h updates both in the kernel and
in the toolchain. On another hand we do not have any real users of these
traffic classes.
In absence of real user there are no benefits to support this
functionality. There is only the burden of maintenance of extra patches
all around the building framework. So just drop these extra QoS traffic
classes in order to facilitate maintenance and avoid side effects like
breaking compatibility with existing userspace tools like linux-atm.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
--
--- a/dcdp/atm_tc.c
+++ b/dcdp/atm_tc.c
@@ -463,34 +463,9 @@ static void set_qsb(struct atm_priv *pri
/* Weighted Fair Queueing Factor (WFQF) */
switch (qos->txtp.traffic_class) {
case ATM_CBR:
- case ATM_VBR_RT:
/* real time queue gets weighted fair queueing bypass */
q_parm_tbl.bit.wfqf = 0;
break;
- case ATM_VBR_NRT:
- case ATM_UBR_PLUS:
- /* WFQF calculation here is based on virtual cell rates,
- to reduce granularity for high rates
- */
- /* WFQF is maximum cell rate / garenteed cell rate */
- /* wfqf = qsb_minimum_cell_rate * QSB_WFQ_NONUBR_MAX /
- requested_minimum_peak_cell_rate
- */
- if (qos->txtp.min_pcr == 0)
- q_parm_tbl.bit.wfqf = QSB_WFQ_NONUBR_MAX;
- else {
- tmp = QSB_GCR_MIN * QSB_WFQ_NONUBR_MAX /
- qos->txtp.min_pcr;
- if (tmp == 0)
- q_parm_tbl.bit.wfqf = 1;
- else if (tmp > QSB_WFQ_NONUBR_MAX)
- q_parm_tbl.bit.wfqf
- = QSB_WFQ_NONUBR_MAX;
- else
- q_parm_tbl.bit.wfqf = tmp;
- }
- break;
-
case ATM_UBR:
default:
q_parm_tbl.bit.wfqf = QSB_WFQ_UBR_BYPASS;
@@ -498,42 +473,9 @@ static void set_qsb(struct atm_priv *pri
}
/* Sustained Cell Rate (SCR) Leaky Bucket Shaper VBR.0/VBR.1 */
- if (qos->txtp.traffic_class == ATM_VBR_RT ||
- qos->txtp.traffic_class == ATM_VBR_NRT) {
- if (qos->txtp.scr == 0) {
- /* disable shaper */
- q_vbr_parm_tbl.bit.taus = 0;
- q_vbr_parm_tbl.bit.ts = 0;
- } else {
- /* Cell Loss Priority (CLP) */
- if ((vcc->atm_options & ATM_ATMOPT_CLP))
- /* CLP1 */
- q_parm_tbl.bit.vbr = 1;
- else
- /* CLP0 */
- q_parm_tbl.bit.vbr = 0;
- /* Rate Shaper Parameter (TS) and
- Burst Tolerance Parameter for SCR (tauS)
- */
- tmp = ((qsb_clk * param->qsb_tstep) >> 5) /
- qos->txtp.scr + 1;
- q_vbr_parm_tbl.bit.ts
- = tmp > QSB_TP_TS_MAX ? QSB_TP_TS_MAX : tmp;
- tmp = (qos->txtp.mbs - 1) *
- (q_vbr_parm_tbl.bit.ts -
- q_parm_tbl.bit.tp) / 64;
- if (tmp == 0)
- q_vbr_parm_tbl.bit.taus = 1;
- else if (tmp > QSB_TAUS_MAX)
- q_vbr_parm_tbl.bit.taus
- = QSB_TAUS_MAX;
- else
- q_vbr_parm_tbl.bit.taus = tmp;
- }
- } else {
- q_vbr_parm_tbl.bit.taus = 0;
- q_vbr_parm_tbl.bit.ts = 0;
- }
+ /* NB: shaper disabled since there no user interface to activate it */
+ q_vbr_parm_tbl.bit.taus = 0;
+ q_vbr_parm_tbl.bit.ts = 0;
/* Queue Parameter Table (QPT) */
tc_w32(QSB_QPT_SET_MASK, QSB_RTM);
@@ -1064,15 +1006,6 @@ static int ppe_open(struct atm_vcc *vcc)
/* check bandwidth */
if ((vcc->qos.txtp.traffic_class == ATM_CBR &&
vcc->qos.txtp.max_pcr >
- (port->tx_max_cell_rate - port->tx_used_cell_rate))
- || (vcc->qos.txtp.traffic_class == ATM_VBR_RT &&
- vcc->qos.txtp.max_pcr >
- (port->tx_max_cell_rate - port->tx_used_cell_rate))
- || (vcc->qos.txtp.traffic_class == ATM_VBR_NRT &&
- vcc->qos.txtp.scr >
- (port->tx_max_cell_rate - port->tx_used_cell_rate))
- || (vcc->qos.txtp.traffic_class == ATM_UBR_PLUS &&
- vcc->qos.txtp.min_pcr >
(port->tx_max_cell_rate - port->tx_used_cell_rate))) {
tc_dbg(priv->tc_priv, MSG_INIT, "exceed TX line rate\n");
return -EINVAL;
@@ -1128,15 +1061,8 @@ static int ppe_open(struct atm_vcc *vcc)
/* reserve bandwidth */
switch (vcc->qos.txtp.traffic_class) {
case ATM_CBR:
- case ATM_VBR_RT:
port->tx_used_cell_rate += vcc->qos.txtp.max_pcr;
break;
- case ATM_VBR_NRT:
- port->tx_used_cell_rate += vcc->qos.txtp.scr;
- break;
- case ATM_UBR_PLUS:
- port->tx_used_cell_rate += vcc->qos.txtp.min_pcr;
- break;
}
/* update atm_vcc structure */
@@ -1222,15 +1148,8 @@ static void ppe_close(struct atm_vcc *vc
/* release bandwidth */
switch (vcc->qos.txtp.traffic_class) {
case ATM_CBR:
- case ATM_VBR_RT:
port->tx_used_cell_rate -= vcc->qos.txtp.max_pcr;
break;
- case ATM_VBR_NRT:
- port->tx_used_cell_rate -= vcc->qos.txtp.scr;
- break;
- case ATM_UBR_PLUS:
- port->tx_used_cell_rate -= vcc->qos.txtp.min_pcr;
- break;
}
/* idle for a while to let parallel operation finish */