Handle missing sysfs path for in-tree ice driver

The in-tree ice driver version 6.6.40-stx.2 does not provide the debugfs
path used for monitoring the GNSS state. This commit provides the
following changes to support this driver:

1: Update the k8s daemonset to mount the /sys/kernel/debug path instead
   of /sys/kernel/debug/ice. The "ice" directory is not present using
   the in-tree driver, so mounting the parent directory allows the
   containers to be properly started and can then check if the "ice"
   directory is present at runtime
2: Update the startup script for the v2 container to check for the
   existence of the ice debugfs directory. If it is not present, disable
   GNSS tracking in ptp-notification
3: Update the path used by GNSS monitoring to match the changed mount
   path in the daemonset so that GNSS monitoring can proceed when the
   path is present

Currently, GNSS time sources and monitoring cannot be used with the
in-tree driver. GNSS time sources require configuring the system to use
the out-of-tree ice driver.

Test plan:
Pass: Verify helm chart and container build
Pass: Verify ptp-notification deployment using the in-tree ice driver,
ensure that GNSS tracking is automatically disabled when debugfs is not
present
Pass: Verify ptp-notification deployment using the out-of-tree ice
driver, ensure that GNSS tracking is operational when debugfs is present

Story: 2011056
Task: 50940

Signed-off-by: Cole Walker <cole.walker@windriver.com>
Change-Id: I73859408cf5655b58ebe2a1a78f407496c3380dd
This commit is contained in:
Cole Walker 2024-08-29 10:43:08 -04:00
parent 945e51f069
commit 76d515c290
4 changed files with 9 additions and 3 deletions

View File

@ -11,6 +11,8 @@ import logging
import os import os
import re import re
from pathlib import Path
from trackingfunctionsdk.common.helpers import log_helper from trackingfunctionsdk.common.helpers import log_helper
from trackingfunctionsdk.common.helpers import constants from trackingfunctionsdk.common.helpers import constants
from trackingfunctionsdk.services.daemon import DaemonControl from trackingfunctionsdk.services.daemon import DaemonControl
@ -85,8 +87,12 @@ else:
GNSS_CONFIGS = [] GNSS_CONFIGS = []
GNSS_INSTANCES = [] GNSS_INSTANCES = []
ice_debugfs = Path("/ice/ice/")
if os.environ.get("TS2PHC_SERVICE_NAME").lower() == "false": if os.environ.get("TS2PHC_SERVICE_NAME").lower() == "false":
LOG.info("GNSS instance tracking disabled.") LOG.info("GNSS instance tracking disabled.")
elif not ice_debugfs.is_dir():
LOG.info("Ice driver debugfs is not present, GNSS instance tracking disabled.")
os.environ["TS2PHC_SERVICE_NAME"] = "false"
else: else:
GNSS_CONFIGS = glob.glob(constants.TS2PHC_CONFIG_PATH + "ts2phc-*") GNSS_CONFIGS = glob.glob(constants.TS2PHC_CONFIG_PATH + "ts2phc-*")
LOG.debug('Looked for ts2phc configuration file(s) in %s, found %d' LOG.debug('Looked for ts2phc configuration file(s) in %s, found %d'

View File

@ -349,7 +349,7 @@ spec:
type: Directory type: Directory
- name: ice - name: ice
hostPath: hostPath:
path: /sys/kernel/debug/ice/ path: /sys/kernel/debug/
type: Directory type: Directory
- name: proc - name: proc
hostPath: hostPath:

View File

@ -65,7 +65,7 @@ class CguHandler:
def get_cgu_path_from_pci_addr(self): def get_cgu_path_from_pci_addr(self):
# Search for a cgu file using the given pci address # Search for a cgu file using the given pci address
cgu_path = "/ice/" + self.pci_addr + "/cgu" cgu_path = "/ice/ice/" + self.pci_addr + "/cgu"
if os.path.exists(cgu_path): if os.path.exists(cgu_path):
LOG.debug("PCI address %s has cgu path %s" % LOG.debug("PCI address %s has cgu path %s" %
(self.pci_addr, cgu_path)) (self.pci_addr, cgu_path))

View File

@ -55,7 +55,7 @@ class CguHandlerTests(unittest.TestCase):
read_data='PCI_SLOT_NAME=0000:18:00.0') as mock_open: read_data='PCI_SLOT_NAME=0000:18:00.0') as mock_open:
self.testCguHandler.convert_nmea_serialport_to_pci_addr() self.testCguHandler.convert_nmea_serialport_to_pci_addr()
self.testCguHandler.get_cgu_path_from_pci_addr() self.testCguHandler.get_cgu_path_from_pci_addr()
self.assertEqual(self.testCguHandler.cgu_path, "/ice/0000:18:00.0/cgu") self.assertEqual(self.testCguHandler.cgu_path, "/ice/ice/0000:18:00.0/cgu")
mock_path.exists.return_value = False mock_path.exists.return_value = False
with self.assertRaises(FileNotFoundError): with self.assertRaises(FileNotFoundError):