auto
     %ˆÅÄƒN;Ã¿Æ »    %/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_VHOST_IOTLB_H
#define _LINUX_VHOST_IOTLB_H

#include <linux/interval_tree_generic.h>

struct vhost_iotlb_map {
	struct rb_node rb;
	struct list_head link;
	u64 start;
	u64 last;
	u64 size;
	u64 addr;
#define VHOST_MAP_RO 0x1
#define VHOST_MAP_WO 0x2
#define VHOST_MAP_RW 0x3
	u32 perm;
	u32 flags_padding;
	u64 __subtree_last;
	void *opaque;
};

#define VHOST_IOTLB_FLAG_RETIRE 0x1

struct vhost_iotlb {
	struct rb_root_cached root;
	struct list_head list;
	unsigned int limit;
	unsigned int nmaps;
	unsigned int flags;
};

int vhost_iotlb_add_range_ctx(struct vhost_iotlb *iotlb, u64 start, u64 last,
			      u64 addr, unsigned int perm, void *opaque);
int vhost_iotlb_add_range(struct vhost_iotlb *iotlb, u64 start, u64 last,
			  u64 addr, unsigned int perm);
void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last);

void vhost_iotlb_init(struct vhost_iotlb *iotlb, unsigned int limit,
		      unsigned int flags);
struct vhost_iotlb *vhost_iotlb_alloc(unsigned int limit, unsigned int flags);
void vhost_iotlb_free(struct vhost_iotlb *iotlb);
void vhost_iotlb_reset(struct vhost_iotlb *iotlb);

struct vhost_iotlb_map *
vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last);
struct vhost_iotlb_map *
vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last);

void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
			  struct vhost_iotlb_map *map);
#endif
     'ˆÅÄƒdM‹Ã¿Æ ´    '/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2024 Pengutronix, Oleksij Rempel <kernel@pengutronix.de> */

#ifndef __DSCP_H__
#define __DSCP_H__

/*
 * DSCP Pools and Codepoint Space Division:
 *
 * The Differentiated Services (Diffserv) architecture defines a method for
 * classifying and managing network traffic using the DS field in IPv4 and IPv6
 * packet headers. This field can carry one of 64 distinct DSCP (Differentiated
 * Services Code Point) values, which are divided into three pools based on
 * their Least Significant Bits (LSB) patterns and intended usage. Each pool has
 * a specific registration procedure for assigning DSCP values:
 *
 * Pool 1 (Standards Action Pool):
 * - Codepoint Space: xxxxx0
 *   This pool includes DSCP values ending in '0' (binary), allocated via
 *   Standards Action. It is intended for globally recognized traffic classes,
 *   ensuring interoperability across the internet. This pool encompasses
 *   well-known DSCP values such as CS0-CS7, AFxx, EF, and VOICE-ADMIT.
 *
 * Pool 2 (Experimental/Local Use Pool):
 * - Codepoint Space: xxxx11
 *   Reserved for DSCP values ending in '11' (binary), this pool is designated
 *   for Experimental or Local Use. It allows for private or temporary traffic
 *   marking schemes not intended for standardized global use, facilitating
 *   testing and network-specific configurations without impacting
 *   interoperability.
 *
 * Pool 3 (Preferential Standardization Pool):
 * - Codepoint Space: xxxx01
 *   Initially reserved for experimental or local use, this pool now serves as
 *   a secondary standardization resource should Pool 1 become exhausted. DSCP
 *   values ending in '01' (binary) are assigned via Standards Action, with a
 *   focus on adopting new, standardized traffic classes as the need arises.
 *
 * For pool updates see:
 * https://www.iana.org/assignments/dscp-registry/dscp-registry.xhtml
 */

/* Pool 1: Standardized DSCP values as per [RFC8126] */
#define DSCP_CS0 0		/* 000000, [RFC2474] */
/* CS0 is some times called default (DF) */
#define DSCP_DF 0		/* 000000, [RFC2474] */
#define DSCP_CS1 8		/* 001000, [RFC2474] */
#define DSCP_CS2 16		/* 010000, [RFC2474] */
#define DSCP_CS3 24		/* 011000, [RFC2474] */
#define DSCP_CS4 32		/* 100000, [RFC2474] */
#define DSCP_CS5 40		/* 101000, [RFC2474] */
#define DSCP_CS6 48		/* 110000, [RFC2474] */
#define DSCP_CS7 56		/* 111000, [RFC2474] */
#define DSCP_AF11 10		/* 001010, [RFC2597] */
#define DSCP_AF12 12		/* 001100, [RFC2597] */
#define DSCP_AF13 14		/* 001110, [RFC2597] */
#def