Add NIC namespace and features

Adds a set of traits representing features that hardware networking interface
controllers expose. A number of source documents were used to come up with
these traits:

https://review.openstack.org/#/c/341341/4/specs/newton/approved/standardize-network-capabilities.rst
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/network-nic-offloads.html
https://www.kernel.org/doc/Documentation/networking/scaling.txt
https://www.kernel.org/doc/Documentation/networking/multiqueue.txt

Change-Id: If8a9f08b8b45ebcac53ea9a406c210605b163516
This commit is contained in:
Jay Pipes 2017-03-21 17:14:17 -04:00
parent 23d81d4451
commit 842a43b515
7 changed files with 147 additions and 0 deletions

View File

@ -25,6 +25,11 @@ CUSTOM_NAMESPACE = 'CUSTOM_'
# Each submodule registers its symbols with the os_traits module namespace
from os_traits.hw.cpu import x86 # noqa
from os_traits.hw import nic # noqa
from os_traits.hw.nic import accel # noqa
from os_traits.hw.nic import dcb # noqa
from os_traits.hw.nic import offload # noqa
from os_traits.hw.nic import sriov # noqa
from os_traits.storage import disk # noqa

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os_traits import utils
register = utils.register_fn(__name__)
# A few generalized capabilities of some NICs
register('SRIOV') # NIC supports partitioning via SR-IOV
register('MULTIQUEUE') # >1 receive and transmit queues
register('VMDQ') # Virtual machine device queues
# Some NICs allow processing pipelines to be programmed via FPGAs embedded in
# the NIC itself...
register('PROGRAMMABLE_PIPELINE')

26
os_traits/hw/nic/accel.py Normal file
View File

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os_traits import utils
register = utils.register_fn(__name__)
register('SSL') # SSL crypto
register('IPSEC') # IP-Sec crypto
register('TLS') # TLS crypto
register('DIFFIEH') # Diffie-Hellmann crypto
register('RSA') # RSA crypto
register('ECC') # Eliptic Curve crypto
register('LZS') # LZS compression
register('DEFLATE') # Deflate compression

24
os_traits/hw/nic/dcb.py Normal file
View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os_traits import utils
register = utils.register_fn(__name__)
# IEEE 802.1Qbb Priority-flow control
register('PFC')
# IEEE 802.1Qaz Enhanced Transmission Selection
register('ETS')
# IEEE 802.1Qau Quantized Congestion Notification
register('QCN')

View File

@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os_traits import utils
register = utils.register_fn(__name__)
register('TSO') # TCP segmentation
register('GRO') # Generic receive
register('GSO') # Generic segmentation
register('UFO') # UDP Fragmentation
register('LRO') # Large receive
register('LSO') # Large send
register('TCS') # TCP Checksum
register('UCS') # UDP Checksum
register('SCS') # SCTP Checksum
register('L2CRC') # Layer-2 CRC
register('FDF') # Intel Flow-Director Filter
register('RXVLAN') # VLAN receive tunnel segmentation
register('TXVLAN') # VLAN transmit tunnel segmentation
register('VXLAN') # VxLAN tunneling
register('GRE') # GRE tunneling
register('GENEVE') # Geneve tunneling
register('TXUDP') # UDP transmit tunnel segmentation
register('QINQ') # QinQ specification
register('RDMA') # remote direct memory access
register('RXHASH') # receive hashing

25
os_traits/hw/nic/sriov.py Normal file
View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from os_traits import utils
register = utils.register_fn(__name__)
# The function (virtual or physical) can restrict transmit rates
register('QOS_TX')
# The function (virtual or physical) can restrict receive rates
register('QOS_RX')
# The function (virtual or physical) can set up multiple receive and transmit
# queues for receive-side scaling
register('MULTIQUEUE')

View File

@ -14,6 +14,7 @@
import os_traits as ot
from os_traits.hw.cpu import x86
from os_traits.hw.nic import offload
from os_traits.tests import base
@ -28,17 +29,20 @@ class TestSymbols(base.TestCase):
# And the "leaf-module" namespace...
self.assertEqual(x86.SSE42, ot.HW_CPU_X86_SSE42)
self.assertEqual(offload.TSO, ot.HW_NIC_OFFLOAD_TSO)
def test_get_symbol_names(self):
names = ot.get_symbol_names()
self.assertIn("HW_CPU_X86_AVX2", names)
self.assertIn("STORAGE_DISK_SSD", names)
self.assertIn("HW_NIC_SRIOV", names)
def test_get_traits(self):
traits = ot.get_traits('HW_CPU')
self.assertIn("HW_CPU_X86_SSE42", traits)
self.assertIn(ot.HW_CPU_X86_AVX2, traits)
self.assertNotIn(ot.STORAGE_DISK_SSD, traits)
self.assertNotIn(ot.HW_NIC_SRIOV, traits)
def test_check_traits(self):
traits = set(["HW_CPU_X86_SSE42", "HW_CPU_X86_XOP"])