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

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

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

The valuespassed to that API would then be set in the table entry being added so that they couldbe passed to this action for packets that hit that entry.action route_ipv4(in bit<48> dst_mac,in bit<48> src_mac,in bit<16> vid) {modify_field(ethernet.dst_addr, dst_mac);modify_field(ethernet.src_addr, src_mac);modify_field(vlan_tag.vid, vid);modify_field(ipv4.ttl, ipv4.ttl-1);}10.2.1 Sequential Execution SemanticsActions across different tables are assumed to execute sequentially, where the sequenceis determined by the control flow, described in Section 13.

As an example, consider thecode fragment given below, repeated from Section 13.control main {apply(check_mtag);apply(identify_port);}Here, the check_mtag table and its associated actions are applied first, followed by theidentify_port table and its actions.The body of a compound action is also assumed to execute sequentially – i.e. thefirst primitive action executes to completion, and then the second executes to completion.

Concretely, consider the two primitive actions modify_field(hdr.fieldA, 1)and modify_field(hdr.fieldB, hdr.fieldA) appearing within the compound actioncompound as shown below.6711 ACTION PROFILE DECLARATIONSaction compound1() {modify_field(hdr.fieldA, 1);modify_field(hdr.fieldB, hdr.fieldA);}Let’s say hdr.fieldA started with a value of 0. The first statement is completed first,leaving 1 in fieldA. Then, the second instruction is executed, propagating 1 to fieldB.While the language permits arbitrarily-long dependency chain of primitive actions withina compound action, each target can choose to impose its own restrictions for performance.

For instance, a target might introduce a limit to the maximum length of a dependency chain it supports. In such cases, the target compiler must infer dependenciesbetween primitive actions and reject compound actions that strictly require primitiveactions to be sequenced one after another longer than the target’s limit.As an example, action compound1 above might be rejected by a target compiler on thegrounds that there is no capability to write a header field (fieldA) and then read it intoanother header field within the same table. At the same time, the compiler could acceptthe action below (action compound2) because there is no dependency between the twoprimitive actions and both can execute in parallel.action compound2() {modify_field(hdr.fieldX, hdr.fieldY);modify_field(hdr.fieldB, hdr.fieldC);}The compiler may also choose to rewrite code while preserving correctness to removespurious dependencies.

For instance, the code in action compound1 is equivalent to thecode in action compound3 below, which has no dependencies between primitive actionsand hence can be run on a constrained target.action compound3() {modify_field(hdr.fieldA, 1);modify_field(hdr.fieldB, 1);}11Action profile declarationsIn some instances, action parameter values are not specific to a match entry but couldbe shared between different entries.

Some tables might even want to share the same set6811 ACTION PROFILE DECLARATIONSof action parameter values. This can be expressed in P4 with action profiles. Action profiles are declarative structures specifying a list of potential actions, and possibly otherattributes.Entries are inserted at run time to specify the single action to be run if that entry ischosen - among the candidates included in the action profile declaration-, as well asthe action parameter values to use.Instead of statically binding one particular action profile entry to each match entry,one might want to associate multiple action profile entries with a match entry and letthe system (i.e., data plane logic) dynamically bind one of the action profile entries toeach class of packets. The dynamic_action_selection attribute enables such behavior.

When dynamic_action_selection is specified, action profile entries can be bundled into groups by the run time, and a match entry can then tied to a group of actionprofile entries. To dictate a specific data-plane mechanism that chooses a particular action profile entry in a group, one should provide an action selector. An action selectorchooses a particular action profile entry for each packet by either pseudo-randomly orpredictably deriving a decision from header fields and/or metadata.Here is the BNF for an action profile declaration:action_profile_declaration ::=action_profile action_profile_name {action_specification[ size : const_expr ; ][ dynamic_action_selection : selector_name ; ]}action_specification ::=actions { [ action_name ; ] + }action_selector_declaration ::=action_selector selector_name {selection_key : field_list_calculation_name ;}Action profiles are declared and applied with the following conventions:• The size attribute indicates the number of entries required for the action profile.

If this cannot be supported, an error will be signaled when the declaration isprocessed. If this attribute is omitted, there is no guarantee as to the number ofentries that the action profile will be able to accomodate at run time.6912 TABLE DECLARATIONS12Table DeclarationsTables are declarative structures specifying match and action operations, and possiblyother attributes. The action specification in a table indicates which action functions areavailable to this table’s entries.Note that masks may be specified for the match fields (i.e., lookup keys) in the table declaration.

This enables table lookup with arbitrary sub-fields, rather than only with thewhole fields. These masks are applied statically to the fields prior to the table-lookupoperation and hence should not be confused with the value mask for a field with thefield-match type ternary.The table key matches an entry if the conjunction (AND) of all fields in the key matchtheir corresponding values in the table entry.Here is the BNF for a table declaration:table_declaration ::=table table_name {[ reads { field_match + } ]table_actions[ min_size : const_expr ; ][ max_size : const_expr ; ][ size : const_expr ; ][ support_timeout : bool_value ; ]}field_match ::= field_or_masked_ref : field_match_type ;field_or_masked_ref ::=header_ref | field_ref | field_ref mask const_exprfield_match_type ::= exact | ternary | lpm | index | range | validtable_actions ::=action_specification | action_profile_specificationaction_profile_specification ::=action_profile : action_profile_name ;This example is from the mTag edge switch program.

It maps the packet’s L2 destinationto an mTag. If it fails to find a map, it may copy the packet to the CPU.// Check if the packet needs an mtag and add one if it does.table mTag_table {7012 TABLE DECLARATIONSreads {ethernet.dst_addr: exact;vlan.vid: exact;}actions {add_mTag;// Action called if pkt needs an mtag.common_copy_pkt_to_cpu; // If no mtag, send to the CPUno_op;}max_size: 20000;}For an implementation of ECMP using an action profile with an action selector, pleasesee 17.6.3.Match types have the following meanings.• exact: The field value is matched against the table entry and the values must beidentical for the entry to be considered.• ternary: A mask provided with each entry in the table.

This mask is ANDed withthe field value before a comparison is made. The field value and the table entryvalue need only agree on the bits set in the entry’s mask. Because of the possibilities of overlapping matches, a priority must be associated with each entry in atable using ternary matches.• lpm: This is a special case of a ternary match. Each entry’s mask selects a prefix byhaving a divide between 1s in the high order bits and 0s in the low order bits. Thenumber of 1 bits gives the length of the prefix which is used as the priority of theentry.• index: The field value is used as the index of a table entry.• range: Each entry specifies a low and high value for the entry and the field matchesonly if it is in this range. Range end points are inclusive. Signedness of the field isused in evaluating the order.• valid: Only applicable to packet header fields or header instances (not metadatafields), the table entry must specify a value of true (the field is valid) or false (thefield is not valid) as match criteria.Tables are defined and applied with the following conventions:• Header references for matching may only be used with the valid match type.• Exactly one of the actions indicated in either the action_specification or theaction_profile_specification will be run when a table processes a packet.7112 TABLE DECLARATIONS– Entries are inserted at run time and each rule specifies the single action tobe run if that entry is matched.– Actions in the list should be compound actions.• At run time, the table entry insert operation (not part of P4) must specify:– Values for all fields specified in the reads entry along with optional valuemasks, prefix lengths, and an entry priority, depending on the field-matchtype.

The value mask and entry priority are necessary for the ternary matchtype, and the prefix length for the lpm match type.– The name of the action from the action_specification or the action_profile_specification and the parameters to be passed to the action function when it is called.• A table must not have entries with the same key. In other words, looking up a tablemust lead to either one or zero match entry. This means, for an exact match-typekey, a table is not allowed to have more than one entry with the same key value.Similarly, for a ternary (lpm respectively) match-type key, a table is not allowedto have more than one entry with the same key value and mask (prefix lengthrespectively).• A default action is taken when no table entry matches.

This action is specified atrun time. If no default action is specified and no entry matches, the table does notaffect the packet, and processing continues according to the imperative controlflow.• If reads is not present, the table will always execute the default action. If no default action has been specified, the table has no effect on the packet.• The keyword mask may be used for a field to indicate that only the indicated bitsshould be used in the match.

This mask is applied once to the Parsed Representation’s field prior to any comparisons (compared to the per-entry mask which maydiffer from entry to entry).• The match type valid indicates that the field’s parent header (or, in the case ofmetadata, the field itself ) should be tested for validity. The value of 1 will matchwhen the header is valid; 0 will match when the header is not valid. Note thatmetadata fields are always valid.• Using an invalid field or header as a match key may lead to an undefined behavior.• The match type index cannot be used with other match types.

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

Тип файла
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 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6510
Авторов
на СтудИзбе
302
Средний доход
с одного платного файла
Обучение Подробнее