/* * Copyright (c) 2019 AVM GmbH . * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #ifdef CONFIG_GRX5 #define AVM_QOS_PORT_NUM 16 #define AVM_QOS_TC_NUM 16 #else #error "please define the appropriate HW resource limits" #endif struct avm_qos_stats { bool valid_bytes; bool valid_packets; uint64_t bytes; uint64_t packets; }; struct avm_qos_priv; bool avm_qos_netdev_supported(struct net_device *netdev); int avm_qos_add_hw_queue(struct net_device *netdev, uint32_t classid, uint32_t priority, uint32_t weight); int avm_qos_set_queue_len(struct net_device *netdev, uint32_t classid, uint32_t len); int avm_qos_remove_hw_queue(struct net_device *netdev, uint32_t classid, uint32_t priority, uint32_t weight); int avm_qos_flush_hw_queues(struct net_device *netdev); int avm_qos_reset_prio_shaper(struct net_device *netdev, uint32_t classid); int avm_qos_reset_port_shaper(struct net_device *netdev); int avm_qos_set_port_shaper(struct net_device *netdev, uint32_t pir, uint32_t cir, uint32_t pbs, uint32_t cbs, int8_t overhead, bool init, struct avm_qos_priv *priv); int avm_qos_set_prio_shaper(struct net_device *netdev, uint32_t classid, uint32_t pir, uint32_t cir, uint32_t pbs, uint32_t cbs, bool init, struct avm_qos_priv *priv); void avm_qos_set_default_queue(struct net_device *netdev, uint32_t classid); int avm_qos_get_prio_stats(struct net_device *netdev, uint32_t classid, struct avm_qos_stats *stats); struct avm_qos_priv *avm_qos_alloc(void); void avm_qos_free(struct avm_qos_priv *hw_priv);