Skip to content

Commit

Permalink
[ingrasys]: Updating index value starts from 0-based in port_config.i…
Browse files Browse the repository at this point in the history
…ni (sonic-net#1176)

- What I did
    Update index value from 1-based to 0-based

- How I did it
    The below files will be modified:
    1. port_config.ini
    2. sfputil.py

- How to verify it
    Execute command "sfputil show eeprom" to check the eeprom can be dumped if port is pluggged.

- Description for the changelog
    Update index value from 1-based to 0-based

Signed-off-by: Sam Yang <yang.kaiyu@gmail.com>
  • Loading branch information
kaiyu22 authored and lguohan committed Nov 22, 2017
1 parent 89742ee commit b06cce2
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# name lanes alias index
Ethernet0 0,1,2,3 Ethernet1/1 1
Ethernet4 4,5,6,7 Ethernet2/1 2
Ethernet8 8,9,10,11 Ethernet3/1 3
Ethernet12 12,13,14,15 Ethernet4/1 4
Ethernet16 16,17,18,19 Ethernet5/1 5
Ethernet20 20,21,22,23 Ethernet6/1 6
Ethernet24 24,25,26,27 Ethernet7/1 7
Ethernet28 28,29,30,31 Ethernet8/1 8
Ethernet32 32,33,34,35 Ethernet9/1 9
Ethernet36 36,37,38,39 Ethernet10/1 10
Ethernet40 40,41,42,43 Ethernet11/1 11
Ethernet44 44,45,46,47 Ethernet12/1 12
Ethernet48 48,49,50,51 Ethernet13/1 13
Ethernet52 52,53,54,55 Ethernet14/1 14
Ethernet56 56,57,58,59 Ethernet15/1 15
Ethernet60 60,61,62,63 Ethernet16/1 16
Ethernet64 64,65,66,67 Ethernet17/1 17
Ethernet68 68,69,70,71 Ethernet18/1 18
Ethernet72 72,73,74,75 Ethernet19/1 19
Ethernet76 76,77,78,79 Ethernet20/1 20
Ethernet80 80,81,82,83 Ethernet21/1 21
Ethernet84 84,85,86,87 Ethernet22/1 22
Ethernet88 88,89,90,91 Ethernet23/1 23
Ethernet92 92,93,94,95 Ethernet24/1 24
Ethernet96 96,97,98,99 Ethernet25/1 25
Ethernet100 100,101,102,103 Ethernet26/1 26
Ethernet104 104,105,106,107 Ethernet27/1 27
Ethernet108 108,109,110,111 Ethernet28/1 28
Ethernet112 112,113,114,115 Ethernet29/1 29
Ethernet116 116,117,118,119 Ethernet30/1 30
Ethernet120 120,121,122,123 Ethernet31/1 31
Ethernet124 124,125,126,127 Ethernet32/1 32
Ethernet0 0,1,2,3 Ethernet1/1 0
Ethernet4 4,5,6,7 Ethernet2/1 1
Ethernet8 8,9,10,11 Ethernet3/1 2
Ethernet12 12,13,14,15 Ethernet4/1 3
Ethernet16 16,17,18,19 Ethernet5/1 4
Ethernet20 20,21,22,23 Ethernet6/1 5
Ethernet24 24,25,26,27 Ethernet7/1 6
Ethernet28 28,29,30,31 Ethernet8/1 7
Ethernet32 32,33,34,35 Ethernet9/1 8
Ethernet36 36,37,38,39 Ethernet10/1 9
Ethernet40 40,41,42,43 Ethernet11/1 10
Ethernet44 44,45,46,47 Ethernet12/1 11
Ethernet48 48,49,50,51 Ethernet13/1 12
Ethernet52 52,53,54,55 Ethernet14/1 13
Ethernet56 56,57,58,59 Ethernet15/1 14
Ethernet60 60,61,62,63 Ethernet16/1 15
Ethernet64 64,65,66,67 Ethernet17/1 16
Ethernet68 68,69,70,71 Ethernet18/1 17
Ethernet72 72,73,74,75 Ethernet19/1 18
Ethernet76 76,77,78,79 Ethernet20/1 19
Ethernet80 80,81,82,83 Ethernet21/1 20
Ethernet84 84,85,86,87 Ethernet22/1 21
Ethernet88 88,89,90,91 Ethernet23/1 22
Ethernet92 92,93,94,95 Ethernet24/1 23
Ethernet96 96,97,98,99 Ethernet25/1 24
Ethernet100 100,101,102,103 Ethernet26/1 25
Ethernet104 104,105,106,107 Ethernet27/1 26
Ethernet108 108,109,110,111 Ethernet28/1 27
Ethernet112 112,113,114,115 Ethernet29/1 28
Ethernet116 116,117,118,119 Ethernet30/1 29
Ethernet120 120,121,122,123 Ethernet31/1 30
Ethernet124 124,125,126,127 Ethernet32/1 31
22 changes: 11 additions & 11 deletions device/ingrasys/x86_64-ingrasys_s9130_32x-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""

PORT_START = 1
PORT_END = 32
PORT_START = 0
PORT_END = 31
PORTS_IN_BLOCK = 32
EEPROM_OFFSET = 20
EEPROM_OFFSET = 21
ABS_GPIO_BASE_0_15 = 240
ABS_GPIO_BASE_16_31 = 224
LP_MODE_GPIO_BASE_0_15 = 176
Expand Down Expand Up @@ -61,11 +61,11 @@ def get_presence(self, port_num):

# open corrsponding gpio file
try:
if port_num <= 16:
if port_num <= 15:
gpio_base = self.ABS_GPIO_BASE_0_15
else :
gpio_base = self.ABS_GPIO_BASE_16_31
gpio_index = gpio_base + ((port_num - 1) % 16)
gpio_index = gpio_base + (port_num % 16)
gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index)
gpio_file = open(gpio_file_path)
except IOError as e:
Expand All @@ -89,11 +89,11 @@ def get_low_power_mode(self, port_num):

# open corrsponding gpio file
try:
if port_num <= 16:
if port_num <= 15:
gpio_base = self.LP_MODE_GPIO_BASE_0_15
else :
gpio_base = self.LP_MODE_GPIO_BASE_16_31
gpio_index = gpio_base + ((port_num - 1) % 16)
gpio_index = gpio_base + (port_num % 16)
gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index)
gpio_file = open(gpio_file_path)
except IOError as e:
Expand All @@ -116,11 +116,11 @@ def set_low_power_mode(self, port_num, lpmode):

# open corrsponding gpio file
try:
if port_num <= 16:
if port_num <= 15:
gpio_base = self.LP_MODE_GPIO_BASE_0_15
else :
gpio_base = self.LP_MODE_GPIO_BASE_16_31
gpio_index = gpio_base + ((port_num - 1) % 16)
gpio_index = gpio_base + (port_num % 16)
gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index)
gpio_file = open(gpio_file_path, "r+")
except IOError as e:
Expand All @@ -147,11 +147,11 @@ def reset(self, port_num):

# open corrsponding gpio file
try:
if port_num <= 16:
if port_num <= 15:
gpio_base = self.RST_GPIO_BASE_0_15
else :
gpio_base = self.RST_GPIO_BASE_16_31
gpio_index = gpio_base + ((port_num - 1) % 16)
gpio_index = gpio_base + (port_num % 16)
gpio_file_path = self.GPIO_VAL_PATH.format(gpio_index)
gpio_file = open(gpio_file_path, "w")
except IOError as e:
Expand Down

0 comments on commit b06cce2

Please sign in to comment.