linux/net/core/ieee8021q_helpers.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2024 Pengutronix, Oleksij Rempel <[email protected]>

#include <linux/array_size.h>
#include <linux/printk.h>
#include <linux/types.h>
#include <net/dscp.h>
#include <net/ieee8021q.h>

/* The following arrays map Traffic Types (TT) to traffic classes (TC) for
 * different number of queues as shown in the example provided by
 * IEEE 802.1Q-2022 in Annex I "I.3 Traffic type to traffic class mapping" and
 * Table I-1 "Traffic type to traffic class mapping".
 */
static const u8 ieee8021q_8queue_tt_tc_map[] =;

static const u8 ieee8021q_7queue_tt_tc_map[] =;

static const u8 ieee8021q_6queue_tt_tc_map[] =;

static const u8 ieee8021q_5queue_tt_tc_map[] =;

static const u8 ieee8021q_4queue_tt_tc_map[] =;

static const u8 ieee8021q_3queue_tt_tc_map[] =;

static const u8 ieee8021q_2queue_tt_tc_map[] =;

static const u8 ieee8021q_1queue_tt_tc_map[] =;

/**
 * ieee8021q_tt_to_tc - Map IEEE 802.1Q Traffic Type to Traffic Class
 * @tt: IEEE 802.1Q Traffic Type
 * @num_queues: Number of queues
 *
 * This function maps an IEEE 802.1Q Traffic Type to a Traffic Class (TC) based
 * on the number of queues configured on the NIC. The mapping is based on the
 * example provided by IEEE 802.1Q-2022 in Annex I "I.3 Traffic type to traffic
 * class mapping" and Table I-1 "Traffic type to traffic class mapping".
 *
 * Return: Traffic Class corresponding to the given Traffic Type or negative
 * value in case of error.
 */
int ieee8021q_tt_to_tc(enum ieee8021q_traffic_type tt, unsigned int num_queues)
{}
EXPORT_SYMBOL_GPL();

/**
 * ietf_dscp_to_ieee8021q_tt - Map IETF DSCP to IEEE 802.1Q Traffic Type
 * @dscp: IETF DSCP value
 *
 * This function maps an IETF DSCP value to an IEEE 802.1Q Traffic Type (TT).
 * Since there is no corresponding mapping between DSCP and IEEE 802.1Q Traffic
 * Type, this function is inspired by the RFC8325 documentation which describe
 * the mapping between DSCP and 802.11 User Priority (UP) values.
 *
 * Return: IEEE 802.1Q Traffic Type corresponding to the given DSCP value
 */
int ietf_dscp_to_ieee8021q_tt(u8 dscp)
{}
EXPORT_SYMBOL_GPL();