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

IPDK IPsec acceleration/offload scripts #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sai-pracheetha
Copy link

No description provided.

Copy link
Collaborator

@5abeel 5abeel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated code should be removed

@@ -0,0 +1,315 @@
#!/usr/bin/python
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated code from ipu_playbook/ovs_offload/common/utils.py

We should remove this from here and re-use the code used in the previously committed location. I see some new code in functions split_mac, split_mac_2 and ip_dec_to_hex. These can be added to the other file to bring it in line with the needed functionality

@@ -0,0 +1 @@
PyYAML
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyPYAML is already listed in requirements.txt in the main folder of ipu-playbook. We can remove this file

Signed-off-by: Sai Pracheetha Beeyam <[email protected]>
if not re.match("fn_id",line):
continue
fields = line.split()
#print("fields=",fields)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the debug statements that are left over and commented can be removed

acc_mac = lines[0].split()[1]
print("acc_mac:",acc_mac)

#get acc vsi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to follow a Python style guide (something like a Pylint or Flake8 linters are popular and will make sure all the script follow the PEP8 format styling.

If you dont want to address this right away, we can look into it as a follow-on PR

# Copyright 2022-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Common python APIs and utilities for Intel® Infrastructure Processing Unit (Intel® IPU)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Python (with uppercase P)

@@ -0,0 +1,40 @@
import socket
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be a better idea to use a name for this script that is not the same name as the p4sde/bin/tdishell

@@ -0,0 +1,59 @@
import argparse
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing at start of file

#!/usr/bin/python
#
# Copyright 2022-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

import socket
import re
import argparse

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a short blub of comment describing what this script achieves

sleep 4

echo ""
echo "Check the Interfaces are up"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update language to describing what the verb action more clearly.

Suggested change
echo "Check the Interfaces are up"
echo "Checking if the interfaces are up"

echo 8 > /sys/class/net/'''+host_idpf_intf+'''/device/sriov_numvfs

echo ""
echo "Wait for the interfaces to come up"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

Suggested change
echo "Wait for the interfaces to come up"
echo "Waiting for the interfaces to come up"

Same comment applies to other echo statements in this file. Please review


host_command_list.append(host_idpf)
host_command_list.append(f"chmod +x ./{file}")
#host_command_list.append(f"./{file}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused code

acc_path = test_setup.test_config['test_params']['acc_path']
acc_p4_path = f'{acc_path}/fxp-net_linux-networking'
file = f'{path}/es2k_skip_p4.conf'
p4_config = 'cat <<EOF > ./'+file+'''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for future improvement: Use a file and ingest that instead of hardcoding values inside a Python script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants