Skip to content

Commit

Permalink
Add Hints class
Browse files Browse the repository at this point in the history
Signed-off-by: Kumar <kumar.amber@intel.com>
  • Loading branch information
kamber-intel committed May 3, 2024
1 parent efbfd70 commit 02d4da4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
9 changes: 1 addition & 8 deletions detd/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,4 @@ def __init__(self, template, params):

super().__init__(data)


class Options:
"""Methods to assign parameters to passs into one convenient Object.
Used for: Passing parameters in Python script for manual customization of the qdisc. """
def __init__(self):

self.qdiscmap = "nomap"


46 changes: 41 additions & 5 deletions detd/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import math

from .common import Check
from .common import Options

from .logger import get_logger

Expand All @@ -37,18 +36,18 @@

class Configuration:

def __init__(self, interface, stream, traffic, options = None):
def __init__(self, interface, stream, traffic, hints = None):

if stream.txoffset > traffic.interval:
raise TypeError("Invalid TxOffset, it exceeds Interval")

self.interface = interface
self.stream = stream
self.traffic = traffic
if options is None:
self.options = Options()
if hints is None:
self.hints = Hints()
else:
self.options = options
self.hints = hints


class StreamConfiguration:
Expand Down Expand Up @@ -389,3 +388,40 @@ def reschedule(self):

self.schedule.add_best_effort_padding(self.traffics[0])
# FIXME: error handling

class Hints:
"""
A configuration class for managing traffic specifications and QoS (Quality of Service)
settings for network devices.
Attributes:
tx_selection (str): Determines the transmission selection mechanism to use.
Possible values are:
- 'ENHANCEMENTS_FOR_SCHEDULED_TRAFFIC' (802.1Qbv)
- 'STRICT_PRIORITY'
tx_selection_offload (bool): Indicates whether a hardware offload for the
tx_selection mechanism is used. True means hardware offload is enabled,
false implies a software-based approach.
data_path (str): Specifies the data path technology used. Current options include:
- 'AF_PACKET'
- 'AF_XDP_ZC'
Future expansions may include other data paths like 'DPDK'.
preemption (bool): Enables or disables preemption in the data transmission.
launch_time_control (bool): Enables or disables launch time control for packets.
This class allows for customization based on device capabilities and specific implementation
needs.
"""
def __init__(self, tx_selection, tx_selection_offload, data_path, preemption, launch_time_control):
self.tx_selection = tx_selection
self.tx_selection_offload = tx_selection_offload
self.data_path = data_path
self.preemption = preemption
self.launch_time_control = launch_time_control

def __repr__(self):
return (f"TrafficConfiguration(tx_selection={self.tx_selection!r}, "
f"tx_selection_offload={self.tx_selection_offload!r}, "
f"data_path={self.data_path!r}, preemption={self.preemption!r}, "
f"launch_time_control={self.launch_time_control!r})")

9 changes: 5 additions & 4 deletions detd/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from .systemconf import SystemInformation
from .systemconf import CommandIp

from .common import Options
from .scheduler import Hints

from .logger import setup_root_logger
from .logger import get_logger
Expand Down Expand Up @@ -250,13 +250,14 @@ def _add_talker(self, request):
size = request.size
interface_name = request.interface

options = Options()
options.qdiscmap = request.qdiscmap
hints = Hints()
#options.qdiscmap = request.qdiscmap

interface = Interface(interface_name)
stream = StreamConfiguration(addr, vid, pcp, txoffset)
traffic = TrafficSpecification(interval, size)

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

vlan_interface, soprio = self.server.manager.add_talker(config)

Expand Down

0 comments on commit 02d4da4

Please sign in to comment.