1 /* 2 * Copyright (c) 2024 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 29 #ifndef _PKTSCHED_PKTSCHED_OPS_H_ 30 #define _PKTSCHED_PKTSCHED_OPS_H_ 31 32 #ifdef PRIVATE 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #include <net/classq/if_classq.h> 38 39 typedef int (*pktsched_setup_t)(struct ifclassq *ifcq, u_int32_t flags, 40 classq_pkt_type_t ptype); 41 typedef void (*pktsched_teardown_t)(struct ifclassq *ifcq); 42 typedef int (*pktsched_request_t)(struct ifclassq *ifcq, enum cqrq, void *arg); 43 typedef boolean_t (*pktsched_allow_dequeue_t)(struct ifclassq *ifcq); 44 typedef int (*pktsched_stats_t)(struct ifclassq *ifcq, uint8_t gid, 45 u_int32_t qid, struct if_ifclassq_stats *ifqs); 46 typedef int (*pktsched_enq_t)(struct ifclassq *ifq, classq_pkt_t *head, 47 classq_pkt_t *tail, uint32_t cnt, uint32_t bytes, boolean_t *pdrop); 48 typedef int (*pktsched_deq_t)(struct ifclassq *ifq, u_int32_t maxpktcnt, 49 u_int32_t maxbytecnt, classq_pkt_t *first_packet, classq_pkt_t *last_packet, 50 u_int32_t *retpktcnt, u_int32_t *retbytecnt, uint8_t grp_idx); 51 typedef int (*pktsched_deq_sc_t)(struct ifclassq *ifq, mbuf_svc_class_t svc, 52 u_int32_t maxpktcnt, u_int32_t maxbytecnt, classq_pkt_t *first_packet, 53 classq_pkt_t *last_packet, u_int32_t *retpktcnt, u_int32_t *retbytecnt, 54 uint8_t grp_idx); 55 56 typedef struct pktsched_ops { 57 uint8_t ps_id; 58 #define PKTSCHED_OPS_LOCKLESS 0x1 59 uint8_t ps_ops_flags; 60 pktsched_setup_t ps_setup; 61 pktsched_teardown_t ps_teardown; 62 pktsched_enq_t ps_enq; 63 pktsched_deq_t ps_deq; 64 pktsched_deq_sc_t ps_deq_sc; 65 pktsched_request_t ps_req; 66 pktsched_stats_t ps_stats; 67 pktsched_allow_dequeue_t ps_allow_dequeue; 68 LIST_ENTRY(pktsched_ops) ps_ops_link; 69 }pktsched_ops_t; 70 71 typedef LIST_HEAD(, pktsched_ops) pktsched_ops_list_t; 72 73 void 74 pktsched_ops_register(pktsched_ops_t *new_ops); 75 76 pktsched_ops_t * 77 pktsched_ops_find(uint8_t ps_id); 78 79 #ifdef __cplusplus 80 } 81 #endif 82 #endif /* PRIVATE */ 83 #endif /* _PKTSCHED_PKTSCHED_OPS_H_ */ 84