Ensō 0.4.6
Software API reference
Loading...
Searching...
No Matches
config.cpp File Reference

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.
 

Detailed Description

Functions to configure the data plane.

Author
Hugo Sadok sadok.nosp@m.@cmu.nosp@m..edu

Definition in file config.cpp.

Enumeration Type Documentation

◆ ConfigId

enum enso::ConfigId

Definition at line 52 of file config.cpp.

Function Documentation

◆ __attribute__()

struct enso::__attribute__ ( (__packed__)  )

Definition at line 1 of file internals.h.

◆ disable_rate_limit()

int enso::disable_rate_limit ( struct NotificationBufPair notification_buf_pair)

Disables hardware rate limit.

Parameters
notification_buf_pairNotification buffer to send configuration through.
Returns
0 if configuration was successful, -1 otherwise.

Definition at line 162 of file config.cpp.

◆ disable_round_robin()

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.

Parameters
notification_buf_pairNotification buffer pair to send the configuration through.
Returns
0 if configuration was successful, -1 otherwise.

Definition at line 212 of file config.cpp.

◆ disable_timestamp()

int enso::disable_timestamp ( struct NotificationBufPair notification_buf_pair)

Disables hardware timestamping.

Parameters
notification_buf_pairNotification buffer to send configuration through.
Returns
0 if configuration was successful, -1 otherwise.

Definition at line 139 of file config.cpp.

◆ enable_rate_limit()

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.

Parameters
notification_buf_pairNotification buffer to send configuration through.
numRate numerator.
denRate denominator.
Returns
0 if configuration was successful, -1 otherwise.

Definition at line 149 of file config.cpp.

◆ enable_round_robin()

int enso::enable_round_robin ( struct NotificationBufPair notification_buf_pair)

Enables packet round robin for the fallback pipes.

Parameters
notification_buf_pairNotification buffer pair to send the configuration through.
Returns
0 if configuration was successful, -1 otherwise.

Definition at line 208 of file config.cpp.

◆ enable_timestamp()

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.

Parameters
notification_buf_pairNotification buffer to send configuration through.
offsetPacket offset to place the timestamp, default is kDefaultRttOffset bytes.
Returns
0 if configuration was successful, -1 otherwise.

Definition at line 123 of file config.cpp.

◆ insert_flow_entry()

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.

Parameters
notification_buf_pairNotification buffer to send configuration through.
dst_portDestination port number of the flow entry.
src_portSource port number of the flow entry.
dst_ipDestination IP address of the flow entry.
src_ipSource IP address of the flow entry.
protocolProtocol of the flow entry.
enso_pipe_idEnso Pipe ID that will be associated with the flow entry.
Returns
Return 0 if configuration was successful, -1 otherwise.

Definition at line 97 of file config.cpp.

◆ update_fallback_queues_config()

int enso::update_fallback_queues_config ( struct NotificationBufPair notification_buf_pair)

Update the device's fallback queues configuration.

Parameters
notification_buf_pairNotification buffer pair to send the configuration through.
Returns
0 if configuration was successful, -1 otherwise.

Definition at line 216 of file config.cpp.