connectivity/networking/api/8021Qav.html · connectivity/networking/api/8021Qav.rst 공식 원문 ↗

Zephyr 3.7.0 · Connectivity · Networking API

IEEE 802.1Qav

Queue별 bandwidth와 idle slope를 설정해 Ethernet traffic fairness를 제어합니다.

Official pathconnectivity/networking/api/8021Qav.html
Source fileconnectivity/networking/api/8021Qav.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Ethernet driver가 제공하는 IEEE 802.1Qav hardware capability를 확인하고 net_mgmt request로 queue status, delta bandwidth와 idle slope를 설정합니다.

Standard

IEEE 802.1Qav-2009

Capability

ETHERNET_QAV

Control

net_mgmt()

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 3EBF0C228EAC522E7C5693DD999CB07C660D83EA44B28399BF67237156D9D089
.. _8021Qav:

IEEE 802.1Qav
#############

Overview
********

Credit-based shaping is an alternative scheduling algorithm used in
network schedulers to achieve fairness when sharing a limited network
resource.  Zephyr has support for configuring a credit-based shaper
described in the `IEEE 802.1Qav-2009 standard`_. Zephyr does not
implement the actual shaper; it only provides a way to configure the
shaper implemented by the Ethernet device driver.

Enabling 802.1Qav
*****************

To enable 802.1Qav shaper, the Ethernet device driver must declare
that it supports credit-based shaping. The Ethernet driver's capability
function must return ``ETHERNET_QAV`` value for this purpose. Typically
also priority queues ``ETHERNET_PRIORITY_QUEUES`` need to be supported.

.. code-block:: none

	static enum ethernet_hw_caps eth_get_capabilities(const struct device *dev)
	{
		ARG_UNUSED(dev);

		return ETHERNET_QAV | ETHERNET_PRIORITY_QUEUES |
		       ETHERNET_HW_VLAN | ETHERNET_LINK_10BASE_T |
		       ETHERNET_LINK_100BASE_T;
	}

See ``sam-e70-xplained`` board Ethernet driver
:zephyr_file:`drivers/ethernet/eth_sam_gmac.c` for an example.

Configuring 802.1Qav
********************

The application can configure the credit-based shaper like this:

.. code-block:: c

	#include <zephyr/net/net_if.h>
	#include <zephyr/net/ethernet.h>
	#include <zephyr/net/ethernet_mgmt.h>

	static void qav_set_status(struct net_if *iface,
	                           int queue_id, bool enable)
	{
		struct ethernet_req_params params;
		int ret;

		memset(&params, 0, sizeof(params));

		params.qav_param.queue_id = queue_id;
		params.qav_param.enabled = enable;
		params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_STATUS;

		/* Disable or enable Qav for a queue */
		ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM,
			       iface, &params,
			       sizeof(struct ethernet_req_params));
		if (ret) {
			LOG_ERR("Cannot %s Qav for queue %d for interface %p",
			        enable ? "enable" : "disable",
			        queue_id, iface);
		}
	}

	static void qav_set_bandwidth_and_slope(struct net_if *iface,
	                                        int queue_id,
	                                        unsigned int bandwidth,
	                                        unsigned int idle_slope)
	{
		struct ethernet_req_params params;
		int ret;

		memset(&params, 0, sizeof(params));

		params.qav_param.queue_id = queue_id;
		params.qav_param.delta_bandwidth = bandwidth;
		params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH;

		ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM,
			       iface, &params,
			       sizeof(struct ethernet_req_params));
		if (ret) {
			LOG_ERR("Cannot set Qav delta bandwidth %u for "
			        "queue %d for interface %p",
			        bandwidth, queue_id, iface);
		}

		params.qav_param.idle_slope = idle_slope;
		params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE;

		ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM,
			       iface, &params,
			       sizeof(struct ethernet_req_params));
		if (ret) {
			LOG_ERR("Cannot set Qav idle slope %u for "
			        "queue %d for interface %p",
			        idle_slope, queue_id, iface);
		}
	}

.. _IEEE 802.1Qav-2009 standard:
   https://standards.ieee.org/standard/802_1Qav-2009.html

Part 3

한국어 전문 번역

IEEE 802.1Qav

Overview

Credit-based shaping은 제한된 network resource를 공유할 때 fairness를 얻기 위해 network scheduler가 사용하는 대안 scheduling algorithm입니다. Zephyr는 IEEE 802.1Qav-2009 standard의 credit-based shaper 설정을 지원합니다.

Zephyr가 실제 shaper를 구현하는 것은 아닙니다. Ethernet device driver가 구현한 shaper를 application에서 설정할 방법만 제공합니다.

802.1Qav 활성화

802.1Qav shaper를 사용하려면 Ethernet device driver가 credit-based shaping capability를 선언해야 합니다. Driver capability function은 ETHERNET_QAV를 반환해야 하며 일반적으로 priority queue capability인 ETHERNET_PRIORITY_QUEUES도 지원해야 합니다.

static enum ethernet_hw_caps eth_get_capabilities(const struct device *dev)
{
	ARG_UNUSED(dev);

	return ETHERNET_QAV | ETHERNET_PRIORITY_QUEUES |
	       ETHERNET_HW_VLAN | ETHERNET_LINK_10BASE_T |
	       ETHERNET_LINK_100BASE_T;
}

sam-e70-xplained board Ethernet driver인 drivers/ethernet/eth_sam_gmac.c가 구현 예입니다.

802.1Qav 설정

Application은 NET_REQUEST_ETHERNET_SET_QAV_PARAM management request를 이용해 queue별 Qav status, delta bandwidth와 idle slope를 설정할 수 있습니다.

#include <zephyr/net/net_if.h>
#include <zephyr/net/ethernet.h>
#include <zephyr/net/ethernet_mgmt.h>

static void qav_set_status(struct net_if *iface,
                           int queue_id, bool enable)
{
	struct ethernet_req_params params;
	int ret;

	memset(&params, 0, sizeof(params));

	params.qav_param.queue_id = queue_id;
	params.qav_param.enabled = enable;
	params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_STATUS;

	/* Disable or enable Qav for a queue */
	ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM,
		       iface, &params,
		       sizeof(struct ethernet_req_params));
	if (ret) {
		LOG_ERR("Cannot %s Qav for queue %d for interface %p",
		        enable ? "enable" : "disable",
		        queue_id, iface);
	}
}

static void qav_set_bandwidth_and_slope(struct net_if *iface,
                                        int queue_id,
                                        unsigned int bandwidth,
                                        unsigned int idle_slope)
{
	struct ethernet_req_params params;
	int ret;

	memset(&params, 0, sizeof(params));

	params.qav_param.queue_id = queue_id;
	params.qav_param.delta_bandwidth = bandwidth;
	params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_DELTA_BANDWIDTH;

	ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM,
		       iface, &params,
		       sizeof(struct ethernet_req_params));
	if (ret) {
		LOG_ERR("Cannot set Qav delta bandwidth %u for "
		        "queue %d for interface %p",
		        bandwidth, queue_id, iface);
	}

	params.qav_param.idle_slope = idle_slope;
	params.qav_param.type = ETHERNET_QAV_PARAM_TYPE_IDLE_SLOPE;

	ret = net_mgmt(NET_REQUEST_ETHERNET_SET_QAV_PARAM,
		       iface, &params,
		       sizeof(struct ethernet_req_params));
	if (ret) {
		LOG_ERR("Cannot set Qav idle slope %u for "
		        "queue %d for interface %p",
		        idle_slope, queue_id, iface);
	}
}

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.