[mellanox]: Add support for Mellanox MSN2010 (#2069)

* [device]: Add support for Mellanox MSN2010
MSN2010 runs on Spectrum silicon and has 22 ports:
18 25GbE and 4 100GbE
* [device]: Fix a potential qos config issue for MSN2700

Signed-off-by: Kevin Wang <kevinw@mellanox.com>
This commit is contained in:
Kevin(Shengkai) Wang 2018-09-23 07:24:12 +08:00 committed by lguohan
parent 018b5899be
commit 715806c906
10 changed files with 339 additions and 30 deletions

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers.json.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t0.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/buffers_defaults_t1.j2

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/pg_profile_lookup.ini

View File

@ -1,23 +1,33 @@
# name lanes # name lanes index
Ethernet0 0 Ethernet0 0 0
Ethernet4 4 Ethernet4 4 1
Ethernet8 8 Ethernet8 8 2
Ethernet12 12 Ethernet12 12 3
Ethernet16 16 Ethernet16 16 4
Ethernet20 20 Ethernet20 20 5
Ethernet24 24 Ethernet24 24 6
Ethernet28 28 Ethernet28 28 7
Ethernet32 32 Ethernet32 32 8
Ethernet36 36 Ethernet36 36 9
Ethernet40 40 Ethernet40 40 10
Ethernet44 44 Ethernet44 44 11
Ethernet48 48 Ethernet48 48 12
Ethernet52 52 Ethernet52 52 13
Ethernet56 56 Ethernet56 56 14
Ethernet60 60 Ethernet60 60 15
Ethernet64 64 Ethernet64 64 16
Ethernet68 68 Ethernet68 68 17
Ethernet72 72,73,74,75 Ethernet72 72 18
Ethernet76 76,77,78,79 Ethernet76 73 18
Ethernet80 80,81,82,83 Ethernet80 74 18
Ethernet84 84,85,86,87 Ethernet84 75 18
Ethernet88 76 19
Ethernet92 77 19
Ethernet96 78 19
Ethernet100 79 19
Ethernet104 80 20
Ethernet108 81 20
Ethernet112 82 20
Ethernet116 83 20
Ethernet120 84 21
Ethernet124 86 21

View File

@ -0,0 +1 @@
../../x86_64-mlnx_msn2700-r0/ACS-MSN2700/qos.json.j2

View File

@ -0,0 +1,243 @@
<?xml version="1.0"?>
<root>
<platform_info type="2010">
<!-- Device MAC address -->
<device-mac-address>00:02:03:04:05:00</device-mac-address>
<!-- Number of ports in the following port list -->
<number-of-physical-ports>32</number-of-physical-ports>
<!-- List of ports in the device -->
<ports-list>
<port-info>
<local-port>1</local-port>
<module>32</module>
<width>1</width>
<!-- 0 none, 1=2, 2=4, 3=2,4 -->
<breakout-modes>0</breakout-modes>
<!-- (BITMASK) 4096 - 10Gb , 939524096 - 25Gb , 98368 - 40Gb , 3221225472 - 50Gb , 11534336 - 100Gb-->
<port-speed>939524096</port-speed>
</port-info>
<port-info>
<local-port>2</local-port>
<module>33</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>939524096</port-speed>
</port-info>
<port-info>
<local-port>3</local-port>
<module>34</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>939524096</port-speed>
</port-info>
<port-info>
<local-port>4</local-port>
<module>35</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>939524096</port-speed>
</port-info>
<port-info>
<local-port>5</local-port>
<module>36</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>6</local-port>
<module>37</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>7</local-port>
<module>38</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>8</local-port>
<module>39</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>9</local-port>
<module>40</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>10</local-port>
<module>41</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>11</local-port>
<module>42</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>12</local-port>
<module>43</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>13</local-port>
<module>44</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>14</local-port>
<module>45</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>15</local-port>
<module>46</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>16</local-port>
<module>47</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>17</local-port>
<module>48</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>18</local-port>
<module>49</module>
<width>1</width>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>19</local-port>
<width>1</width>
<module>3</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>20</local-port>
<width>1</width>
<module>4</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>21</local-port>
<width>1</width>
<module>5</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>22</local-port>
<width>1</width>
<module>6</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>23</local-port>
<width>1</width>
<module>7</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>24</local-port>
<width>1</width>
<module>8</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>25</local-port>
<width>1</width>
<module>9</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>26</local-port>
<width>1</width>
<module>10</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>27</local-port>
<width>1</width>
<module>11</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>28</local-port>
<width>1</width>
<module>12</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>29</local-port>
<width>1</width>
<module>13</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>30</local-port>
<width>1</width>
<module>14</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>31</local-port>
<width>1</width>
<module>15</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
<port-info>
<local-port>32</local-port>
<width>1</width>
<module>16</module>
<breakout-modes>0</breakout-modes>
<port-speed>4096</port-speed>
</port-info>
</ports-list>
</platform_info>
</root>

View File

@ -64,10 +64,11 @@ class PsuUtil(PsuBase):
if index is None: if index is None:
return False return False
status = 0
try: try:
with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status: with open(self.psu_path + self.psu_presence.format(index), 'r') as presence_status:
return True status = int(presence_status.read())
except IOError: except IOError:
return False return False
return False return status == 1

View File

@ -10,18 +10,28 @@ try:
except ImportError as e: except ImportError as e:
raise ImportError("%s - required module not found" % str(e)) raise ImportError("%s - required module not found" % str(e))
# parameters for DB connection
REDIS_HOSTNAME = "localhost"
REDIS_PORT = 6379
REDIS_TIMEOUT_USECS = 0
class SfpUtil(SfpUtilBase): class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class""" """Platform-specific SfpUtil class"""
PORT_START = 0 PORT_START = 0
PORT_END = 55 PORT_END = 21
PORTS_IN_BLOCK = 56 PORTS_IN_BLOCK = 22
QSFP_PORT_START = 18
EEPROM_OFFSET = 1 EEPROM_OFFSET = 1
_port_to_eeprom_mapping = {} _port_to_eeprom_mapping = {}
db_sel = None
db_sel_timeout = None
db_sel_object = None
db_sel_tbl = None
state_db = None
sfpd_status_tbl = None
@property @property
def port_start(self): def port_start(self):
return self.PORT_START return self.PORT_START
@ -32,7 +42,7 @@ class SfpUtil(SfpUtilBase):
@property @property
def qsfp_ports(self): def qsfp_ports(self):
return range(0, self.PORTS_IN_BLOCK + 1) return range(self.QSFP_PORT_START, self.PORTS_IN_BLOCK + 1)
@property @property
def port_to_eeprom_mapping(self): def port_to_eeprom_mapping(self):
@ -46,6 +56,7 @@ class SfpUtil(SfpUtilBase):
SfpUtilBase.__init__(self) SfpUtilBase.__init__(self)
def get_presence(self, port_num): def get_presence(self, port_num):
# Check for invalid port_num # Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end: if port_num < self.port_start or port_num > self.port_end:
@ -149,3 +160,39 @@ class SfpUtil(SfpUtilBase):
return False return False
return False return False
def get_transceiver_change_event(self, timeout=0):
phy_port_dict = {}
status = True
if self.db_sel == None:
from swsscommon import swsscommon
self.state_db = swsscommon.DBConnector(swsscommon.STATE_DB,
REDIS_HOSTNAME,
REDIS_PORT,
REDIS_TIMEOUT_USECS)
# Subscribe to state table for SFP change notifications
self.db_sel = swsscommon.Select()
self.db_sel_tbl = swsscommon.NotificationConsumer(self.state_db, 'TRANSCEIVER_NOTIFY')
self.db_sel.addSelectable(self.db_sel_tbl)
self.db_sel_timeout = swsscommon.Select.TIMEOUT
self.db_sel_object = swsscommon.Select.OBJECT
self.sfpd_status_tbl = swsscommon.Table(self.state_db, 'MLNX_SFPD_TASK')
# Check the liveness of mlnx-sfpd, if it failed, return false
keys = self.sfpd_status_tbl.getKeys()
if 'LIVENESS' not in keys:
return False, phy_port_dict
(state, c) = self.db_sel.select(timeout)
if state == self.db_sel_timeout:
status = True
elif state != self.db_sel_object:
status = False
else:
(key, op, fvp) = self.db_sel_tbl.pop()
phy_port_dict[key] = op
return status, phy_port_dict

View File

@ -177,6 +177,9 @@
} }
}, },
"QUEUE": { "QUEUE": {
"{{ port_names_active }}|0-1" : {
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]"
},
"{{ port_names_active }}|3-4" : { "{{ port_names_active }}|3-4" : {
"scheduler" : "[SCHEDULER|scheduler.0]", "scheduler" : "[SCHEDULER|scheduler.0]",
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]" "wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]"