p4 spec v1.1 (1185620), страница 17

Файл №1185620 p4 spec v1.1 (Домашнее задание) 17 страницаp4 spec v1.1 (1185620) страница 172020-08-25СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 17)

. . // Reads if mtag valid; drop or copy to CPU}////////////////////////////////////////////////////////////////// identify_port table://Check if up or down facing port as programmed at run time.////////////////////////////////////////////////////////////////table identify_port {. . . // Read ingress_port; call common_set_port_type.}////////////////////////////////////////////////////////////////// Actions to copy the proper field from mtag into the egress specaction use_mtag_up1() { // This is actually never used on agg switchesmodify_field(standard_metadata.egress_spec, mtag.up1);}action use_mtag_up2() {modify_field(standard_metadata.egress_spec, mtag.up2);}action use_mtag_down1() {modify_field(standard_metadata.egress_spec, mtag.down1);}action use_mtag_down2() {modify_field(standard_metadata.egress_spec, mtag.down2);10717.6 Examples17 APPENDICES}// Table to select output spec from mtagtable select_output_port {reads {local_metadata.port_type: exact; // Up, down, level 1 or 2.}actions {use_mtag_up1;use_mtag_up2;use_mtag_down1;use_mtag_down2;// If port type is not recognized, previous policy appliedno_op;}max_size : 4; // Only need one entry per port type}////////////////////////////////////////////////////////////////// Control function definitions////////////////////////////////////////////////////////////////// The ingress control functioncontrol ingress {// Verify mTag state and port are consistentapply(check_mtag);apply(identify_port);apply(select_output_port);}// No egress function used in the mtag-agg example.The following is an example header file that might be used with the mtag exampleabove.

This shows the following:• Type definitions for port types (mtag_port_type_t) meter levels(mtag_meter_levels_t) and a table entry handle (entry_handle_t).• An example function to add an entry to the identify_port table,table_identify_port_add_with_set_port_type. The action to use with the entry is indicated at the end of the function name: set_port_type.• Functions to set the default action for the identify_port table:10817.6 Examples17 APPENDICEStable_indentify_port_default_common_drop_pkt andtable_indentify_port_default_common_set_port_type.• A function to add an entry to the mTag table:table_mTag_table_add_with_add_mTag• A function to get a counter associated with the meter table:counter_per_color_drops_get./*** Run time header file example for CCR mTag example*/#ifndef MTAG_RUN_TIME_H#define MTAG_RUN_TIME_H/*** @brief Port types required for the mtag example** Indicates the port types for both edge and aggregation* switches.*/typedef enum mtag_port_type_e {MTAG_PORT_UNKNOWN,MTAG_PORT_LOCAL,MTAG_PORT_EDGE_TO_AG1,MTAG_PORT_AG1_TO_AG2,MTAG_PORT_AG2_TO_AG1,MTAG_PORT_AG1_TO_EDGE,MTAG_PORT_ILLEGAL,/* Uninitialized port type *//* Locally switch port for edge *//* Up1: edge to agg layer 1 *//* Up2: Agg layer 1 to agg layer 2 *//* Down2: Agg layer 2 to agg layer 1 *//* Down1: Agg layer 1 to edge *//* Illegal value */MTAG_PORT_COUNT} mtag_port_type_t;/*** @brief Colors for metering** The edge switch supports metering from local ports up to the* aggregation layer.*/typedef enum mtag_meter_levels_e {10917.6 Examples17 APPENDICESMTAG_METER_COLOR_GREEN,/* No congestion indicated */MTAG_METER_COLOR_YELLOW, /* Above low water mark */MTAG_METER_COLOR_RED,/* Above high water mark */MTAG_METER_COUNT} mtag_meter_levels_t;typedef uint32_t entry_handle_t;/* mTag table *//*** @brief Add an entry to the edge identify port table* @param ingress_port The port number being identified* @param port_type The port type associated with the port* @param ingress_error The value to use for the error indication*/entry_handle_t table_identify_port_add_with_set_port_type(uint32_t ingress_port,mtag_port_type_t port_type,uint8_t ingress_error);/*** @brief Set the default action of the identify port* table to send the packet to the CPU.* @param do_copy Set to 1 if should send copy to the CPU* @param cpu_code If do_copy, this is the code used* @param bad_packet Set to 1 to flag packet as bad** This allows the programmer to say: If port type is not* set, this is an error; let me see the packet.** Also allows just a drop of the packet.*/int table_indentify_port_default_common_drop_pkt(uint8_t do_copy,uint16_t cpu_code,uint8_t bad_packet);/*** @brief Set the default action of the identify port11017.6 Examples17 APPENDICES* table to set to the given value* @param port_type The port type associated with the port* @param ingress_error The value to use for the error indication** This allows the programmer to say "default port type is local"*/int table_indentify_port_default_common_set_port_type(mtag_port_type_t port_type,uint8_t ingress_error);/*** @brief Add an entry to the add mtag table* @param dst_addr The L2 destination MAC for matching* @param vid The VLAN ID used for matching* @param up1 The up1 value to use in the mTag* @param up2 The up2 value to use in the mTag* @param down1 The down1 value to use in the mTag* @param down2 The down2 value to use in the mTag*/entry_handle_t table_mTag_table_add_with_add_mTag(mac_addr_t dst_addr, uint16_t vid,uint8_t up1, uint8_t up2, uint8_t down1, uint8_t down2);/*** @brief Get the number of drops by ingress port and color* @param ingress_port The ingress port being queried.* @param color The color being queried.* @param count (output) The current value of the parameter.* @returns 0 on success.*/int counter_per_color_drops_get(uint32_t ingress_port,mtag_meter_levels_t color,uint64_t *count);#endif /* MTAG_RUN_TIME_H */11117.6 Examples17 APPENDICES17.6.2 Adding Hysteresis to mTag Metering with RegistersIn the previous section, the mtag-edge switch used metering between local ports andthe aggregation layer.

Suppose that network simulation indicated a benefit if hysteresiscould be used with the meters. That is, once the meter was red, packets are discardeduntil the meter returned to green (not just to yellow). This can be achieved by adding aregister set parallel to the meters. Each cell in the register set holds the "previous" colorof the meter.Here are the changes to support this feature. The meter index is stored in local metadatafor convenience.//////////////////////////////////////////////////////////////////// headers.p4:Add the meter index to the local metadata.//////////////////////////////////////////////////////////////////header_type local_metadata_t {fields {bit<16> cpu_code;// Code for packet going to CPUbit<4> port_type;// Type of port: up, down, local...bit ingress_error;// An error in ingress port checkbit was_mtagged;// Track if pkt was mtagged on ingrbit copy_to_cpu;// Special code resulting in copy to CPUbit bad_packet;// Other error indicationbit<8> color;// For meteringbit<8> prev_color;// For metering hysteresisbit<16> meter_idx;// Index used for metering}}////////////////////////////////////////////////////////////////// mtag-edge.p4:Declare registers and add table to update them////////////////////////////////////////////////////////////////// The register stores the "previous" state of the color.// Index is the same as that used by the meter.register prev_color {width : 8;// paired w/ meters aboveinstance_count : PORT_COUNT * PORT_COUNT;11217.6 Examples17 APPENDICES}// Action: Update the color saved in the registeraction update_prev_color(in bit<8> new_color) {modify_field(prev_color[local_metadata.meter_idx], new_color);}// Action: Override packet color with that from the parameteraction mark_pkt(in bit<8> color) {modify_field(local_metadata.color, color);}// Update meter packet action to save dataaction meter_pkt(in int<12> meter_idx) {// Save index and previous color in packet metadatamodify_field(local_metadata.meter_idx, meter_idx);modify_field(local_metadata.prev_color, prev_color[meter_idx]);execute_meter(per_dest_by_source, meter_idx, local_metadata.color);}//// This table is statically populated with the following rules://color: green,prev_color: red==> update_prev_color(green)//color: red,prev_color: green==> update_prev_color(red)//color: yellow, prev_color: red==> mark_pkt(red)// Otherwise, no-op.//table hysteresis_check {reads {local_metadata.color : exact;local_metadata.prev_color : exact;}actions {update_prev_color;mark_pkt;no_op;}size : 4;}////////////////////////////////////////////////////////////////11317.6 Examples17 APPENDICES// In the egress control function, check for hysteresis////////////////////////////////////////////////////////////////control egress {// Check for unknown egress state or bad retagging with mTag.apply(egress_check);apply(egress_meter) {hit {apply(hysteresis_check);apply(meter_policy);}}}17.6.3 ECMP Selection ExampleThis example shows how ECMP can be implemented using an action profile with actionselector.table ipv4_routing {reads {ipv4.dstAddr: lpm;}action_profile : ecmp_action_profile;size : 16384;// 16K possible IPv4 prefixes}action_profile ecmp_action_profile {actions {nhop_set;no_op;}size : 4096;// 4K possible next hopsdynamic_action_selection : ecmp_selector;}// list of fields used to determine the ECMP next hopfield_list l3_hash_fields {ipv4.srcAddr;ipv4.dstAddr;ipv4.protocol;11417.7 Addendum for Version 1.1.017 APPENDICESipv4.protocol;tcp.sport;tcp.dport;}field_list_calculation ecmp_hash {input {l3_hash_fields;}algorithm : crc16;output_width : 16;}action_selector ecmp_selector {selection_key : ecmp_hash;}17.7 Addendum for Version 1.1.0This addendum captures some of the technical discussions going on in the P4 LanguageDesign working group, for information about possible future directions.

It does not contain any official specifications of the P4 language. The working group may or may nottake the technical ideas proposed here into a future P4 specification.17.7.1 Architecture-language separationThe current P4 specification defines the language relative to an abstract forwardingmodel with a specific architecture, as described in Section 1.1. The P4 Language Design group is working towards the separation of language features from architecturefeatures, and this addendum gives a summary preview of ideas under consideration.The aim is to ensure that the P4 language specification itself is no longer bound to a particular target architecture.

Характеристики

Тип файла
PDF-файл
Размер
1,13 Mb
Тип материала
Высшее учебное заведение

Список файлов курсовой работы

Домашнее задание
VasilenkoAE_521 (switch openflow start)
staticNAT
p4factory
mininet
lvk_demo.py
targets
lvk_task
openflow_mapping
l2.py
l2.pyc
mapping_common.py
mapping_common.pyc
p4src
includes
headers.p4
parser.p4
lvk_task.p4
targets
libpd_thrift
libtbl_packing
tests
pd_thrift
conn_mgr_pd_rpc
__init__.py
__init__.pyc
conn_mgr-remote.
conn_mgr.py
conn_mgr.pyc
constants.py
ttypes.py
ttypes.pyc
devport_mgr_pd_rpc
Свежие статьи
Популярно сейчас
А знаете ли Вы, что из года в год задания практически не меняются? Математика, преподаваемая в учебных заведениях, никак не менялась минимум 30 лет. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6511
Авторов
на СтудИзбе
302
Средний доход
с одного платного файла
Обучение Подробнее