* [dpdk-dev] [PATCH 1/2] tools/setup.sh: remove 2MB huge page size hard-cording
2016-03-14 12:15 [dpdk-dev] [PATCH 0/2] tools/setup.sh fixes Jerin Jacob
@ 2016-03-14 12:15 ` Jerin Jacob
2016-03-14 12:15 ` [dpdk-dev] [PATCH 2/2] tools/setup.sh: Support built-in kernel modules Jerin Jacob
2016-03-24 21:02 ` [dpdk-dev] [PATCH 0/2] tools/setup.sh fixes Thomas Monjalon
2 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2016-03-14 12:15 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, Jerin Jacob
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
tools/setup.sh | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/tools/setup.sh b/tools/setup.sh
index faa5eee..b290b87 100755
--- a/tools/setup.sh
+++ b/tools/setup.sh
@@ -44,6 +44,8 @@ echo "--------------------------------------------------------------------------
echo " RTE_SDK exported as $RTE_SDK"
echo "------------------------------------------------------------------------------"
+HUGEPGSZ=`cat /proc/meminfo | grep Hugepagesize | cut -d : -f 2 | tr -d ' '`
+
#
# Application EAL parameters for setting memory options (amount/channels/ranks).
#
@@ -325,7 +327,7 @@ clear_huge_pages()
{
echo > .echo_tmp
for d in /sys/devices/system/node/node? ; do
- echo "echo 0 > $d/hugepages/hugepages-2048kB/nr_hugepages" >> .echo_tmp
+ echo "echo 0 > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
done
echo "Removing currently reserved hugepages"
sudo sh .echo_tmp
@@ -342,13 +344,13 @@ set_non_numa_pages()
clear_huge_pages
echo ""
- echo " Input the number of 2MB pages"
- echo " Example: to have 128MB of hugepages available, enter '64' to"
- echo " reserve 64 * 2MB pages"
+ echo " Input the number of ${HUGEPGSZ} hugepages"
+ echo " Example: to have 128MB of hugepages available in a 2MB huge page system,"
+ echo " enter '64' to reserve 64 * 2MB pages"
echo -n "Number of pages: "
read Pages
- echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" > .echo_tmp
+ echo "echo $Pages > /sys/kernel/mm/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" > .echo_tmp
echo "Reserving hugepages"
sudo sh .echo_tmp
@@ -365,8 +367,8 @@ set_numa_pages()
clear_huge_pages
echo ""
- echo " Input the number of 2MB pages for each node"
- echo " Example: to have 128MB of hugepages available per node,"
+ echo " Input the number of ${HUGEPGSZ} hugepages for each node"
+ echo " Example: to have 128MB of hugepages available per node in a 2MB huge page system,"
echo " enter '64' to reserve 64 * 2MB pages on each node"
echo > .echo_tmp
@@ -374,7 +376,7 @@ set_numa_pages()
node=$(basename $d)
echo -n "Number of pages for $node: "
read Pages
- echo "echo $Pages > $d/hugepages/hugepages-2048kB/nr_hugepages" >> .echo_tmp
+ echo "echo $Pages > $d/hugepages/hugepages-${HUGEPGSZ}/nr_hugepages" >> .echo_tmp
done
echo "Reserving hugepages"
sudo sh .echo_tmp
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH 2/2] tools/setup.sh: Support built-in kernel modules
2016-03-14 12:15 [dpdk-dev] [PATCH 0/2] tools/setup.sh fixes Jerin Jacob
2016-03-14 12:15 ` [dpdk-dev] [PATCH 1/2] tools/setup.sh: remove 2MB huge page size hard-cording Jerin Jacob
@ 2016-03-14 12:15 ` Jerin Jacob
2016-03-24 21:02 ` [dpdk-dev] [PATCH 0/2] tools/setup.sh fixes Thomas Monjalon
2 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2016-03-14 12:15 UTC (permalink / raw)
To: dev; +Cc: thomas.monjalon, Jerin Jacob
probe the kernel module existence through /sys/module/ to make it work
with both module and inbuilt kernel module
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
tools/setup.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/setup.sh b/tools/setup.sh
index b290b87..6097ab7 100755
--- a/tools/setup.sh
+++ b/tools/setup.sh
@@ -427,7 +427,7 @@ grep_meminfo()
#
show_nics()
{
- if /sbin/lsmod | grep -q -e igb_uio -e vfio_pci; then
+ if [ -d /sys/module/vfio_pci -o -d /sys/module/igb_uio ]; then
${RTE_SDK}/tools/dpdk_nic_bind.py --status
else
echo "# Please load the 'igb_uio' or 'vfio-pci' kernel module before "
@@ -440,7 +440,7 @@ show_nics()
#
bind_nics_to_vfio()
{
- if /sbin/lsmod | grep -q vfio_pci ; then
+ if [ -d /sys/module/vfio_pci ]; then
${RTE_SDK}/tools/dpdk_nic_bind.py --status
echo ""
echo -n "Enter PCI address of device to bind to VFIO driver: "
@@ -458,7 +458,7 @@ bind_nics_to_vfio()
#
bind_nics_to_igb_uio()
{
- if /sbin/lsmod | grep -q igb_uio ; then
+ if [ -d /sys/module/igb_uio ]; then
${RTE_SDK}/tools/dpdk_nic_bind.py --status
echo ""
echo -n "Enter PCI address of device to bind to IGB UIO driver: "
--
2.1.0
^ permalink raw reply [flat|nested] 4+ messages in thread