Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  lan966x_tbf.c

  Sprache: C
 

// SPDX-License-Identifier: GPL-2.0+

#include "lan966x_main.h"

int lan966x_tbf_add(struct lan966x_port *port,
      struct tc_tbf_qopt_offload *qopt)
{
 struct lan966x *lan966x = port->lan966x;
 bool root = qopt->parent == TC_H_ROOT;
 u32 queue = 0;
 u32 cir, cbs;
 u32 se_idx;

 if (!root) {
  queue = TC_H_MIN(qopt->parent) - 1;
  if (queue >= NUM_PRIO_QUEUES)
   return -EOPNOTSUPP;
 }

 if (root)
  se_idx = SE_IDX_PORT + port->chip_port;
 else
  se_idx = SE_IDX_QUEUE + port->chip_port * NUM_PRIO_QUEUES + queue;

 cir = div_u64(qopt->replace_params.rate.rate_bytes_ps, 1000) * 8;
 cbs = qopt->replace_params.max_size;

 /* Rate unit is 100 kbps */
 cir = DIV_ROUND_UP(cir, 100);
 /* Avoid using zero rate */
 cir = cir ?: 1;
 /* Burst unit is 4kB */
 cbs = DIV_ROUND_UP(cbs, 4096);
 /* Avoid using zero burst */
 cbs = cbs ?: 1;

 /* Check that actually the result can be written */
 if (cir > GENMASK(150) ||
     cbs > GENMASK(60))
  return -EINVAL;

 lan_rmw(QSYS_SE_CFG_SE_AVB_ENA_SET(0) |
  QSYS_SE_CFG_SE_FRM_MODE_SET(1),
  QSYS_SE_CFG_SE_AVB_ENA |
  QSYS_SE_CFG_SE_FRM_MODE,
  lan966x, QSYS_SE_CFG(se_idx));

 lan_wr(QSYS_CIR_CFG_CIR_RATE_SET(cir) |
        QSYS_CIR_CFG_CIR_BURST_SET(cbs),
        lan966x, QSYS_CIR_CFG(se_idx));

 return 0;
}

int lan966x_tbf_del(struct lan966x_port *port,
      struct tc_tbf_qopt_offload *qopt)
{
 struct lan966x *lan966x = port->lan966x;
 bool root = qopt->parent == TC_H_ROOT;
 u32 queue = 0;
 u32 se_idx;

 if (!root) {
  queue = TC_H_MIN(qopt->parent) - 1;
  if (queue >= NUM_PRIO_QUEUES)
   return -EOPNOTSUPP;
 }

 if (root)
  se_idx = SE_IDX_PORT + port->chip_port;
 else
  se_idx = SE_IDX_QUEUE + port->chip_port * NUM_PRIO_QUEUES + queue;

 lan_rmw(QSYS_SE_CFG_SE_AVB_ENA_SET(0) |
  QSYS_SE_CFG_SE_FRM_MODE_SET(0),
  QSYS_SE_CFG_SE_AVB_ENA |
  QSYS_SE_CFG_SE_FRM_MODE,
  lan966x, QSYS_SE_CFG(se_idx));

 lan_wr(QSYS_CIR_CFG_CIR_RATE_SET(0) |
        QSYS_CIR_CFG_CIR_BURST_SET(0),
        lan966x, QSYS_CIR_CFG(se_idx));

 return 0;
}

Messung V0.5 in Prozent
C=95 H=95 G=94

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-06-07) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002