ocelot_police.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
  2. /* Microsemi Ocelot Switch driver
  3. *
  4. * Copyright (c) 2019 Microsemi Corporation
  5. */
  6. #ifndef _MSCC_OCELOT_POLICE_H_
  7. #define _MSCC_OCELOT_POLICE_H_
  8. #include "ocelot.h"
  9. #include <net/flow_offload.h>
  10. enum mscc_qos_rate_mode {
  11. MSCC_QOS_RATE_MODE_DISABLED, /* Policer/shaper disabled */
  12. MSCC_QOS_RATE_MODE_LINE, /* Measure line rate in kbps incl. IPG */
  13. MSCC_QOS_RATE_MODE_DATA, /* Measures data rate in kbps excl. IPG */
  14. MSCC_QOS_RATE_MODE_FRAME, /* Measures frame rate in fps */
  15. __MSCC_QOS_RATE_MODE_END,
  16. NUM_MSCC_QOS_RATE_MODE = __MSCC_QOS_RATE_MODE_END,
  17. MSCC_QOS_RATE_MODE_MAX = __MSCC_QOS_RATE_MODE_END - 1,
  18. };
  19. struct qos_policer_conf {
  20. enum mscc_qos_rate_mode mode;
  21. bool dlb; /* Enable DLB (dual leaky bucket mode */
  22. bool cf; /* Coupling flag (ignored in SLB mode) */
  23. u32 cir; /* CIR in kbps/fps (ignored in SLB mode) */
  24. u32 cbs; /* CBS in bytes/frames (ignored in SLB mode) */
  25. u32 pir; /* PIR in kbps/fps */
  26. u32 pbs; /* PBS in bytes/frames */
  27. u8 ipg; /* Size of IPG when MSCC_QOS_RATE_MODE_LINE is chosen */
  28. };
  29. int qos_policer_conf_set(struct ocelot *ocelot, u32 pol_ix,
  30. struct qos_policer_conf *conf);
  31. int ocelot_policer_validate(const struct flow_action *action,
  32. const struct flow_action_entry *a,
  33. struct netlink_ext_ack *extack);
  34. #endif /* _MSCC_OCELOT_POLICE_H_ */