Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I210 implementation + Taprio software support + mapping customization (rebase) #20

Merged
merged 25 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5e65698
Test implementation of i210.
jeppex1 Feb 17, 2023
bc64cd3
Added support for picking flag in taprio setup. (1/2)
jeppex1 Feb 17, 2023
1b324ce
Implemented i210 support
jeppex1 Mar 9, 2023
f1b5e86
Added test for TcTaprioSoftwareSet + fix name
jeppex1 Mar 10, 2023
98905b3
Added capability for i210 to indicate it supports LTC
jeppex1 Mar 14, 2023
18fa2c8
Taprio txassist mode + etf qdisc install functionality (rough impleme…
jeppex1 Mar 14, 2023
6e62464
Preparation of options object, used to pass customization into qdisc
jeppex1 Mar 14, 2023
1838278
Picking taprio + some option fixing
jeppex1 Mar 14, 2023
31840ae
Enabled possibility to pass custom tc flag
jeppex1 Mar 21, 2023
1cbff86
Fixed txassist error
jeppex1 Mar 21, 2023
d352c61
Added Tests for taprio txassist and etf CommandStrings
jeppex1 Mar 21, 2023
4980b99
error fix in txassist
jeppex1 Mar 21, 2023
f1820c0
Finished LTC setup option
jeppex1 Mar 21, 2023
b8a55de
Added possibility to pass map to tc from python script
jeppex1 Mar 21, 2023
989762a
Removed unnecessary code
jeppex1 Mar 21, 2023
5723bb1
Calculating Txoffset-hardware delays
jeppex1 Mar 24, 2023
564b1dc
Revert "Calculating Txoffset-hardware delays"
jeppex1 Mar 27, 2023
29590c3
Revert "Finished LTC setup option"
jeppex1 Mar 27, 2023
50ac499
Revert "error fix in txassist"
jeppex1 Mar 27, 2023
3f659d9
Revert "Added Tests for taprio txassist and etf CommandStrings"
jeppex1 Mar 27, 2023
400e994
Revert "Fixed txassist error"
jeppex1 Mar 27, 2023
3d2942c
revert
jeppex1 Mar 27, 2023
dc30031
Removed to make sure branch contains only Taprio Software Support + I…
jeppex1 Mar 27, 2023
efbfd70
Updated readme for options
jeppex1 Mar 27, 2023
c6aacb5
Enable Hints.
kamber-intel May 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,57 @@ ethtool --set-eee eth0 eee off



### Setup a talker from python with options

The following code will connect to the detd service and configure the specified stream with options.

```python
from detd import *



def setup_stream_config():

interface_name = "eno1"
interval = 20 * 1000 * 1000 # ns
size = 1522 # Bytes

txoffset = 250 * 1000 # ns
addr = "03:C0:FF:EE:FF:4E"
vid = 3
pcp = 6

preemption = False
launch_time_control = False
tx_selection_offload = False
datapath = DataPath.AF_PACKET
tx_selection = TxSelection.EST

interface = Interface(interface_name)
stream = StreamConfiguration(addr, vid, pcp, txoffset)
traffic = TrafficSpecification(interval, size)
hints = Hints(tx_selection, tx_selection_offload, datapath, preemption, launch_time_control)

config = Configuration(interface, stream, traffic, hints)

return config




proxy = ServiceProxy()

config = setup_stream_config()
response = proxy.add_talker(config)

print(response)
```

This example specifies the map parameter for taprio, otherwise it behaves same as the example above.




### Setup a talker stream for an arbitrary command, using a script that calls detd functions

The script [setup_qos.sh](./setup_qos.sh) allows for quick experimentation without modifying an existing application.
Expand Down
61 changes: 47 additions & 14 deletions detd/devices/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
from ..systemconf import SystemConfigurator
from ..systemconf import SystemInformation

from ..scheduler import DataPath
from ..scheduler import TxSelection
from ..scheduler import Hints

from ..logger import get_logger


logger = get_logger(__name__)




def from_pci_id(pci_id):

# Retrieve all the subclasses inheriting from class Device
Expand All @@ -42,16 +43,11 @@ def from_pci_id(pci_id):

raise NameError("Unrecognized PCI ID: {}".format(pci_id))




class Capability(enum.Enum):
Qbv = 0
Qbu = 1
LTC = 2



class Device:

"""
Expand Down Expand Up @@ -85,11 +81,11 @@ def __init__(self, num_tx_queues, num_rx_queues):
self.features = {}


def setup(self, interface, mapping, scheduler, stream):
def setup(self, interface, mapping, scheduler, stream, hints):
'''Performs the configuration of the talker stream provided.
'''

self.systemconf.setup(interface, mapping, scheduler, stream)
self.systemconf.setup(interface, mapping, scheduler, stream, hints)


def get_rate(self, interface):
Expand Down Expand Up @@ -125,7 +121,44 @@ def supports_schedule(self, schedule):
'''

raise NotImplementedError("The handler class for the device must implement this function")


def supports_qbv(self):
return Capability.Qbv in self.capabilities

def default_hints(self):
'''Returns device supported default Hints.
'''
preemption = False
launch_time_control = False
tx_selection_offload = False
datapath = DataPath.AF_PACKET
tx_selection = TxSelection.Qbv

return Hints(tx_selection, tx_selection_offload ,datapath, preemption, launch_time_control)

def check_hints(self, config):
kamber-intel marked this conversation as resolved.
Show resolved Hide resolved

preemption = config.hints.preemption
launch_time_control = config.hints.launch_time_control
tx_selection_offload = config.hints.tx_selection_offload
datapath = DataPath(config.hints.data_path)
tx_selection = TxSelection(config.hints.tx_selection)

# Add feature later
if datapath != DataPath.AF_PACKET:
raise ValueError(f"Device does not support the requested DataPath feature."
f"Requested: {datapath}")

if tx_selection == TxSelection.EST and tx_selection_offload == True:
if Capability.Qbv not in self.capabilities:
raise ValueError(f"Device does not support the requested Tx selection feature."
f"Requested Tx_selection: {tx_selection}, Requested tx_selection_offload: {tx_selection_offload}")

if preemption == True:
if Capability.Qbu not in self.capabilities:
raise ValueError(f"Device does not support the requested Tx selection feature."
f"Requested Tx_selection: {tx_selection}, Requested preemption: {preemption}")

if launch_time_control == True:
if Capability.LTC not in self.capabilities:
raise ValueError(f"Device does not support the requested launch_time_control feature."
f"Requested: {launch_time_control}")

return Hints(tx_selection, tx_selection_offload ,datapath, preemption, launch_time_control)
53 changes: 51 additions & 2 deletions detd/devices/intel_i210.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
"""



import time

from ..logger import get_logger


from .device import Capability
from .device import Device

from ..scheduler import DataPath
from ..scheduler import TxSelection
from ..scheduler import Hints

logger = get_logger(__name__)

Expand All @@ -23,6 +28,12 @@

class IntelI210(Device):


NUM_TX_QUEUES = 4
NUM_RX_QUEUES = 4

CAPABILITIES = [Capability.LTC]

PCI_IDS_VALID = ['8086:1533', '8086:1536', '8086:1537', '8086:1538', '8086:157B',
'8086:157C', '8086:15F6']

Expand All @@ -35,4 +46,42 @@ def __init__(self, pci_id):

logger.info(f"Initializing {__class__.__name__}")

raise NotImplementedError("Handler class for i210 Ethernet controller not yet implemented")
super().__init__(IntelI210.NUM_TX_QUEUES, IntelI210.NUM_RX_QUEUES)

self.features['rxvlan'] = 'off'

self.capabilities = [Capability.LTC]

# self.num_tx_ring_entries and self.num_rx_ring_entries
# Provides the number of ring entries for Tx and Rx rings.
# Currently, the code just passes the value to ethtool's --set-ring.
self.num_tx_ring_entries = 1024
self.num_rx_ring_entries = 1024

def get_rate(self, interface):

# Without a small delay, the program flow will call ethtool twice too
# fast, causing it to return "Unknown!" speed
time.sleep(1)

return self.systeminfo.get_rate(interface)


def get_base_time_multiple(self):
xtor marked this conversation as resolved.
Show resolved Hide resolved
return -1


def supports_schedule(self, schedule):
kamber-intel marked this conversation as resolved.
Show resolved Hide resolved

return True

def default_hints(self):
'''Returns device supported default Hints.
'''
preemption = False
launch_time_control = False
tx_selection_offload = False
datapath = DataPath.AF_PACKET
tx_selection = TxSelection.EST

return Hints(tx_selection, tx_selection_offload ,datapath, preemption, launch_time_control)
20 changes: 17 additions & 3 deletions detd/devices/intel_i225.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
from .device import Capability
from .device import Device

from ..scheduler import DataPath
from ..scheduler import TxSelection
from ..scheduler import Hints

logger = get_logger(__name__)

Expand All @@ -26,7 +29,7 @@ class IntelI225(Device):
NUM_TX_QUEUES = 4
NUM_RX_QUEUES = 4

CAPABILITIES = [Capability.Qbv]
CAPABILITIES = [Capability.Qbv, Capability.LTC, Capability.Qbu]

# Devices supporting TSN: i225-LM, i225-IT
PCI_IDS_VALID = ['8086:0D9F', '8086:15F2']
Expand All @@ -52,11 +55,11 @@ def __init__(self, pci_id):
if pci_id in IntelI225.PCI_IDS_UNPROGRAMMED:
raise "The flash image in this i225 device is empty, or the NVM configuration loading failed."

kamber-intel marked this conversation as resolved.
Show resolved Hide resolved
self.capabilities = [Capability.Qbv]

self.features['rxvlan'] = 'off'
#self.features['hw-tc-offload'] = 'on'

self.capabilities = [Capability.Qbv, Capability.LTC, Capability.Qbu]

# self.num_tx_ring_entries and self.num_rx_ring_entries
# Provides the number of ring entries for Tx and Rx rings.
# Currently, the code just passes the value to ethtool's --set-ring.
Expand Down Expand Up @@ -85,3 +88,14 @@ def supports_schedule(self, schedule):
# FIXME: check additional constraints, like maximum cycle time

return True

def default_hints(self):
'''Returns device supported default Hints.
'''
preemption = False
launch_time_control = False
tx_selection_offload = True
datapath = DataPath.AF_PACKET
tx_selection = TxSelection.EST

return Hints(tx_selection, tx_selection_offload ,datapath, preemption, launch_time_control)
17 changes: 17 additions & 0 deletions detd/devices/intel_mgbeehl.py
kamber-intel marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from .device import Capability
from .device import Device

from ..scheduler import DataPath
from ..scheduler import TxSelection
from ..scheduler import Hints

logger = get_logger(__name__)

Expand Down Expand Up @@ -44,6 +47,7 @@ class IntelMgbeEhl(Device):
# Make sure to expose this in your device class.
PCI_IDS = PCI_IDS_HOST + PCI_IDS_PSE

CAPABILITIES = [Capability.Qbv, Capability.LTC, Capability.Qbu]

# FIXME support for listener stream
# If the stream is time aware, flows should be configured for PTP traffic
Expand All @@ -65,6 +69,8 @@ def __init__(self, pci_id):
self.num_tx_ring_entries = 1024
self.num_rx_ring_entries = 1024

self.capabilities = [Capability.Qbv, Capability.LTC, Capability.Qbu]

# Please note other features are currently set for all devices in the
# systemconf module.
# For example, Energy Efficient Ethernet is disabled for all devices.
Expand All @@ -79,3 +85,14 @@ def supports_schedule(self, schedule):
# FIXME: check additional constraints, like maximum cycle time

return True

def default_hints(self):
'''Returns device supported default Hints.
'''
preemption = False
launch_time_control = False
tx_selection_offload = True
datapath = DataPath.AF_PACKET
tx_selection = TxSelection.EST

return Hints(tx_selection, tx_selection_offload ,datapath, preemption, launch_time_control)
15 changes: 15 additions & 0 deletions detd/ipc.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
syntax = "proto3";

enum DataPath {
AF_PACKET = 0;
AF_XDP_ZC = 1;
}

enum TxSelection{
EST = 0;
STRICT_PRIO = 1;
}

message StreamQosRequest {
string interface = 1;
Expand All @@ -12,6 +21,12 @@ message StreamQosRequest {
uint32 txmax = 8;
bool setup_socket = 9;
uint32 basetime = 10;
bool hints_available = 11;
TxSelection hints_tx_selection = 12;
bool hints_tx_selection_offload = 13;
DataPath hints_data_path = 14;
bool hints_preemption = 15;
bool hints_launch_time_control = 16;
}


Expand Down
Loading