Functions to configure the data plane. More...
#include <enso/config.h>
#include <enso/consts.h>
#include <enso/helpers.h>
#include <enso/internals.h>
#include <immintrin.h>
#include <cstdio>
#include "../pcie.h"
Go to the source code of this file.
Enumerations | |
enum | ConfigId { FLOW_TABLE_CONFIG_ID = 1 , TIMESTAMP_CONFIG_ID = 2 , RATE_LIMIT_CONFIG_ID = 3 , FALLBACK_QUEUES_CONFIG_ID = 4 } |
Functions | |
struct | enso::__attribute__ ((__packed__)) RxNotification |
int | enso::insert_flow_entry (struct NotificationBufPair *notification_buf_pair, uint16_t dst_port, uint16_t src_port, uint32_t dst_ip, uint32_t src_ip, uint32_t protocol, uint32_t enso_pipe_id) |
Inserts flow entry in the data plane flow table that will direct all packets matching the flow entry to the enso_pipe_id . | |
int | enso::enable_timestamp (struct NotificationBufPair *notification_buf_pair, uint8_t offset=kDefaultRttOffset) |
Enables hardware timestamping. | |
int | enso::disable_timestamp (struct NotificationBufPair *notification_buf_pair) |
Disables hardware timestamping. | |
int | enso::enable_rate_limit (struct NotificationBufPair *notification_buf_pair, uint16_t num, uint16_t den) |
Enables hardware rate limit. | |
int | enso::disable_rate_limit (struct NotificationBufPair *notification_buf_pair) |
Disables hardware rate limit. | |
int | enso::enable_round_robin (struct NotificationBufPair *notification_buf_pair) |
Enables packet round robin for the fallback pipes. | |
int | enso::disable_round_robin (struct NotificationBufPair *notification_buf_pair) |
Disables packet round robin for the fallback pipes. Using a hash of the packet's five tuple to select the pipe. | |
int | enso::update_fallback_queues_config (struct NotificationBufPair *notification_buf_pair) |
Update the device's fallback queues configuration. | |
Functions to configure the data plane.
Definition in file config.cpp.
enum enso::ConfigId |
Definition at line 52 of file config.cpp.
struct enso::__attribute__ | ( | (__packed__) | ) |
Definition at line 1 of file internals.h.
int enso::disable_rate_limit | ( | struct NotificationBufPair * | notification_buf_pair | ) |
Disables hardware rate limit.
notification_buf_pair | Notification buffer to send configuration through. |
Definition at line 162 of file config.cpp.
int enso::disable_round_robin | ( | struct NotificationBufPair * | notification_buf_pair | ) |
Disables packet round robin for the fallback pipes. Using a hash of the packet's five tuple to select the pipe.
notification_buf_pair | Notification buffer pair to send the configuration through. |
Definition at line 212 of file config.cpp.
int enso::disable_timestamp | ( | struct NotificationBufPair * | notification_buf_pair | ) |
Disables hardware timestamping.
notification_buf_pair | Notification buffer to send configuration through. |
Definition at line 139 of file config.cpp.
int enso::enable_rate_limit | ( | struct NotificationBufPair * | notification_buf_pair, |
uint16_t | num, | ||
uint16_t | den | ||
) |
Enables hardware rate limit.
Once rate limiting is enabled, packets from all queues are sent at a rate of num / den * kMaxHardwareFlitRate
flits per second (a flit is 64 bytes). Note that this is slightly different from how we typically define throughput and you may need to take the packet sizes into account to set this properly.
For example, suppose that you are sending 64-byte packets. Each packet occupies exactly one flit. For this packet size, line rate at 100Gbps is 148.8Mpps. So if kMaxHardwareFlitRate
is 200MHz, line rate actually corresponds to a 744/1000 rate. Therefore, if you want to send at 50Gbps (50% of line rate), you can use a 372/1000 (or 93/250) rate.
The other thing to notice is that, while it might be tempting to use a large denominator in order to increase the rate precision. This has the side effect of increasing burstiness. The way the rate limit is implemented, we send a burst of num
consecutive flits every den
cycles. Which means that if num
is too large, it might overflow the receiver buffer. For instance, in the example above, 93/250 would be a better rate than 372/1000. And 3/8 would be even better with a slight loss in precision.
You can find the maximum packet rate for any packet size by using the expression: line_rate / ((pkt_size + 20) * 8)
. So for 100Gbps and 128-byte packets we have: 100e9 / ((128 + 20) * 8)
packets per second. Given that each packet is two flits, for kMaxHardwareFlitRate = 200e6
, the maximum rate is 100e9 / ((128 + 20) * 8) * 2 / 200e6
, which is approximately 125/148. Therefore, if you want to send packets at 20Gbps (20% of line rate), you should use a 25/148 rate.
notification_buf_pair | Notification buffer to send configuration through. |
num | Rate numerator. |
den | Rate denominator. |
Definition at line 149 of file config.cpp.
int enso::enable_round_robin | ( | struct NotificationBufPair * | notification_buf_pair | ) |
Enables packet round robin for the fallback pipes.
notification_buf_pair | Notification buffer pair to send the configuration through. |
Definition at line 208 of file config.cpp.
int enso::enable_timestamp | ( | struct NotificationBufPair * | notification_buf_pair, |
uint8_t | offset = kDefaultRttOffset |
||
) |
Enables hardware timestamping.
All outgoing packets will receive a timestamp and all incoming packets will have an RTT (in number of cycles). Use get_pkt_rtt
to retrieve the value.
notification_buf_pair | Notification buffer to send configuration through. |
offset | Packet offset to place the timestamp, default is kDefaultRttOffset bytes. |
Definition at line 123 of file config.cpp.
int enso::insert_flow_entry | ( | struct NotificationBufPair * | notification_buf_pair, |
uint16_t | dst_port, | ||
uint16_t | src_port, | ||
uint32_t | dst_ip, | ||
uint32_t | src_ip, | ||
uint32_t | protocol, | ||
uint32_t | enso_pipe_id | ||
) |
Inserts flow entry in the data plane flow table that will direct all packets matching the flow entry to the enso_pipe_id
.
notification_buf_pair | Notification buffer to send configuration through. |
dst_port | Destination port number of the flow entry. |
src_port | Source port number of the flow entry. |
dst_ip | Destination IP address of the flow entry. |
src_ip | Source IP address of the flow entry. |
protocol | Protocol of the flow entry. |
enso_pipe_id | Enso Pipe ID that will be associated with the flow entry. |
Definition at line 97 of file config.cpp.
int enso::update_fallback_queues_config | ( | struct NotificationBufPair * | notification_buf_pair | ) |
Update the device's fallback queues configuration.
notification_buf_pair | Notification buffer pair to send the configuration through. |
Definition at line 216 of file config.cpp.