[centec]update centec e582 platform drivers and libsai (#2043)

* update centec e582 platform drivers and libsai

* delete minigraph.xml

* remove minigraph

* update psuutil.py comments

* update device qos config file and clean minigraph
This commit is contained in:
yangbashuang 2018-11-17 01:41:39 +08:00 committed by lguohan
parent 3b4d85239f
commit 0b3a885e39
52 changed files with 5055 additions and 2193 deletions

View File

@ -0,0 +1,70 @@
{# Default values which will be used if no actual configura available #}
{% set default_cable = '40m' %}
{% set default_ports_num = 54 -%}
{# Port configuration to cable length look-up table #}
{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #}
{# Roles described in the minigraph #}
{% set ports2cable = {
'torrouter_server' : '5m',
'leafrouter_torrouter' : '40m',
'spinerouter_leafrouter' : '300m'
}
%}
{%- macro cable_length(port_name) -%}
{%- set cable_len = [] -%}
{%- for local_port in DEVICE_NEIGHBOR -%}
{%- if local_port == port_name -%}
{%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
{%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%}
{%- set neighbor_role = neighbor.type -%}
{%- set roles1 = switch_role + '_' + neighbor_role %}
{%- set roles2 = neighbor_role + '_' + switch_role -%}
{%- set roles1 = roles1 | lower -%}
{%- set roles2 = roles2 | lower -%}
{%- if roles1 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%}
{%- elif roles2 in ports2cable -%}
{%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if cable_len -%}
{{ cable_len.0 }}
{%- else -%}
{{ default_cable }}
{%- endif -%}
{% endmacro %}
{%- if DEVICE_METADATA is defined %}
{%- set switch_role = DEVICE_METADATA['localhost']['type'] %}
{%- endif -%}
{# Generate list of ports if not defined #}
{% if PORT is not defined %}
{% set PORT = [] %}
{% for port_idx in range(1,default_ports_num+1) %}
{% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %}
{% endfor %}
{% endif -%}
{% set port_names_list = [] %}
{% for port in PORT %}
{%- if port_names_list.append(port) %}{% endif %}
{% endfor %}
{% set port_names = port_names_list | join(',') -%}
{
"CABLE_LENGTH": {
"AZURE": {
{% for port in PORT %}
{% set cable = cable_length(port) -%}
"{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %}
{% endfor %}
}
}
}

View File

@ -0,0 +1,21 @@
# PG lossless profiles.
# speed cable size xon xoff threshold
1000 5m 34816 18432 16384 0
10000 5m 34816 18432 16384 0
25000 5m 34816 18432 16384 0
40000 5m 34816 18432 16384 0
50000 5m 34816 18432 16384 0
100000 5m 36864 18432 18432 0
1000 40m 36864 18432 18432 0
10000 40m 36864 18432 18432 0
25000 40m 39936 18432 21504 0
40000 40m 41984 18432 23552 0
50000 40m 41984 18432 23552 0
100000 40m 54272 18432 35840 0
1000 300m 49152 18432 30720 0
10000 300m 49152 18432 30720 0
25000 300m 71680 18432 53248 0
40000 300m 94208 18432 75776 0
50000 300m 94208 18432 75776 0
100000 300m 184320 18432 165888 0

View File

@ -0,0 +1,55 @@
# name lanes alias speed
Ethernet1 75 eth-0-1 1000
Ethernet2 73 eth-0-2 1000
Ethernet3 72 eth-0-3 1000
Ethernet4 70 eth-0-4 1000
Ethernet5 69 eth-0-5 1000
Ethernet6 67 eth-0-6 1000
Ethernet7 66 eth-0-7 1000
Ethernet8 64 eth-0-8 1000
Ethernet9 63 eth-0-9 1000
Ethernet10 61 eth-0-10 1000
Ethernet11 60 eth-0-11 1000
Ethernet12 58 eth-0-12 1000
Ethernet13 57 eth-0-13 10000
Ethernet14 56 eth-0-14 10000
Ethernet15 55 eth-0-15 10000
Ethernet16 53 eth-0-16 10000
Ethernet17 52 eth-0-17 10000
Ethernet18 50 eth-0-18 10000
Ethernet19 49 eth-0-19 10000
Ethernet20 48 eth-0-20 10000
Ethernet21 0 eth-0-21 10000
Ethernet22 1 eth-0-22 10000
Ethernet23 3 eth-0-23 10000
Ethernet24 2 eth-0-24 10000
Ethernet25 4 eth-0-25 10000
Ethernet26 5 eth-0-26 10000
Ethernet27 6 eth-0-27 10000
Ethernet28 7 eth-0-28 10000
Ethernet29 8 eth-0-29 10000
Ethernet30 9 eth-0-30 10000
Ethernet31 10 eth-0-31 10000
Ethernet32 12 eth-0-32 10000
Ethernet33 13 eth-0-33 10000
Ethernet34 15 eth-0-34 10000
Ethernet35 16 eth-0-35 10000
Ethernet36 18 eth-0-36 10000
Ethernet37 19 eth-0-37 10000
Ethernet38 21 eth-0-38 10000
Ethernet39 22 eth-0-39 10000
Ethernet40 24 eth-0-40 10000
Ethernet41 25 eth-0-41 10000
Ethernet42 27 eth-0-42 10000
Ethernet43 28 eth-0-43 10000
Ethernet44 30 eth-0-44 10000
Ethernet45 31 eth-0-45 10000
Ethernet46 33 eth-0-46 10000
Ethernet47 34 eth-0-47 10000
Ethernet48 36 eth-0-48 10000
Ethernet49 42,41,43,40 eth-0-49 40000
Ethernet50 45,46,44,47 eth-0-50 40000
Ethernet51 94,93,95,92 eth-0-51 100000
Ethernet52 89,90,88,91 eth-0-52 100000
Ethernet53 85,86,84,87 eth-0-53 100000
Ethernet54 81,82,80,83 eth-0-54 100000

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -0,0 +1,2 @@
SAI_INIT_CONFIG_FILE=/etc/centec/E582-48x2q4z-chip-profile.txt
SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/etc/centec/E582-48x2q4z-datapath-cfg.txt

View File

@ -0,0 +1 @@
E582-48x2q4z t1

View File

@ -0,0 +1,10 @@
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon1=devices/platform/coretemp.0 hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-15/15-002f
DEVNAME=hwmon1=coretemp hwmon5=adt7470
FCTEMPS=hwmon5/pwm4=hwmon1/temp1_input hwmon5/pwm3=hwmon1/temp1_input hwmon5/pwm2=hwmon1/temp1_input hwmon5/pwm1=hwmon1/temp1_input
FCFANS=hwmon5/pwm4=hwmon5/fan4_input hwmon5/pwm3=hwmon5/fan3_input hwmon5/pwm2=hwmon5/fan2_input hwmon5/pwm1=hwmon5/fan1_input
MINTEMP=hwmon5/pwm4=20 hwmon5/pwm3=20 hwmon5/pwm2=20 hwmon5/pwm1=20
MAXTEMP=hwmon5/pwm4=60 hwmon5/pwm3=60 hwmon5/pwm2=60 hwmon5/pwm1=60
MINSTART=hwmon5/pwm4=150 hwmon5/pwm3=150 hwmon5/pwm2=150 hwmon5/pwm1=150
MINSTOP=hwmon5/pwm4=0 hwmon5/pwm3=0 hwmon5/pwm2=0 hwmon5/pwm1=100

View File

@ -0,0 +1,2 @@
CONSOLE_SPEED=115200
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="acpi_enforce_resources=no"

View File

@ -0,0 +1,31 @@
#!/usr/bin/env python
#############################################################################
# Centec E582-48X6Q
#
# Platform and model specific eeprom subclass, inherits from the base class,
# and provides the followings:
# - the eeprom format definition
# - specific encoder/decoder if there is special need
#############################################################################
try:
import exceptions
import binascii
import time
import optparse
import warnings
import os
import sys
import subprocess
from sonic_eeprom import eeprom_base
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0057/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,153 @@
#!/usr/bin/env python
#
# led_control.py
#
# Platform-specific LED control functionality for SONiC
#
try:
from sonic_led.led_control_base import LedControlBase
import swsssdk
import threading
import os
import logging
import struct
import time
import syslog
from socket import *
from select import *
except ImportError, e:
raise ImportError(str(e) + " - required module not found")
def DBG_PRINT(str):
syslog.openlog("centec-led")
syslog.syslog(syslog.LOG_INFO, str)
syslog.closelog()
class LedControl(LedControlBase):
"""Platform specific LED control class"""
SONIC_PORT_NAME_PREFIX = "Ethernet"
LED_MODE_UP = [11, 1]
LED_MODE_DOWN = [7, 2]
def _initSystemLed(self):
try:
with open(self.f_led.format("system"), 'w') as led_file:
led_file.write("5")
DBG_PRINT("init system led to normal")
with open(self.f_led.format("idn"), 'w') as led_file:
led_file.write("1")
DBG_PRINT("init idn led to off")
except IOError as e:
DBG_PRINT(str(e))
def _initPanelLed(self):
with open(self.f_led.format("port1"), 'r') as led_file:
shouldInit = (int(led_file.read()) == 0)
if shouldInit == True:
for (port, ctlid, defmode) in self.led_mapping[1:59]:
data = struct.pack('=HHHBBH', 0, 7, 4, ctlid, defmode, port)
self.udpClient.sendto(data, ('localhost', 8101))
data = struct.pack('=HHHBB30B', 0, 3, 32, 30, 0, *[x[0] for x in self.led_mapping[21:51]])
self.udpClient.sendto(data, ('localhost', 8101))
data = struct.pack('=HHHBB28B', 0, 3, 30, 28, 1, *[x[0] for x in (self.led_mapping[1:21]+self.led_mapping[51:59])])
self.udpClient.sendto(data, ('localhost', 8101))
data = struct.pack('=HHHB', 0, 5, 1, 1)
self.udpClient.sendto(data, ('localhost', 8101))
for idx in range(1, 55):
(port, ctlid, defmode) = self.led_mapping[idx]
with open(self.f_led.format("port{}".format(idx)), 'w') as led_file:
led_file.write(str(defmode))
DBG_PRINT("init port{} led to mode={}".format(idx, defmode))
for idx in range(1, 55):
(port, ctlid, defmode) = self.led_mapping[idx]
with open(self.f_led.format("port{}".format(idx)), 'r') as led_file:
defmode = int(led_file.read())
data = struct.pack('=HHHBBH', 0, 7, 4, ctlid, defmode, port)
self.udpClient.sendto(data, ('localhost', 8101))
DBG_PRINT("init port{} led to mode={}".format(idx, defmode))
def _initDefaultConfig(self):
DBG_PRINT("start init led")
while True:
try:
r_sel = [self.udpClient]
echo_req = struct.pack('=HHH', 0, 1, 0)
self.udpClient.sendto(echo_req, ('localhost', 8101))
result = select(r_sel, [], [], 1)
if self.udpClient in result[0]:
echo_rsp, srv_addr = self.udpClient.recvfrom(1024)
if echo_rsp:
break
DBG_PRINT("connect to sdk rpc server timeout, try again.")
except IOError as e:
DBG_PRINT(str(e))
DBG_PRINT("connect to sdk rpc server success.")
self._initSystemLed()
self._initPanelLed()
DBG_PRINT("init led done")
# Helper method to map SONiC port name to index
def _port_name_to_index(self, port_name):
# Strip "Ethernet" off port name
if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX):
return -1
port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):])
return port_idx
def _port_state_to_mode(self, port_idx, state):
if state == "up":
return self.LED_MODE_UP[0] if (port_idx < 49) else self.LED_MODE_UP[1]
else:
return self.LED_MODE_DOWN[0] if (port_idx < 49) else self.LED_MODE_DOWN[1]
def _port_led_mode_update(self, port_idx, ledMode):
with open(self.f_led.format("port{}".format(port_idx)), 'w') as led_file:
led_file.write(str(ledMode))
(port, ctlid) = (self.led_mapping[port_idx][0], self.led_mapping[port_idx][1])
data = struct.pack('=HHHBBH', 0, 7, 4, ctlid, ledMode, port)
self.udpClient.sendto(data, ('localhost', 8101))
# Concrete implementation of port_link_state_change() method
def port_link_state_change(self, portname, state):
port_idx = self._port_name_to_index(portname)
ledMode = self._port_state_to_mode(port_idx, state)
with open(self.f_led.format("port{}".format(port_idx)), 'r') as led_file:
saveMode = int(led_file.read())
if ledMode == saveMode:
return
self._port_led_mode_update(port_idx, ledMode)
DBG_PRINT("update {} led mode from {} to {}".format(portname, saveMode, ledMode))
# Constructor
def __init__(self):
# [macid, ctlid, defaultmode]
self.led_mapping = [(0, 0, 0)] # resv
self.led_mapping.extend([(27, 1, 7), (25, 1, 7), (24, 1, 7), (22, 1, 7), (21, 1, 7), (19, 1, 7), (18, 1, 7), (16, 1, 7)]) # panel port 1~8
self.led_mapping.extend([(15, 1, 7), (13, 1, 7), (12, 1, 7), (10, 1, 7), (9, 1, 7), (8, 1, 7), (7, 1, 7), (5, 1, 7)]) # panel port 9~16
self.led_mapping.extend([(4, 1, 7), (2, 1, 7), (1, 1, 7), (0, 1, 7), (0, 0, 7), (1, 0, 7), (3, 0, 7), (2, 0, 7)]) # panel port 17~24
self.led_mapping.extend([(4, 0, 7), (5, 0, 7), (6, 0, 7), (7, 0, 7), (8, 0, 7), (9, 0, 7), (10, 0, 7), (12, 0, 7)]) # panel port 25~32
self.led_mapping.extend([(13, 0, 7), (15, 0, 7), (16, 0, 7), (18, 0, 7), (19, 0, 7), (21, 0, 7), (22, 0, 7), (24, 0, 7)]) # panel port 33~40
self.led_mapping.extend([(25, 0, 7), (27, 0, 7), (28, 0, 7), (30, 0, 7), (31, 0, 7), (33, 0, 7), (34, 0, 7), (48, 0, 7)]) # panel port 41~48
self.led_mapping.extend([(36, 0, 2), (52, 0, 2), (52, 1, 2), (36, 1, 2), (48, 1, 2), (32, 1, 2)]) # panel port 49~54
self.led_mapping.extend([(11, 1, 2), (11, 1, 2), (11, 1, 2), (11, 1, 2), (11, 1, 2), (11, 1, 2)])
self.f_led = "/sys/class/leds/{}/brightness"
self.udpClient = socket(AF_INET, SOCK_DGRAM)
self._initDefaultConfig()

View File

@ -0,0 +1,74 @@
#!/usr/bin/env python
#############################################################################
# Centec
#
# Module contains an implementation of SONiC PSU Base API and
# provides the PSUs status which are available in the platform
#
#############################################################################
import os.path
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
def __init__(self):
PsuBase.__init__(self)
self.psu_path = "/sys/class/psu/psu{}/"
self.psu_presence = "psu_presence"
self.psu_oper_status = "psu_status"
def get_num_psus(self):
"""
Retrieves the number of PSUs available on the device
:return: An integer, the number of PSUs available on the device
"""
return 2
def get_psu_status(self, index):
"""
Retrieves the oprational status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is operating properly, False if PSU is faulty
"""
if index is None:
return False
status = 0
try:
with open(self.psu_path.format(index) + self.psu_oper_status, 'r') as power_status:
status = int(power_status.read())
except IOError:
return False
return status == 0
def get_psu_presence(self, index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
if index is None:
return False
status = 0
try:
with open(self.psu_path.format(index) + self.psu_presence, 'r') as presence_status:
status = int(presence_status.read())
except IOError:
return False
return status == 0

View File

@ -0,0 +1,162 @@
#!/usr/bin/env python
# sfputil.py
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
import os
import logging
import struct
import syslog
from socket import *
from select import *
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
def DBG_PRINT(str):
print str + "\n"
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
SONIC_PORT_NAME_PREFIX = "Ethernet"
PORT_START = 1
PORT_END = 54
PORTS_IN_BLOCK = 54
@property
def port_start(self):
return self.PORT_START
@property
def port_end(self):
return self.PORT_END
@property
def qsfp_ports(self):
return range(49, self.PORTS_IN_BLOCK + 1)
@property
def port_to_eeprom_mapping(self):
return self.eeprom_mapping
def is_logical_port(self, port_name):
return True
def get_logical_to_physical(self, port_name):
if not port_name.startswith(self.SONIC_PORT_NAME_PREFIX):
return None
port_idx = int(port_name[len(self.SONIC_PORT_NAME_PREFIX):])
return [port_idx]
def get_eeprom_data(self, port):
(ctlid, devid) = self.fiber_mapping[port]
offset = (128 if port in self.qsfp_ports else 0)
r_sel = [self.udpClient]
req = struct.pack('=HHHBBHIBBBBI',
0, 9, 16, # lchip/msgtype/msglen
ctlid, # uint8 ctl_id
devid, # uint8 slave_dev_id
0x50, # uint16 dev_addr
(1<<devid), # uint32 slave_bitmap
offset, # uint8 offset
95, # uint8 length
0xf, # uint8 i2c_switch_id
0, # uint8 access_switch
95 # uint32 buf_length
)
self.udpClient.sendto(req, ('localhost', 8101))
result = select(r_sel, [], [], 1)
if self.udpClient in result[0]:
rsp, addr = self.udpClient.recvfrom(1024)
if rsp:
rsp_data = struct.unpack('=HHHBBHIBBBBIi512B', rsp)
if rsp_data[12] != 0:
return None
if port in self.qsfp_ports:
return buffer(bytearray([0]*128), 0, 128) + buffer(rsp, 26, 512)
return buffer(rsp, 26, 512)
return None
def __init__(self):
"""[ctlid, slavedevid]"""
self.fiber_mapping = [(0, 0)] # res
self.fiber_mapping.extend([(1, 7), (1, 6), (1, 5), (1, 4), (1, 3), (1, 2), (1, 1), (1, 0)]) # panel port 1~8
self.fiber_mapping.extend([(1, 15), (1, 14), (1, 13), (1, 12), (1, 11), (1, 10), (1, 9), (1, 8)]) # panel port 9~16
self.fiber_mapping.extend([(1, 19), (1, 17), (1, 16), (1, 18), (0, 7), (0, 6), (0, 5), (0, 4)]) # panel port 17~24
self.fiber_mapping.extend([(0, 3), (0, 2), (0, 1), (0, 0), (0, 15), (0, 14), (0, 13), (0, 12)]) # panel port 25~32
self.fiber_mapping.extend([(0, 11), (0, 10), (0, 9), (0, 8), (0, 23), (0, 22), (0, 21), (0, 20)]) # panel port 33~40
self.fiber_mapping.extend([(0, 19), (0, 18), (0, 17), (0, 16), (0, 31), (0, 26), (0, 29), (0, 27)]) # panel port 41~48
self.fiber_mapping.extend([(0, 24), (0, 25), (1, 23), (1, 22), (1, 21), (1, 20)]) # panel port 49~54
self.udpClient = socket(AF_INET, SOCK_DGRAM)
self.eeprom_mapping = {}
self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence"
self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable"
for x in range(1, self.port_end + 1):
self.eeprom_mapping[x] = "/var/cache/sonic/sfp/sfp{}_eeprom".format(x)
try:
if not os.path.exists("/var/cache/sonic/sfp"):
os.makedirs("/var/cache/sonic/sfp", 0777)
for x in range(1, self.port_end + 1):
if not self.get_presence(x):
if os.path.exists(self.eeprom_mapping[x]):
os.remove(self.eeprom_mapping[x])
continue
data = self.get_eeprom_data(x)
if data:
with open(self.eeprom_mapping[x], 'w') as sfp_eeprom:
sfp_eeprom.write(data)
else:
DBG_PRINT("get sfp{} eeprom data failed.".format(x))
break
except IOError as e:
DBG_PRINT(str(e))
SfpUtilBase.__init__(self)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
try:
with open(self.f_sfp_present.format(port_num), 'r') as sfp_file:
return 1 == int(sfp_file.read())
except IOError as e:
DBG_PRINT(str(e))
return False
def get_low_power_mode(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
return False
def set_low_power_mode(self, port_num, lpmode):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
return False
def reset(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False
return False
def get_transceiver_change_event(self, timeout=0):
return False, {}

View File

@ -1,55 +1,55 @@
# name lanes
Ethernet1 4
Ethernet2 5
Ethernet3 6
Ethernet4 8
Ethernet5 9
Ethernet6 10
Ethernet7 12
Ethernet8 13
Ethernet9 14
Ethernet10 16
Ethernet11 17
Ethernet12 18
Ethernet13 20
Ethernet14 21
Ethernet15 22
Ethernet16 24
Ethernet17 25
Ethernet18 26
Ethernet19 28
Ethernet20 30
Ethernet21 31
Ethernet22 32
Ethernet23 34
Ethernet24 35
Ethernet25 40
Ethernet26 41
Ethernet27 43
Ethernet28 36
Ethernet29 37
Ethernet30 39
Ethernet31 44
Ethernet32 45
Ethernet33 46
Ethernet34 47
Ethernet35 80
Ethernet36 81
Ethernet37 82
Ethernet38 88
Ethernet39 89
Ethernet40 90
Ethernet41 84
Ethernet42 85
Ethernet43 86
Ethernet44 87
Ethernet45 92
Ethernet46 93
Ethernet47 94
Ethernet48 95
Ethernet49 52,53,54,55
Ethernet50 56,57,58,59
Ethernet51 60,61,62,63
Ethernet52 68,69,70,71
Ethernet53 72,73,74,75
Ethernet54 76,77,78,79
# name lanes alias speed
Ethernet1 4 eth-0-1 1000
Ethernet2 5 eth-0-2 1000
Ethernet3 6 eth-0-3 1000
Ethernet4 8 eth-0-4 1000
Ethernet5 9 eth-0-5 1000
Ethernet6 10 eth-0-6 1000
Ethernet7 12 eth-0-7 1000
Ethernet8 13 eth-0-8 1000
Ethernet9 14 eth-0-9 1000
Ethernet10 16 eth-0-10 1000
Ethernet11 17 eth-0-11 1000
Ethernet12 18 eth-0-12 1000
Ethernet13 20 eth-0-13 10000
Ethernet14 21 eth-0-14 10000
Ethernet15 22 eth-0-15 10000
Ethernet16 24 eth-0-16 10000
Ethernet17 25 eth-0-17 10000
Ethernet18 26 eth-0-18 10000
Ethernet19 28 eth-0-19 10000
Ethernet20 30 eth-0-20 10000
Ethernet21 31 eth-0-21 10000
Ethernet22 32 eth-0-22 10000
Ethernet23 34 eth-0-23 10000
Ethernet24 35 eth-0-24 10000
Ethernet25 36 eth-0-25 10000
Ethernet26 37 eth-0-26 10000
Ethernet27 39 eth-0-27 10000
Ethernet28 40 eth-0-28 10000
Ethernet29 41 eth-0-29 10000
Ethernet30 43 eth-0-30 10000
Ethernet31 47 eth-0-31 10000
Ethernet32 46 eth-0-32 10000
Ethernet33 45 eth-0-33 10000
Ethernet34 44 eth-0-34 10000
Ethernet35 92 eth-0-35 10000
Ethernet36 93 eth-0-36 10000
Ethernet37 94 eth-0-37 10000
Ethernet38 95 eth-0-38 10000
Ethernet39 90 eth-0-39 10000
Ethernet40 89 eth-0-40 10000
Ethernet41 88 eth-0-41 10000
Ethernet42 87 eth-0-42 10000
Ethernet43 86 eth-0-43 10000
Ethernet44 85 eth-0-44 10000
Ethernet45 84 eth-0-45 10000
Ethernet46 82 eth-0-46 10000
Ethernet47 81 eth-0-47 10000
Ethernet48 80 eth-0-48 10000
Ethernet49 77,78,76,79 eth-0-49 40000
Ethernet50 73,74,72,75 eth-0-50 40000
Ethernet51 70,71,69,68 eth-0-51 40000
Ethernet52 61,63,60,62 eth-0-52 40000
Ethernet53 59,57,58,56 eth-0-53 40000
Ethernet54 53,55,54,52 eth-0-54 40000

View File

@ -1,133 +0,0 @@
{
"DSCP_TO_TC_MAP": {
"AZURE": {
"0":"0",
"1":"0",
"2":"0",
"3":"0",
"4":"0",
"5":"0",
"6":"0",
"7":"0",
"8":"1",
"9":"1",
"10":"1",
"11":"1",
"12":"1",
"13":"1",
"14":"1",
"15":"1",
"16":"2",
"17":"2",
"18":"2",
"19":"2",
"20":"2",
"21":"2",
"22":"2",
"23":"2",
"24":"3",
"25":"3",
"26":"3",
"27":"3",
"28":"3",
"29":"3",
"30":"3",
"31":"3",
"32":"4",
"33":"4",
"34":"4",
"35":"4",
"36":"4",
"37":"4",
"38":"4",
"39":"4",
"40":"5",
"41":"5",
"42":"5",
"43":"5",
"44":"5",
"45":"5",
"46":"5",
"47":"5",
"48":"6",
"49":"6",
"50":"6",
"51":"6",
"52":"6",
"53":"6",
"54":"6",
"55":"6",
"56":"7",
"57":"7",
"58":"7",
"59":"7",
"60":"7",
"61":"7",
"62":"7",
"63":"7"
}
},
"SCHEDULER": {
"scheduler.0": {
"type":"DWRR",
"weight": "25"
},
"scheduler.1": {
"type":"DWRR",
"weight": "30"
},
"scheduler.2": {
"type":"DWRR",
"weight": "20"
}
},
"PORT_QOS_MAP": {
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54": {
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
"pfc_enable": "3,4"
}
},
"WRED_PROFILE": {
"AZURE_LOSSY": {
"wred_green_enable":"true",
"wred_yellow_enable":"true",
"red_max_threshold":"32760",
"red_min_threshold":"4095",
"yellow_max_threshold":"32760",
"yellow_min_threshold":"4095",
"green_max_threshold": "32760",
"green_min_threshold": "4095"
},
"AZURE_LOSSLESS": {
"wred_green_enable":"true",
"wred_yellow_enable":"true",
"red_max_threshold":"32760",
"red_min_threshold":"4095",
"yellow_max_threshold":"32760",
"yellow_min_threshold":"4095",
"green_max_threshold": "32760",
"green_min_threshold": "4095"
}
},
"QUEUE": {
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|0-2": {
"scheduler" : "[SCHEDULER|scheduler.1]"
},
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|5-7": {
"scheduler" : "[SCHEDULER|scheduler.2]"
},
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|0-2": {
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]"
},
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|5-7": {
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSY]"
},
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|3-4": {
"scheduler" : "[SCHEDULER|scheduler.0]",
"wred_profile" : "[WRED_PROFILE|AZURE_LOSSLESS]"
}
}
}

View File

@ -0,0 +1 @@
{%- include 'qos_config.j2' %}

View File

@ -1,3 +1,2 @@
BOARD_CONFIG_FILE_PATH=/etc/centec/E582-48x6q.json
SAI_INIT_CONFIG_FILE=/etc/centec/E582-48x6q-chip-profile.txt
SAI_HW_PORT_PROFILE_ID_CONFIG_FILE=/etc/centec/E582-48x6q-datapath-cfg.txt

View File

@ -1,11 +1,10 @@
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon0= hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-15/15-002f
DEVNAME=hwmon0=acpitz hwmon5=adt7470
FCTEMPS=hwmon5/device/pwm4=hwmon0/temp1_input hwmon5/device/pwm3=hwmon0/temp1_input hwmon5/device/pwm2=hwmon0/temp1_input hwmon5/device/pwm1=hwmon0/temp1_input
FCFANS=hwmon5/device/pwm4=hwmon5/device/fan4_input hwmon5/device/pwm3=hwmon5/device/fan3_input hwmon5/device/pwm2=hwmon5/device/fan2_input hwmon5/device/pwm1=hwmon5/device/fan1_input
MINTEMP=hwmon5/device/pwm4=20 hwmon5/device/pwm3=20 hwmon5/device/pwm2=20 hwmon5/device/pwm1=20
MAXTEMP=hwmon5/device/pwm4=60 hwmon5/device/pwm3=60 hwmon5/device/pwm2=60 hwmon5/device/pwm1=60
MINSTART=hwmon5/device/pwm4=150 hwmon5/device/pwm3=12 hwmon5/device/pwm2=12 hwmon5/device/pwm1=150
MINSTOP=hwmon5/device/pwm4=0 hwmon5/device/pwm3=12 hwmon5/device/pwm2=12 hwmon5/device/pwm1=0
MAXPWM= hwmon5/device/pwm4=150
DEVPATH=hwmon1=devices/platform/coretemp.0 hwmon5=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-15/15-002f
DEVNAME=hwmon1=coretemp hwmon5=adt7470
FCTEMPS=hwmon5/pwm4=hwmon1/temp1_input hwmon5/pwm3=hwmon1/temp1_input hwmon5/pwm2=hwmon1/temp1_input hwmon5/pwm1=hwmon1/temp1_input
FCFANS=hwmon5/pwm4=hwmon5/fan4_input hwmon5/pwm3=hwmon5/fan3_input hwmon5/pwm2=hwmon5/fan2_input hwmon5/pwm1=hwmon5/fan1_input
MINTEMP=hwmon5/pwm4=20 hwmon5/pwm3=20 hwmon5/pwm2=20 hwmon5/pwm1=20
MAXTEMP=hwmon5/pwm4=60 hwmon5/pwm3=60 hwmon5/pwm2=60 hwmon5/pwm1=60
MINSTART=hwmon5/pwm4=150 hwmon5/pwm3=150 hwmon5/pwm2=150 hwmon5/pwm1=150
MINSTOP=hwmon5/pwm4=0 hwmon5/pwm3=0 hwmon5/pwm2=0 hwmon5/pwm1=100

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
#############################################################################
# Mellanox
# Centec
#
# Module contains an implementation of SONiC PSU Base API and
# provides the PSUs status which are available in the platform

View File

@ -158,11 +158,5 @@ class SfpUtil(SfpUtilBase):
return False
def get_transceiver_change_event(self):
"""
TODO: This function need to be implemented
when decide to support monitoring SFP(Xcvrd)
on this platform.
"""
raise NotImplementedError
def get_transceiver_change_event(self, timeout=0):
return False, {}

View File

@ -1,6 +1,6 @@
# libsaithrift-dev package
LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_1.2.1_amd64.deb
LIBSAITHRIFT_DEV_CENTEC = libsaithrift-dev_1.3.5_amd64.deb
$(LIBSAITHRIFT_DEV_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(LIBSAITHRIFT_DEV_CENTEC)_DEPENDS += $(LIBTHRIFT) $(LIBTHRIFT_DEV) $(THRIFT_COMPILER) $(CENTEC_SAI)
$(LIBSAITHRIFT_DEV_CENTEC)_RDEPENDS += $(LIBTHRIFT) $(CENTEC_SAI)

View File

@ -3,6 +3,7 @@
SONIC_ONE_IMAGE = sonic-centec.bin
$(SONIC_ONE_IMAGE)_MACHINE = centec
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_ONE_IMAGE)_INSTALLS += $(CENTEC_E582_48X6Q_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(CENTEC_E582_48X6Q_PLATFORM_MODULE) \
$(CENTEC_E582_48X2Q4Z_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_ONE_IMAGE)

View File

@ -12,6 +12,7 @@ CENTEC_E582_48X6Q_PLATFORM_MODULE = platform-modules-e582-48x6q_$(CENTEC_E582_48
$(CENTEC_E582_48X6Q_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-e582
$(CENTEC_E582_48X6Q_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(CENTEC_E582_48X6Q_PLATFORM_MODULE)_PLATFORM = x86_64-centec_e582_48x6q-r0
SONIC_STRETCH_DEBS += $(CENTEC_E582_48X6Q_PLATFORM_MODULE)
SONIC_DPKG_DEBS += $(CENTEC_E582_48X6Q_PLATFORM_MODULE)
CENTEC_E582_48X2Q4Z_PLATFORM_MODULE = platform-modules-e582-48x2q4z_$(CENTEC_E582_48X2Q4Z_PLATFORM_MODULE_VERSION)_amd64.deb

View File

@ -1,6 +1,6 @@
# python-saithrift package
PYTHON_SAITHRIFT_CENTEC = python-saithrift_1.2.1_amd64.deb
PYTHON_SAITHRIFT_CENTEC = python-saithrift_1.3.5_amd64.deb
$(PYTHON_SAITHRIFT_CENTEC)_SRC_PATH = $(SRC_PATH)/sonic-sairedis/SAI
$(PYTHON_SAITHRIFT_CENTEC)_DEPENDS += $(CENTEC_SAI) $(THRIFT_COMPILER) $(PYTHON_THRIFT) $(LIBTHRIFT_DEV)
SONIC_DPKG_DEBS += $(PYTHON_SAITHRIFT_CENTEC)

View File

@ -1,5 +1,5 @@
# Centec SAI
CENTEC_SAI = libsai_1.2.4_amd64.deb
$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.2.4/libsai_1.2.4-1.0_amd64.deb
CENTEC_SAI = libsai_1.3.3_amd64.deb
$(CENTEC_SAI)_URL = https://github.com/CentecNetworks/goldengate-sai/raw/master/lib/SONiC_1.3.3/libsai_1.3.3-1.0_amd64.deb
SONIC_ONLINE_DEBS += $(CENTEC_SAI)

View File

@ -12,6 +12,3 @@ i2c-mux-pca954x
lm77
adt7470
tun
centec_e582_48x6q_platform
dal
centec_at24c64

View File

@ -0,0 +1,302 @@
{
"DEVICE_METADATA": {
"localhost": {
"bgp_asn": 65100,
"deployment_id": null,
"hostname": "switch1",
"type": "LeafRouter",
"hwsku": "E582-48x6q"
}
},
"BGP_PEER_RANGE": {},
"VLAN": {},
"PORT": {
"Ethernet1": {
"alias": "eth-0-1",
"speed": "1000",
"mtu": "9100"
},
"Ethernet2": {
"alias": "eth-0-2",
"speed": "1000",
"mtu": "9100"
},
"Ethernet3": {
"alias": "eth-0-3",
"speed": "1000",
"mtu": "9100"
},
"Ethernet4": {
"alias": "eth-0-4",
"speed": "1000",
"mtu": "9100"
},
"Ethernet5": {
"alias": "eth-0-5",
"speed": "1000",
"mtu": "9100"
},
"Ethernet6": {
"alias": "eth-0-6",
"speed": "1000",
"mtu": "9100"
},
"Ethernet7": {
"alias": "eth-0-7",
"speed": "1000",
"mtu": "9100"
},
"Ethernet8": {
"alias": "eth-0-8",
"speed": "1000",
"mtu": "9100"
},
"Ethernet9": {
"alias": "eth-0-9",
"speed": "1000",
"mtu": "9100"
},
"Ethernet10": {
"alias": "eth-0-10",
"speed": "1000",
"mtu": "9100"
},
"Ethernet11": {
"alias": "eth-0-11",
"speed": "1000",
"mtu": "9100"
},
"Ethernet12": {
"alias": "eth-0-12",
"speed": "1000",
"mtu": "9100"
},
"Ethernet13": {
"alias": "eth-0-13",
"speed": "10000",
"mtu": "9100"
},
"Ethernet14": {
"alias": "eth-0-14",
"speed": "10000",
"mtu": "9100"
},
"Ethernet15": {
"alias": "eth-0-15",
"speed": "10000",
"mtu": "9100"
},
"Ethernet16": {
"alias": "eth-0-16",
"speed": "10000",
"mtu": "9100"
},
"Ethernet17": {
"alias": "eth-0-17",
"speed": "10000",
"mtu": "9100"
},
"Ethernet18": {
"alias": "eth-0-18",
"speed": "10000",
"mtu": "9100"
},
"Ethernet19": {
"alias": "eth-0-19",
"speed": "10000",
"mtu": "9100"
},
"Ethernet20": {
"alias": "eth-0-20",
"speed": "10000",
"mtu": "9100"
},
"Ethernet21": {
"alias": "eth-0-21",
"speed": "10000",
"mtu": "9100"
},
"Ethernet22": {
"alias": "eth-0-22",
"speed": "10000",
"mtu": "9100"
},
"Ethernet23": {
"alias": "eth-0-23",
"speed": "10000",
"mtu": "9100"
},
"Ethernet24": {
"alias": "eth-0-24",
"speed": "10000",
"mtu": "9100"
},
"Ethernet25": {
"alias": "eth-0-25",
"speed": "10000",
"mtu": "9100"
},
"Ethernet26": {
"alias": "eth-0-26",
"speed": "10000",
"mtu": "9100"
},
"Ethernet27": {
"alias": "eth-0-27",
"speed": "10000",
"mtu": "9100"
},
"Ethernet28": {
"alias": "eth-0-28",
"speed": "10000",
"mtu": "9100"
},
"Ethernet29": {
"alias": "eth-0-29",
"speed": "10000",
"mtu": "9100"
},
"Ethernet30": {
"alias": "eth-0-30",
"speed": "10000",
"mtu": "9100"
},
"Ethernet31": {
"alias": "eth-0-31",
"speed": "10000",
"mtu": "9100"
},
"Ethernet32": {
"alias": "eth-0-32",
"speed": "10000",
"mtu": "9100"
},
"Ethernet33": {
"alias": "eth-0-33",
"speed": "10000",
"mtu": "9100"
},
"Ethernet34": {
"alias": "eth-0-34",
"speed": "10000",
"mtu": "9100"
},
"Ethernet35": {
"alias": "eth-0-35",
"speed": "10000",
"mtu": "9100"
},
"Ethernet36": {
"alias": "eth-0-36",
"speed": "10000",
"mtu": "9100"
},
"Ethernet37": {
"alias": "eth-0-37",
"speed": "10000",
"mtu": "9100"
},
"Ethernet38": {
"alias": "eth-0-38",
"speed": "10000",
"mtu": "9100"
},
"Ethernet39": {
"alias": "eth-0-39",
"speed": "10000",
"mtu": "9100"
},
"Ethernet40": {
"alias": "eth-0-40",
"speed": "10000",
"mtu": "9100"
},
"Ethernet41": {
"alias": "eth-0-41",
"speed": "10000",
"mtu": "9100"
},
"Ethernet42": {
"alias": "eth-0-42",
"speed": "10000",
"mtu": "9100"
},
"Ethernet43": {
"alias": "eth-0-43",
"speed": "10000",
"mtu": "9100"
},
"Ethernet44": {
"alias": "eth-0-44",
"speed": "10000",
"mtu": "9100"
},
"Ethernet45": {
"alias": "eth-0-45",
"speed": "10000",
"mtu": "9100"
},
"Ethernet46": {
"alias": "eth-0-46",
"speed": "10000",
"mtu": "9100"
},
"Ethernet47": {
"alias": "eth-0-47",
"speed": "10000",
"mtu": "9100"
},
"Ethernet48": {
"alias": "eth-0-48",
"speed": "10000",
"mtu": "9100"
},
"Ethernet49": {
"alias": "eth-0-49",
"speed": "40000",
"mtu": "9100"
},
"Ethernet50": {
"alias": "eth-0-50",
"speed": "40000",
"mtu": "9100"
},
"Ethernet51": {
"alias": "eth-0-51",
"speed": "100000",
"mtu": "9100"
},
"Ethernet52": {
"alias": "eth-0-52",
"speed": "100000",
"mtu": "9100"
},
"Ethernet53": {
"alias": "eth-0-53",
"speed": "100000",
"mtu": "9100"
},
"Ethernet54": {
"alias": "eth-0-54",
"speed": "100000",
"mtu": "9100"
}
},
"SYSLOG_SERVER": {},
"VLAN_INTERFACE": {},
"PORTCHANNEL_INTERFACE": {},
"PORTCHANNEL": {},
"MGMT_INTERFACE": {},
"DHCP_SERVER": {},
"LOOPBACK_INTERFACE": {
"Loopback0|127.0.0.1/8": {}
},
"ACL_TABLE": {},
"INTERFACE": {
"Ethernet1|192.168.1.1/24": {},
"Ethernet2|192.168.2.1/24": {},
"Ethernet3|192.168.3.1/24": {},
"Ethernet4|192.168.4.1/24": {}
}
}

View File

@ -0,0 +1,610 @@
{
"QUEUE": {
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|0-2": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSY]"
},
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|3-4": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSLESS]",
"scheduler": "[SCHEDULER|scheduler.0]"
},
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54|5-7": {
"wred_profile": "[WRED_PROFILE|AZURE_LOSSY]"
}
},
"WRED_PROFILE": {
"AZURE_LOSSLESS": {
"red_max_threshold": "32760",
"yellow_max_threshold": "32760",
"green_min_threshold": "4095",
"red_min_threshold": "4095",
"yellow_min_threshold": "4095",
"green_max_threshold": "32760",
"wred_yellow_enable": "true",
"wred_green_enable": "true"
},
"AZURE_LOSSY": {
"red_max_threshold": "32760",
"yellow_max_threshold": "32760",
"green_min_threshold": "4095",
"red_min_threshold": "4095",
"yellow_min_threshold": "4095",
"green_max_threshold": "32760",
"wred_yellow_enable": "true",
"wred_green_enable": "true"
}
},
"DSCP_TO_TC_MAP": {
"AZURE": {
"56": "7",
"54": "6",
"28": "3",
"48": "6",
"29": "3",
"60": "7",
"61": "7",
"62": "7",
"63": "7",
"49": "6",
"34": "4",
"24": "3",
"25": "3",
"26": "3",
"27": "3",
"20": "2",
"21": "2",
"22": "2",
"23": "2",
"46": "5",
"47": "5",
"44": "5",
"45": "5",
"42": "5",
"43": "5",
"40": "5",
"41": "5",
"1": "0",
"0": "0",
"3": "0",
"2": "0",
"5": "0",
"4": "0",
"7": "0",
"6": "0",
"9": "1",
"8": "1",
"35": "4",
"13": "1",
"12": "1",
"15": "1",
"58": "7",
"11": "1",
"10": "1",
"39": "4",
"38": "4",
"59": "7",
"14": "1",
"17": "2",
"16": "2",
"19": "2",
"18": "2",
"31": "3",
"30": "3",
"51": "6",
"36": "4",
"53": "6",
"52": "6",
"33": "4",
"55": "6",
"37": "4",
"32": "4",
"57": "7",
"50": "6"
}
},
"DEVICE_METADATA": {
"localhost": {
"hwsku": "E582-48x6q",
"hostname": "switch1",
"bgp_asn": "None",
"deployment_id": "None",
"type": "LeafRouter"
}
},
"PORT": {
"Ethernet1": {
"alias": "eth-0-1",
"speed": "1000",
"mtu": "9100"
},
"Ethernet2": {
"alias": "eth-0-2",
"speed": "1000",
"mtu": "9100"
},
"Ethernet3": {
"alias": "eth-0-3",
"speed": "1000",
"mtu": "9100"
},
"Ethernet4": {
"alias": "eth-0-4",
"speed": "1000",
"mtu": "9100"
},
"Ethernet5": {
"alias": "eth-0-5",
"speed": "1000",
"mtu": "9100"
},
"Ethernet6": {
"alias": "eth-0-6",
"speed": "1000",
"mtu": "9100"
},
"Ethernet7": {
"alias": "eth-0-7",
"speed": "1000",
"mtu": "9100"
},
"Ethernet8": {
"alias": "eth-0-8",
"speed": "1000",
"mtu": "9100"
},
"Ethernet9": {
"alias": "eth-0-9",
"speed": "1000",
"mtu": "9100"
},
"Ethernet10": {
"alias": "eth-0-10",
"speed": "1000",
"mtu": "9100"
},
"Ethernet11": {
"alias": "eth-0-11",
"speed": "1000",
"mtu": "9100"
},
"Ethernet12": {
"alias": "eth-0-12",
"speed": "1000",
"mtu": "9100"
},
"Ethernet13": {
"alias": "eth-0-13",
"speed": "10000",
"mtu": "9100"
},
"Ethernet14": {
"alias": "eth-0-14",
"speed": "10000",
"mtu": "9100"
},
"Ethernet15": {
"alias": "eth-0-15",
"speed": "10000",
"mtu": "9100"
},
"Ethernet16": {
"alias": "eth-0-16",
"speed": "10000",
"mtu": "9100"
},
"Ethernet17": {
"alias": "eth-0-17",
"speed": "10000",
"mtu": "9100"
},
"Ethernet18": {
"alias": "eth-0-18",
"speed": "10000",
"mtu": "9100"
},
"Ethernet19": {
"alias": "eth-0-19",
"speed": "10000",
"mtu": "9100"
},
"Ethernet20": {
"alias": "eth-0-20",
"speed": "10000",
"mtu": "9100"
},
"Ethernet21": {
"alias": "eth-0-21",
"speed": "10000",
"mtu": "9100"
},
"Ethernet22": {
"alias": "eth-0-22",
"speed": "10000",
"mtu": "9100"
},
"Ethernet23": {
"alias": "eth-0-23",
"speed": "10000",
"mtu": "9100"
},
"Ethernet24": {
"alias": "eth-0-24",
"speed": "10000",
"mtu": "9100"
},
"Ethernet25": {
"alias": "eth-0-25",
"speed": "10000",
"mtu": "9100"
},
"Ethernet26": {
"alias": "eth-0-26",
"speed": "10000",
"mtu": "9100"
},
"Ethernet27": {
"alias": "eth-0-27",
"speed": "10000",
"mtu": "9100"
},
"Ethernet28": {
"alias": "eth-0-28",
"speed": "10000",
"mtu": "9100"
},
"Ethernet29": {
"alias": "eth-0-29",
"speed": "10000",
"mtu": "9100"
},
"Ethernet30": {
"alias": "eth-0-30",
"speed": "10000",
"mtu": "9100"
},
"Ethernet31": {
"alias": "eth-0-31",
"speed": "10000",
"mtu": "9100"
},
"Ethernet32": {
"alias": "eth-0-32",
"speed": "10000",
"mtu": "9100"
},
"Ethernet33": {
"alias": "eth-0-33",
"speed": "10000",
"mtu": "9100"
},
"Ethernet34": {
"alias": "eth-0-34",
"speed": "10000",
"mtu": "9100"
},
"Ethernet35": {
"alias": "eth-0-35",
"speed": "10000",
"mtu": "9100"
},
"Ethernet36": {
"alias": "eth-0-36",
"speed": "10000",
"mtu": "9100"
},
"Ethernet37": {
"alias": "eth-0-37",
"speed": "10000",
"mtu": "9100"
},
"Ethernet38": {
"alias": "eth-0-38",
"speed": "10000",
"mtu": "9100"
},
"Ethernet39": {
"alias": "eth-0-39",
"speed": "10000",
"mtu": "9100"
},
"Ethernet40": {
"alias": "eth-0-40",
"speed": "10000",
"mtu": "9100"
},
"Ethernet41": {
"alias": "eth-0-41",
"speed": "10000",
"mtu": "9100"
},
"Ethernet42": {
"alias": "eth-0-42",
"speed": "10000",
"mtu": "9100"
},
"Ethernet43": {
"alias": "eth-0-43",
"speed": "10000",
"mtu": "9100"
},
"Ethernet44": {
"alias": "eth-0-44",
"speed": "10000",
"mtu": "9100"
},
"Ethernet45": {
"alias": "eth-0-45",
"speed": "10000",
"mtu": "9100"
},
"Ethernet46": {
"alias": "eth-0-46",
"speed": "10000",
"mtu": "9100"
},
"Ethernet47": {
"alias": "eth-0-47",
"speed": "10000",
"mtu": "9100"
},
"Ethernet48": {
"alias": "eth-0-48",
"speed": "10000",
"mtu": "9100"
},
"Ethernet49": {
"alias": "eth-0-49",
"speed": "40000",
"mtu": "9100"
},
"Ethernet50": {
"alias": "eth-0-50",
"speed": "40000",
"mtu": "9100"
},
"Ethernet51": {
"alias": "eth-0-51",
"speed": "100000",
"mtu": "9100"
},
"Ethernet52": {
"alias": "eth-0-52",
"speed": "100000",
"mtu": "9100"
},
"Ethernet53": {
"alias": "eth-0-53",
"speed": "100000",
"mtu": "9100"
},
"Ethernet54": {
"alias": "eth-0-54",
"speed": "100000",
"mtu": "9100"
}
},
"PORT_QOS_MAP": {
"Ethernet1,Ethernet2,Ethernet3,Ethernet4,Ethernet5,Ethernet6,Ethernet7,Ethernet8,Ethernet9,Ethernet10,Ethernet11,Ethernet12,Ethernet13,Ethernet14,Ethernet15,Ethernet16,Ethernet17,Ethernet18,Ethernet19,Ethernet20,Ethernet21,Ethernet22,Ethernet23,Ethernet24,Ethernet25,Ethernet26,Ethernet27,Ethernet28,Ethernet29,Ethernet30,Ethernet31,Ethernet32,Ethernet33,Ethernet34,Ethernet35,Ethernet36,Ethernet37,Ethernet38,Ethernet39,Ethernet40,Ethernet41,Ethernet42,Ethernet43,Ethernet44,Ethernet45,Ethernet46,Ethernet47,Ethernet48,Ethernet49,Ethernet50,Ethernet51,Ethernet52,Ethernet53,Ethernet54": {
"pfc_enable": "3,4",
"dscp_to_tc_map": "[DSCP_TO_TC_MAP|AZURE]"
}
},
"SCHEDULER": {
"scheduler.0": {
"type": "DWRR",
"weight": "25"
},
"scheduler.1": {
"type": "DWRR",
"weight": "30"
},
"scheduler.2": {
"type": "DWRR",
"weight": "20"
}
},
"VLAN": {
"Vlan500": {
"dhcp_servers": [
"192.168.5.1",
"192.168.5.2",
"192.168.5.3",
"192.168.5.4"
],
"members": [
"Ethernet5",
"Ethernet6",
"Ethernet7",
"Ethernet8"
],
"vlanid": "500"
},
"Vlan600": {
"dhcp_servers": [
"192.168.6.1",
"192.168.6.2",
"192.168.6.3",
"192.168.6.4"
],
"members": [
"Ethernet5",
"Ethernet6"
],
"vlanid": "600"
},
"Vlan700": {
"dhcp_servers": [
"192.168.7.1",
"192.168.7.2",
"192.168.7.3",
"192.168.7.4"
],
"members": [
"Ethernet5",
"Ethernet7"
],
"vlanid": "700"
},
"Vlan800": {
"dhcp_servers": [
"192.168.8.1",
"192.168.8.2",
"192.168.8.3",
"192.168.8.4"
],
"members": [
"Ethernet5",
"Ethernet8"
],
"vlanid": "800"
}
},
"VLAN_MEMBER": {
"Vlan500|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan500|Ethernet6": {
"tagging_mode": "untagged"
},
"Vlan500|Ethernet7": {
"tagging_mode": "untagged"
},
"Vlan500|Ethernet8": {
"tagging_mode": "untagged"
},
"Vlan600|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan600|Ethernet6": {
"tagging_mode": "tagged"
},
"Vlan700|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan700|Ethernet7": {
"tagging_mode": "tagged"
},
"Vlan800|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan800|Ethernet8": {
"tagging_mode": "tagged"
}
},
"INTERFACE": {
"Ethernet1|192.168.1.1/24": {},
"Ethernet2|192.168.2.1/24": {},
"Ethernet3|192.168.3.1/24": {},
"Ethernet4|192.168.4.1/24": {}
},
"VLAN_INTERFACE": {
"Vlan500|192.168.5.1/24": {},
"Vlan600|192.168.6.1/24": {},
"Vlan700|192.168.7.1/24": {},
"Vlan800|192.168.8.1/24": {}
},
"LOOPBACK_INTERFACE": {
"Loopback0|127.0.0.1/8": {}
},
"CABLE_LENGTH": {
"AZURE": {
"Ethernet8": "40m",
"Ethernet9": "40m",
"Ethernet2": "40m",
"Ethernet3": "40m",
"Ethernet1": "40m",
"Ethernet6": "40m",
"Ethernet7": "40m",
"Ethernet4": "40m",
"Ethernet5": "40m",
"Ethernet22": "40m",
"Ethernet50": "40m",
"Ethernet51": "40m",
"Ethernet52": "40m",
"Ethernet53": "40m",
"Ethernet54": "40m",
"Ethernet38": "40m",
"Ethernet39": "40m",
"Ethernet18": "40m",
"Ethernet19": "40m",
"Ethernet14": "40m",
"Ethernet15": "40m",
"Ethernet16": "40m",
"Ethernet17": "40m",
"Ethernet10": "40m",
"Ethernet11": "40m",
"Ethernet12": "40m",
"Ethernet35": "40m",
"Ethernet37": "40m",
"Ethernet32": "40m",
"Ethernet33": "40m",
"Ethernet30": "40m",
"Ethernet31": "40m",
"Ethernet49": "40m",
"Ethernet48": "40m",
"Ethernet47": "40m",
"Ethernet36": "40m",
"Ethernet45": "40m",
"Ethernet44": "40m",
"Ethernet43": "40m",
"Ethernet42": "40m",
"Ethernet41": "40m",
"Ethernet40": "40m",
"Ethernet29": "40m",
"Ethernet28": "40m",
"Ethernet34": "40m",
"Ethernet46": "40m",
"Ethernet21": "40m",
"Ethernet20": "40m",
"Ethernet23": "40m",
"Ethernet13": "40m",
"Ethernet25": "40m",
"Ethernet24": "40m",
"Ethernet27": "40m",
"Ethernet26": "40m"
}
},
"CRM": {
"Config": {
"acl_table_threshold_type": "percentage",
"nexthop_group_threshold_type": "percentage",
"fdb_entry_high_threshold": "85",
"acl_entry_threshold_type": "percentage",
"ipv6_neighbor_low_threshold": "70",
"nexthop_group_member_low_threshold": "70",
"acl_group_high_threshold": "85",
"ipv4_route_high_threshold": "85",
"acl_counter_high_threshold": "85",
"ipv4_route_low_threshold": "70",
"ipv4_route_threshold_type": "percentage",
"ipv4_neighbor_low_threshold": "70",
"acl_group_threshold_type": "percentage",
"ipv4_nexthop_high_threshold": "85",
"ipv6_route_threshold_type": "percentage",
"nexthop_group_low_threshold": "70",
"ipv4_neighbor_high_threshold": "85",
"ipv6_route_high_threshold": "85",
"ipv6_nexthop_threshold_type": "percentage",
"polling_interval": "300",
"ipv4_nexthop_threshold_type": "percentage",
"acl_group_low_threshold": "70",
"acl_entry_low_threshold": "70",
"nexthop_group_member_threshold_type": "percentage",
"ipv4_nexthop_low_threshold": "70",
"acl_counter_threshold_type": "percentage",
"ipv6_neighbor_high_threshold": "85",
"nexthop_group_member_high_threshold": "85",
"acl_table_low_threshold": "70",
"fdb_entry_threshold_type": "percentage",
"ipv6_neighbor_threshold_type": "percentage",
"acl_table_high_threshold": "85",
"ipv6_nexthop_low_threshold": "70",
"acl_counter_low_threshold": "70",
"ipv4_neighbor_threshold_type": "percentage",
"nexthop_group_high_threshold": "85",
"ipv6_route_low_threshold": "70",
"acl_entry_high_threshold": "85",
"fdb_entry_low_threshold": "70",
"ipv6_nexthop_high_threshold": "85"
}
}
}

View File

@ -25,7 +25,7 @@
#endif
#include "dal_kernel.h"
#include "dal_mpool.h"
#include <linux/slab.h>
MODULE_AUTHOR("Centec Networks Inc.");
MODULE_DESCRIPTION("DAL kernel module");
MODULE_LICENSE("GPL");
@ -47,7 +47,9 @@ MODULE_PARM_DESC(dma_pool_size,
#define CTC_VENDOR_VID 0xc001
#define CTC_HUMBER_DEVICE_ID 0x6048
#define CTC_GOLDENGATE_DEVICE_ID 0xcb10
#define CTC_GOLDENGATE_DEVICE_ID 0xc010
#define CTC_PCIE_VENDOR_ID 0xcb10
#define CTC_DUET2_DEVICE_ID 0x7148
#define MEM_MAP_RESERVE SetPageReserved
#define MEM_MAP_UNRESERVE ClearPageReserved
@ -82,7 +84,7 @@ typedef struct dal_kernel_dev_s
uintptr logic_address;
/* Physical address */
uintptr phys_address;
unsigned long long phys_address;
} dal_kern_dev_t;
typedef struct _dma_segment
@ -126,8 +128,8 @@ static unsigned int* dma_virt_base[DAL_MAX_CHIP_NUM];
#ifndef DMA_MEM_MODE_PLATFORM
static unsigned int* dma_virt_base_tmp[DAL_MAX_CHIP_NUM];
#endif
static uintptr dma_phy_base[DAL_MAX_CHIP_NUM];
static unsigned int dma_mem_size = 0x800000;
static unsigned long long dma_phy_base[DAL_MAX_CHIP_NUM];
static unsigned int dma_mem_size = 0xc00000;
static unsigned int msi_irq_base[DAL_MAX_CHIP_NUM];
static unsigned int msi_irq_num[DAL_MAX_CHIP_NUM];
static unsigned int msi_used = 0;
@ -141,7 +143,9 @@ MODULE_PARM_DESC(dal_debug, "Set debug level (default 0)");
static struct pci_device_id dal_id_table[] =
{
{PCI_DEVICE(CTC_VENDOR_VID, CTC_GREATBELT_DEVICE_ID)},
{PCI_DEVICE(0xcb10, 0xc010)},
{PCI_DEVICE(CTC_PCIE_VENDOR_ID, CTC_GOLDENGATE_DEVICE_ID)},
{PCI_DEVICE((CTC_PCIE_VENDOR_ID+1), (CTC_GOLDENGATE_DEVICE_ID+1))},
{PCI_DEVICE(CTC_PCIE_VENDOR_ID, CTC_DUET2_DEVICE_ID)},
{0, },
};
@ -186,7 +190,11 @@ static struct file_operations dal_intr_fops[CTC_MAX_INTR_NUM] =
.poll = linux_dal_poll7,
},
};
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
#include <linux/slab.h>
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
#endif
/*****************************************************************************
* macros
*****************************************************************************/
@ -450,9 +458,12 @@ dal_interrupt_register(unsigned int irq, int prio, void (* isr)(void*), void* da
{
if (irq == dal_isr[intr_num_tmp].irq)
{
dal_isr[intr_num_tmp].count++;
printk("Interrupt irq %d register count %d.\n", irq, dal_isr[intr_num_tmp].count);
return 0;
if (0 == msi_used)
{
dal_isr[intr_num_tmp].count++;
printk("Interrupt irq %d register count %d.\n", irq, dal_isr[intr_num_tmp].count);
}
return 0;
}
if ((0 == dal_isr[intr_num_tmp].irq) && (CTC_MAX_INTR_NUM == intr_num))
{
@ -608,6 +619,7 @@ int
dal_set_msi_cap(unsigned long arg)
{
int ret = 0;
int index = 0;
dal_msi_info_t msi_info;
if (copy_from_user(&msi_info, (void*)arg, sizeof(dal_msi_info_t)))
@ -618,8 +630,21 @@ dal_set_msi_cap(unsigned long arg)
printk("####dal_set_msi_cap lchip %d base %d num:%d\n", msi_info.lchip, msi_info.irq_base, msi_info.irq_num);
if (msi_info.irq_num > 0)
{
msi_used = 1;
ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num);
if (0 == msi_used)
{
msi_used = 1;
ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num);
}
else if ((1 == msi_used) && (msi_info.irq_num != msi_irq_num[msi_info.lchip]))
{
for (index = 0; index < msi_irq_num[msi_info.lchip]; index++)
{
dal_interrupt_unregister(msi_irq_base[msi_info.lchip]+index);
}
_dal_set_msi_disable(msi_info.lchip);
msi_used = 1;
ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num);
}
}
else
{
@ -1054,6 +1079,10 @@ int
dal_create_irq_mapping(unsigned long arg)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
#ifndef NO_IRQ
#define NO_IRQ (-1)
#endif
dal_irq_mapping_t irq_map;
if (copy_from_user(&irq_map, (void*)arg, sizeof(dal_irq_mapping_t)))
@ -1086,7 +1115,7 @@ dal_pci_read(unsigned long arg)
return -EFAULT;
}
_dal_pci_read((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr,
_dal_pci_read((unsigned char)cmdpara_chip.lchip, (unsigned int)cmdpara_chip.reg_addr,
(unsigned int*)(&(cmdpara_chip.value)));
if (copy_to_user((dal_chip_parm_t*)arg, (void*)&cmdpara_chip, sizeof(dal_chip_parm_t)))
@ -1119,7 +1148,7 @@ dal_pci_write(unsigned long arg)
return -EFAULT;
}
_dal_pci_write((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr,
_dal_pci_write((unsigned char)cmdpara_chip.lchip, (unsigned int)cmdpara_chip.reg_addr,
(unsigned int)cmdpara_chip.value);
return 0;
@ -1158,7 +1187,7 @@ dal_user_read_pci_conf(unsigned long arg)
return -EFAULT;
}
if (dal_pci_conf_read(dal_cfg.chip_id, dal_cfg.offset, &dal_cfg.value))
if (dal_pci_conf_read(dal_cfg.lchip, dal_cfg.offset, &dal_cfg.value))
{
printk("dal_pci_conf_read failed.\n");
return -EFAULT;
@ -1182,14 +1211,14 @@ dal_user_write_pci_conf(unsigned long arg)
return -EFAULT;
}
return dal_pci_conf_write(dal_cfg.chip_id, dal_cfg.offset, dal_cfg.value);
return dal_pci_conf_write(dal_cfg.lchip, dal_cfg.offset, dal_cfg.value);
}
static int
linux_get_device(unsigned long arg)
{
dal_user_dev_t user_dev;
int chip_id = 0;
int lchip = 0;
if (copy_from_user(&user_dev, (void*)arg, sizeof(user_dev)))
{
@ -1197,20 +1226,16 @@ linux_get_device(unsigned long arg)
}
user_dev.chip_num = dal_chip_num;
chip_id = user_dev.chip_id;
lchip = user_dev.lchip;
if (chip_id < dal_chip_num)
if (lchip < dal_chip_num)
{
user_dev.phy_base0 = (unsigned int)dal_dev[chip_id].phys_address;
#ifdef PHYS_ADDR_IS_64BIT
user_dev.phy_base1 = (unsigned int)(dal_dev[chip_id].phys_address >> 32);
#else
user_dev.phy_base1 = 0;
#endif
user_dev.phy_base0 = (unsigned int)dal_dev[lchip].phys_address;
user_dev.phy_base1 = (unsigned int)(dal_dev[lchip].phys_address >> 32);
user_dev.bus_no = dal_dev[chip_id].pci_dev->bus->number;
user_dev.dev_no = dal_dev[chip_id].pci_dev->device;
user_dev.fun_no = dal_dev[chip_id].pci_dev->devfn;
user_dev.bus_no = dal_dev[lchip].pci_dev->bus->number;
user_dev.dev_no = dal_dev[lchip].pci_dev->device;
user_dev.fun_no = dal_dev[lchip].pci_dev->devfn;
}
if (copy_to_user((dal_user_dev_t*)arg, (void*)&user_dev, sizeof(user_dev)))
@ -1248,11 +1273,7 @@ linux_get_dma_info(unsigned long arg)
}
dma_para.phy_base = (unsigned int)dma_phy_base[dma_para.lchip];
#ifdef PHYS_ADDR_IS_64BIT
dma_para.phy_base_hi = dma_phy_base[dma_para.lchip] >> 32;
#else
dma_para.phy_base_hi = 0;
#endif
dma_para.size = dma_mem_size;
if (copy_to_user((dma_info_t*)arg, (void*)&dma_para, sizeof(dma_info_t)))
@ -1340,10 +1361,10 @@ dal_cache_inval(unsigned long arg)
#if 0
dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
return 0;
}
@ -1363,10 +1384,10 @@ dal_cache_flush(unsigned long arg)
#if 0
dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
return 0;
}
@ -1378,31 +1399,30 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
int ret = 0;
unsigned int temp = 0;
unsigned int lchip = 0;
unsigned int chip_id = 0;
printk(KERN_WARNING "********found dal device*****\n");
for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++)
for (lchip = 0; lchip < DAL_MAX_CHIP_NUM; lchip ++)
{
if (NULL == dal_dev[chip_id].pci_dev)
if (NULL == dal_dev[lchip].pci_dev)
{
break;
}
}
if (chip_id >= DAL_MAX_CHIP_NUM)
if (lchip >= DAL_MAX_CHIP_NUM)
{
printk("Exceed max local chip num\n");
return -1;
}
dev = &dal_dev[chip_id];
dev = &dal_dev[lchip];
if (NULL == dev)
{
printk("Cannot obtain PCI resources\n");
}
lchip = chip_id;
lchip = lchip;
dal_chip_num += 1;
dev->pci_dev = pdev;
@ -1446,7 +1466,6 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
if (dma_mem_size)
{
dal_alloc_dma_pool(lchip, dma_mem_size);
#ifdef PHYS_ADDR_IS_64BIT
/*add check Dma memory pool cannot cross 4G space*/
if ((0==(dma_phy_base[lchip]>>32)) && (0!=((dma_phy_base[lchip]+dma_mem_size)>>32)))
@ -1454,7 +1473,6 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
printk("Dma malloc memory cross 4G space!!!!!! \n");
return -1;
}
#endif
}
printk(KERN_WARNING "linux_dal_probe end*****\n");
@ -1465,12 +1483,12 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
void
linux_dal_remove(struct pci_dev* pdev)
{
unsigned int chip_id = 0;
unsigned int lchip = 0;
unsigned int flag = 0;
for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++)
for (lchip = 0; lchip < DAL_MAX_CHIP_NUM; lchip ++)
{
if (pdev == dal_dev[chip_id].pci_dev)
if (pdev == dal_dev[lchip].pci_dev)
{
flag = 1;
break;
@ -1479,11 +1497,11 @@ linux_dal_remove(struct pci_dev* pdev)
if (1 == flag)
{
dal_free_dma_pool(chip_id);
dal_free_dma_pool(lchip);
pci_release_regions(pdev);
pci_disable_device(pdev);
dal_dev[chip_id].pci_dev = NULL;
dal_dev[lchip].pci_dev = NULL;
dal_chip_num--;
}
@ -1496,7 +1514,7 @@ linux_dal_ioctl(struct file* file,
unsigned int cmd, unsigned long arg)
#else
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 13))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36))
static int
linux_dal_ioctl(struct file* file,
unsigned int cmd, unsigned long arg)
@ -1812,3 +1830,4 @@ linux_dal_exit(void)
module_init(linux_dal_init);
module_exit(linux_dal_exit);

View File

@ -54,7 +54,7 @@ typedef unsigned int uintptr;
#define DAL_ONE_MB (1024*1024)
struct dal_chip_parm_s
{
unsigned int chip_id; /*tmp should be uint8*/
unsigned int lchip; /*tmp should be uint8*/
unsigned int fpga_id; /*tmp add*/
unsigned int reg_addr;
unsigned int value;
@ -78,7 +78,7 @@ typedef struct dal_irq_mapping_s dal_irq_mapping_t;
struct dal_user_dev_s
{
unsigned int chip_num; /*output: local chip number*/
unsigned int chip_id; /*input: local chip id*/
unsigned int lchip; /*input: local chip id*/
unsigned int phy_base0; /* low 32bits physical base address */
unsigned int phy_base1; /* high 32bits physical base address */
unsigned int bus_no;
@ -100,7 +100,7 @@ typedef struct dma_info_s dma_info_t;
struct dal_pci_cfg_ioctl_s
{
unsigned int chip_id; /* Device ID */
unsigned int lchip; /* Device ID */
unsigned int offset;
unsigned int value;
};
@ -168,3 +168,4 @@ typedef enum dal_version_e dal_version_t;
#endif

View File

@ -1,4 +1,3 @@
#include "dal_mpool.h"
#ifdef __KERNEL__
@ -27,6 +26,8 @@ static sal_mutex_t* dal_mpool_lock;
#endif /* __KERNEL__ */
dal_mpool_mem_t* g_free_block_ptr = NULL;
/* System cache line size */
@ -34,8 +35,9 @@ dal_mpool_mem_t* g_free_block_ptr = NULL;
#define DAL_CACHE_LINE_BYTES 256
#endif
static dal_mpool_mem_t* p_desc_pool = NULL;
static dal_mpool_mem_t* p_data_pool = NULL;
#define DAL_MAX_CHIP_NUM 32
static dal_mpool_mem_t* p_desc_pool[DAL_MAX_CHIP_NUM] = {0};
static dal_mpool_mem_t* p_data_pool[DAL_MAX_CHIP_NUM] = {0};
int
dal_mpool_init(void)
@ -74,7 +76,7 @@ _dal_mpool_create(void* base, int size, int type)
}
dal_mpool_mem_t*
dal_mpool_create(void* base, int size)
dal_mpool_create(unsigned char lchip, void* base, int size)
{
dal_mpool_mem_t* head = NULL;
int mod = (int)(((unsigned long)base) & (DAL_CACHE_LINE_BYTES - 1));
@ -98,8 +100,8 @@ dal_mpool_create(void* base, int size)
}
/* init for desc linkptr */
p_desc_pool = _dal_mpool_create(base, DAL_MPOOL_MAX_DESX_SIZE, DAL_MPOOL_TYPE_DESC);
if (NULL == p_desc_pool)
p_desc_pool[lchip] = _dal_mpool_create(base, DAL_MPOOL_MAX_DESX_SIZE, DAL_MPOOL_TYPE_DESC);
if (NULL == p_desc_pool[lchip])
{
MPOOL_UNLOCK();
DAL_FREE(head->next);
@ -108,14 +110,14 @@ dal_mpool_create(void* base, int size)
}
/* init for data linkptr */
p_data_pool = _dal_mpool_create(((char*)base+DAL_MPOOL_MAX_DESX_SIZE), (size - DAL_MPOOL_MAX_DESX_SIZE), DAL_MPOOL_TYPE_DATA);
if (NULL == p_data_pool)
p_data_pool[lchip] = _dal_mpool_create(((char*)base+DAL_MPOOL_MAX_DESX_SIZE), (size - DAL_MPOOL_MAX_DESX_SIZE), DAL_MPOOL_TYPE_DATA);
if (NULL == p_data_pool[lchip])
{
MPOOL_UNLOCK();
DAL_FREE(head->next);
DAL_FREE(head);
DAL_FREE(p_desc_pool->next);
DAL_FREE(p_desc_pool);
DAL_FREE(p_desc_pool[lchip]->next);
DAL_FREE(p_desc_pool[lchip]);
return NULL;
}
@ -160,7 +162,7 @@ _dal_mpool_alloc_comon(dal_mpool_mem_t* ptr, int size, int type)
}
void*
dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
dal_mpool_alloc(unsigned char lchip, dal_mpool_mem_t* pool, int size, int type)
{
dal_mpool_mem_t* ptr = NULL;
dal_mpool_mem_t* new_ptr = NULL;
@ -186,7 +188,7 @@ dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
}
break;
case DAL_MPOOL_TYPE_DESC:
ptr = p_desc_pool;
ptr = p_desc_pool[lchip];
new_ptr = _dal_mpool_alloc_comon(ptr, size, type);
if (NULL == new_ptr)
{
@ -195,7 +197,7 @@ dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
}
break;
case DAL_MPOOL_TYPE_DATA:
ptr = p_data_pool;
ptr = p_data_pool[lchip];
new_ptr = _dal_mpool_alloc_comon(ptr, size, type);
if (NULL == new_ptr)
{
@ -210,6 +212,10 @@ dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
}
MPOOL_UNLOCK();
if( NULL == new_ptr )
{
return NULL;
}
return new_ptr->address;
}
@ -242,7 +248,7 @@ _dal_mpool_free(dal_mpool_mem_t* ptr, void* addr, int type)
}
void
dal_mpool_free(dal_mpool_mem_t* pool, void* addr)
dal_mpool_free(unsigned char lchip, dal_mpool_mem_t* pool, void* addr)
{
dal_mpool_mem_t* ptr = pool;
@ -255,11 +261,11 @@ dal_mpool_free(dal_mpool_mem_t* pool, void* addr)
_dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_USELESS);
break;
case DAL_MPOOL_TYPE_DESC:
ptr = p_desc_pool;
ptr = p_desc_pool[lchip];
_dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DESC);
break;
case DAL_MPOOL_TYPE_DATA:
ptr = p_data_pool;
ptr = p_data_pool[lchip];
_dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DATA);
break;
default:
@ -271,7 +277,7 @@ dal_mpool_free(dal_mpool_mem_t* pool, void* addr)
}
int
dal_mpool_destroy(dal_mpool_mem_t* pool)
dal_mpool_destroy(unsigned char lchip, dal_mpool_mem_t* pool)
{
dal_mpool_mem_t* ptr, * next;
@ -283,13 +289,13 @@ dal_mpool_destroy(dal_mpool_mem_t* pool)
DAL_FREE(ptr);
}
for (ptr = p_desc_pool; ptr; ptr = next)
for (ptr = p_desc_pool[lchip]; ptr; ptr = next)
{
next = ptr->next;
DAL_FREE(ptr);
}
for (ptr = p_data_pool; ptr; ptr = next)
for (ptr = p_data_pool[lchip]; ptr; ptr = next)
{
next = ptr->next;
DAL_FREE(ptr);
@ -341,3 +347,4 @@ dal_mpool_debug(dal_mpool_mem_t* pool)
return 0;
}

View File

@ -47,16 +47,16 @@ extern int
dal_mpool_init(void);
extern dal_mpool_mem_t*
dal_mpool_create(void* base_ptr, int size);
dal_mpool_create(unsigned char lchip, void* base_ptr, int size);
extern void*
dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type);
dal_mpool_alloc(unsigned char lchip, dal_mpool_mem_t* pool, int size, int type);
extern void
dal_mpool_free(dal_mpool_mem_t* pool, void* addr);
dal_mpool_free(unsigned char lchip, dal_mpool_mem_t* pool, void* addr);
extern int
dal_mpool_destroy(dal_mpool_mem_t* pool);
dal_mpool_destroy(unsigned char lchip, dal_mpool_mem_t* pool);
extern int
dal_mpool_usage(dal_mpool_mem_t* pool, int type);
@ -69,3 +69,4 @@ dal_mpool_debug(dal_mpool_mem_t* pool);
#endif /* !_DMA_MPOOL_H */

View File

@ -19,16 +19,58 @@ init_devnum() {
init_devnum
if [ "$1" == "init" ]; then
#install drivers and dependencies
depmod -a
modprobe i2c-i801
modprobe i2c-dev
modprobe i2c-mux
modprobe i2c-smbus
modprobe i2c-mux-pca954x force_deselect_on_exit=1
modprobe centec_e582_48x2q4z_platform
i2cset -y 0 0x58 0x8 0x3f
modprobe lm77
modprobe tun
modprobe dal
modprobe centec_at24c64
modprobe centec_e582_48x2q4z_platform
i2cset -y 15 0x21 0x18 0x0
i2cset -y 15 0x21 0x19 0x0
i2cset -y 15 0x21 0x1a 0xff
i2cset -y 15 0x21 0x1b 0xff
i2cset -y 15 0x21 0x1c 0xff
i2cset -y 15 0x21 0x8 0x0
i2cset -y 15 0x21 0x9 0x0
i2cset -y 15 0x22 0x18 0xff
i2cset -y 15 0x22 0x19 0x0
i2cset -y 15 0x22 0x1a 0x0
i2cset -y 15 0x22 0x1b 0xff
i2cset -y 15 0x22 0x1c 0xff
i2cset -y 15 0x22 0x9 0x0
i2cset -y 15 0x22 0xa 0x0
i2cset -y 16 0x21 0x18 0x0
i2cset -y 16 0x21 0x19 0x0
i2cset -y 16 0x21 0x1a 0xff
i2cset -y 16 0x21 0x1b 0xff
i2cset -y 16 0x21 0x1c 0xff
i2cset -y 16 0x21 0x8 0x0
i2cset -y 16 0x21 0x9 0x0
i2cset -y 17 0x22 0x18 0xff
i2cset -y 17 0x22 0x19 0x0
i2cset -y 17 0x22 0x1a 0xff
i2cset -y 17 0x22 0x1b 0x0
i2cset -y 17 0x22 0x1c 0xff
i2cset -y 17 0x22 0x9 0x0
i2cset -y 17 0x22 0xb 0x0c
#start platform monitor
rm -rf /usr/bin/platform_monitor
ln -s /usr/bin/48x2q4z_platform_monitor.py /usr/bin/platform_monitor
python /usr/bin/platform_monitor &
elif [ "$1" == "deinit" ]; then
kill -9 $(pidof platform_monitor) > /dev/null 2>&1
rm -rf /usr/bin/platform_monitor
modprobe -r centec_e582_48x2q4z_platform
modprobe -r centec_at24c64
modprobe -r dal
modprobe -r centec_e582_48x2q4z_platform
modprobe -r i2c-mux-pca954x
modprobe -r i2c-dev
else

View File

@ -0,0 +1,217 @@
#!/usr/bin/env python
#############################################################################
# Centec
#
# Module contains an implementation of sfp presence scan logic
#
#############################################################################
try:
import os
import os.path
import threading
import time
import logging
import struct
import syslog
import swsssdk
from socket import *
from select import *
except ImportError, e:
raise ImportError(str(e) + " - required module not found")
def DBG_PRINT(str):
syslog.openlog("centec-pmon")
syslog.syslog(syslog.LOG_INFO, str)
syslog.closelog()
PORT_NUMBER = (48+6)
class PlatformMonitor:
"""init board platform default config"""
def __init__(self):
"""[ctlid, slavedevid]"""
self.fiber_mapping = [(0, 0)] # res
self.fiber_mapping.extend([(1, 7), (1, 6), (1, 5), (1, 4), (1, 3), (1, 2), (1, 1), (1, 0)]) # panel port 1~8
self.fiber_mapping.extend([(1, 15), (1, 14), (1, 13), (1, 12), (1, 11), (1, 10), (1, 9), (1, 8)]) # panel port 9~16
self.fiber_mapping.extend([(1, 19), (1, 17), (1, 16), (1, 18), (0, 7), (0, 6), (0, 5), (0, 4)]) # panel port 17~24
self.fiber_mapping.extend([(0, 3), (0, 2), (0, 1), (0, 0), (0, 15), (0, 14), (0, 13), (0, 12)]) # panel port 25~32
self.fiber_mapping.extend([(0, 11), (0, 10), (0, 9), (0, 8), (0, 23), (0, 22), (0, 21), (0, 20)]) # panel port 33~40
self.fiber_mapping.extend([(0, 19), (0, 18), (0, 17), (0, 16), (0, 31), (0, 26), (0, 29), (0, 27)]) # panel port 41~48
self.fiber_mapping.extend([(0, 24), (0, 25), (1, 23), (1, 22), (1, 21), (1, 20)]) # panel port 49~54
self.udpClient = socket(AF_INET, SOCK_DGRAM)
self.sfp_present = [0]*(PORT_NUMBER+1)
self.sfp_enable = [0]*(PORT_NUMBER+1)
self.f_sfp_present = "/sys/class/sfp/sfp{}/sfp_presence"
self.f_sfp_enable = "/sys/class/sfp/sfp{}/sfp_enable"
self.sfp_scan_timer = 0
def is_qsfp(self, port):
if port <= 48:
return False
else:
return True
def get_sfp_present(self, port):
with open(self.f_sfp_present.format(port), 'r') as sfp_file:
return int(sfp_file.read())
def set_sfp_present(self, port, present):
self.sfp_present[port] = present
def set_sfp_enable(self, port, enable):
if self.is_qsfp(port):
if enable:
with open(self.f_sfp_enable.format(port), 'w') as sfp_file:
sfp_file.write("1")
self.sfp_enable[port] = 1
else:
with open(self.f_sfp_enable.format(port), 'w') as sfp_file:
sfp_file.write("0")
self.sfp_enable[port] = 0
else:
(ctlid, devid) = self.fiber_mapping[port]
req = struct.pack('=HHHBBHIBBBBI', 0, 9, 16, ctlid, devid, 0x50, 0, 0x56, 1, 0xf, 0, 1)
self.udpClient.sendto(req, ('localhost', 8101))
rsp, addr = self.udpClient.recvfrom(1024)
rsp_data = struct.unpack('=HHHBBHIBBBBIi512B', rsp)
enable_v = rsp_data[13]
if enable:
enable_v &= 0xf0
else:
enable_v |= 0x0f
data = struct.pack('=HHHBBHBBBB', 0, 11, 8, ctlid, 0x56, 0x50, devid, enable_v, 0xf, 0)
self.udpClient.sendto(data, ('localhost', 8101))
DBG_PRINT("set sfp{} to {}".format(port, ("enable" if enable else "disable")))
def initialize_configdb(self):
try:
f_mac = os.popen('ip link show eth0 | grep ether | awk \'{print $2}\'')
mac_addr = f_mac.read(17)
last_byte = mac_addr[-2:]
aligned_last_byte = format(int(int(str(last_byte), 16) + 1), '02x')
mac_addr = mac_addr[:-2] + aligned_last_byte
DBG_PRINT("start connect swss config-db to set device mac-address")
swss = swsssdk.SonicV2Connector()
swss.connect(swss.CONFIG_DB)
swss.set(swss.CONFIG_DB, "DEVICE_METADATA|localhost", 'mac', mac_addr)
mac_addr = swss.get(swss.CONFIG_DB, "DEVICE_METADATA|localhost", 'mac')
DBG_PRINT("set device mac-address: %s" % mac_addr)
except IOError as e:
DBG_PRINT(str(e))
def initialize_rpc(self):
while True:
try:
r_sel = [self.udpClient]
echo_req = struct.pack('=HHH', 0, 1, 0)
self.udpClient.sendto(echo_req, ('localhost', 8101))
result = select(r_sel, [], [], 1)
if self.udpClient in result[0]:
echo_rsp, srv_addr = self.udpClient.recvfrom(1024)
if echo_rsp:
break
DBG_PRINT("connect to sdk rpc server timeout, try again.")
except IOError as e:
DBG_PRINT(str(e))
DBG_PRINT("connect to sdk rpc server success.")
def initialize_gpio(self):
# set gpio 1,2,3,4,5,6,7,8 output mode
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 1, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 2, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 3, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 4, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 5, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 6, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 7, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 1, 8, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
# set gpio 1,2,3,4,5,6,7,8 output 0 to reset i2c bridge
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 1, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 2, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 3, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 4, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 5, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 6, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 7, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 8, 0)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
# set gpio 1,2,3,4,5,6,7,8 output 1 to release i2c bridge
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 1, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 2, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 3, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 4, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 5, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 6, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 7, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
gpio_init = struct.pack('=HHHBBB', 0, 13, 3, 2, 8, 1)
self.udpClient.sendto(gpio_init, ('localhost', 8101))
DBG_PRINT("config ctc chip gpio done.")
def initialize_sfp(self):
try:
for port in range(1, PORT_NUMBER+1):
if self.get_sfp_present(port):
self.set_sfp_present(port, 1)
self.set_sfp_enable(port, 1)
else:
self.set_sfp_present(port, 0)
self.set_sfp_enable(port, 0)
except IOError as e:
DBG_PRINT(str(e))
def initialize(self):
DBG_PRINT("start connect to sdk rpc server.")
self.initialize_configdb()
self.initialize_rpc()
self.initialize_gpio()
self.initialize_sfp()
def sfp_scan(self):
try:
for port in range(1, PORT_NUMBER+1):
cur_present = self.get_sfp_present(port)
if self.sfp_present[port] != cur_present:
self.set_sfp_present(port, cur_present)
self.set_sfp_enable(port, cur_present)
except IOError as e:
DBG_PRINT(str(e))
def start(self):
while True:
self.sfp_scan()
time.sleep(1)
if __name__ == "__main__":
monitor = PlatformMonitor()
monitor.initialize()
monitor.start()

View File

@ -0,0 +1,13 @@
[Unit]
Description=Centec e582 48x2q4z platform modules
After=local-fs.target
Before=pmon.service
[Service]
Type=oneshot
ExecStart=-/etc/init.d/platform-modules-e582-48x2q4z start
ExecStop=-/etc/init.d/platform-modules-e582-48x2q4z stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -13,274 +13,274 @@
"VLAN": {},
"PORT": {
"Ethernet1": {
"alias": "Ethernet1",
"lanes": "4",
"speed": "1000"
"alias": "eth-0-1",
"speed": "1000",
"mtu": "9100"
},
"Ethernet2": {
"alias": "Ethernet2",
"lanes": "5",
"speed": "1000"
"alias": "eth-0-2",
"speed": "1000",
"mtu": "9100"
},
"Ethernet3": {
"alias": "Ethernet3",
"lanes": "6",
"speed": "1000"
"Ethernet3": {
"alias": "eth-0-3",
"speed": "1000",
"mtu": "9100"
},
"Ethernet4": {
"alias": "Ethernet4",
"lanes": "8",
"speed": "1000"
"Ethernet4": {
"alias": "eth-0-4",
"speed": "1000",
"mtu": "9100"
},
"Ethernet5": {
"alias": "Ethernet5",
"lanes": "9",
"speed": "1000"
"Ethernet5": {
"alias": "eth-0-5",
"speed": "1000",
"mtu": "9100"
},
"Ethernet6": {
"alias": "Ethernet6",
"lanes": "10",
"speed": "1000"
"Ethernet6": {
"alias": "eth-0-6",
"speed": "1000",
"mtu": "9100"
},
"Ethernet7": {
"alias": "Ethernet7",
"lanes": "12",
"speed": "1000"
"Ethernet7": {
"alias": "eth-0-7",
"speed": "1000",
"mtu": "9100"
},
"Ethernet8": {
"alias": "Ethernet8",
"lanes": "13",
"speed": "1000"
"Ethernet8": {
"alias": "eth-0-8",
"speed": "1000",
"mtu": "9100"
},
"Ethernet9": {
"alias": "Ethernet9",
"lanes": "14",
"speed": "1000"
"Ethernet9": {
"alias": "eth-0-9",
"speed": "1000",
"mtu": "9100"
},
"Ethernet10": {
"alias": "Ethernet10",
"lanes": "16",
"speed": "1000"
"Ethernet10": {
"alias": "eth-0-10",
"speed": "1000",
"mtu": "9100"
},
"Ethernet11": {
"alias": "Ethernet11",
"lanes": "17",
"speed": "1000"
"Ethernet11": {
"alias": "eth-0-11",
"speed": "1000",
"mtu": "9100"
},
"Ethernet12": {
"alias": "Ethernet12",
"lanes": "18",
"speed": "1000"
"Ethernet12": {
"alias": "eth-0-12",
"speed": "1000",
"mtu": "9100"
},
"Ethernet13": {
"alias": "Ethernet13",
"lanes": "20",
"speed": "10000"
"Ethernet13": {
"alias": "eth-0-13",
"speed": "10000",
"mtu": "9100"
},
"Ethernet14": {
"alias": "Ethernet14",
"lanes": "21",
"speed": "10000"
"Ethernet14": {
"alias": "eth-0-14",
"speed": "10000",
"mtu": "9100"
},
"Ethernet15": {
"alias": "Ethernet15",
"lanes": "22",
"speed": "10000"
"Ethernet15": {
"alias": "eth-0-15",
"speed": "10000",
"mtu": "9100"
},
"Ethernet16": {
"alias": "Ethernet16",
"lanes": "24",
"speed": "10000"
"Ethernet16": {
"alias": "eth-0-16",
"speed": "10000",
"mtu": "9100"
},
"Ethernet17": {
"alias": "Ethernet17",
"lanes": "25",
"speed": "10000"
"Ethernet17": {
"alias": "eth-0-17",
"speed": "10000",
"mtu": "9100"
},
"Ethernet18": {
"alias": "Ethernet18",
"lanes": "26",
"speed": "10000"
"Ethernet18": {
"alias": "eth-0-18",
"speed": "10000",
"mtu": "9100"
},
"Ethernet19": {
"alias": "Ethernet19",
"lanes": "28",
"speed": "10000"
"Ethernet19": {
"alias": "eth-0-19",
"speed": "10000",
"mtu": "9100"
},
"Ethernet20": {
"alias": "Ethernet20",
"lanes": "30",
"speed": "10000"
"Ethernet20": {
"alias": "eth-0-20",
"speed": "10000",
"mtu": "9100"
},
"Ethernet21": {
"alias": "Ethernet21",
"lanes": "31",
"speed": "10000"
"Ethernet21": {
"alias": "eth-0-21",
"speed": "10000",
"mtu": "9100"
},
"Ethernet22": {
"alias": "Ethernet22",
"lanes": "32",
"speed": "10000"
"Ethernet22": {
"alias": "eth-0-22",
"speed": "10000",
"mtu": "9100"
},
"Ethernet23": {
"alias": "Ethernet23",
"lanes": "34",
"speed": "10000"
"Ethernet23": {
"alias": "eth-0-23",
"speed": "10000",
"mtu": "9100"
},
"Ethernet24": {
"alias": "Ethernet24",
"lanes": "35",
"speed": "10000"
"Ethernet24": {
"alias": "eth-0-24",
"speed": "10000",
"mtu": "9100"
},
"Ethernet25": {
"alias": "Ethernet25",
"lanes": "40",
"speed": "10000"
"Ethernet25": {
"alias": "eth-0-25",
"speed": "10000",
"mtu": "9100"
},
"Ethernet26": {
"alias": "Ethernet26",
"lanes": "41",
"speed": "10000"
"Ethernet26": {
"alias": "eth-0-26",
"speed": "10000",
"mtu": "9100"
},
"Ethernet27": {
"alias": "Ethernet27",
"lanes": "43",
"speed": "10000"
"Ethernet27": {
"alias": "eth-0-27",
"speed": "10000",
"mtu": "9100"
},
"Ethernet28": {
"alias": "Ethernet28",
"lanes": "36",
"speed": "10000"
"Ethernet28": {
"alias": "eth-0-28",
"speed": "10000",
"mtu": "9100"
},
"Ethernet29": {
"alias": "Ethernet29",
"lanes": "37",
"speed": "10000"
"Ethernet29": {
"alias": "eth-0-29",
"speed": "10000",
"mtu": "9100"
},
"Ethernet30": {
"alias": "Ethernet30",
"lanes": "39",
"speed": "10000"
"Ethernet30": {
"alias": "eth-0-30",
"speed": "10000",
"mtu": "9100"
},
"Ethernet31": {
"alias": "Ethernet31",
"lanes": "44",
"speed": "10000"
"Ethernet31": {
"alias": "eth-0-31",
"speed": "10000",
"mtu": "9100"
},
"Ethernet32": {
"alias": "Ethernet32",
"lanes": "45",
"speed": "10000"
"Ethernet32": {
"alias": "eth-0-32",
"speed": "10000",
"mtu": "9100"
},
"Ethernet33": {
"alias": "Ethernet33",
"lanes": "46",
"speed": "10000"
"Ethernet33": {
"alias": "eth-0-33",
"speed": "10000",
"mtu": "9100"
},
"Ethernet34": {
"alias": "Ethernet34",
"lanes": "47",
"speed": "10000"
"Ethernet34": {
"alias": "eth-0-34",
"speed": "10000",
"mtu": "9100"
},
"Ethernet35": {
"alias": "Ethernet35",
"lanes": "80",
"speed": "10000"
"Ethernet35": {
"alias": "eth-0-35",
"speed": "10000",
"mtu": "9100"
},
"Ethernet36": {
"alias": "Ethernet36",
"lanes": "81",
"speed": "10000"
"Ethernet36": {
"alias": "eth-0-36",
"speed": "10000",
"mtu": "9100"
},
"Ethernet37": {
"alias": "Ethernet37",
"lanes": "82",
"speed": "10000"
"Ethernet37": {
"alias": "eth-0-37",
"speed": "10000",
"mtu": "9100"
},
"Ethernet38": {
"alias": "Ethernet38",
"lanes": "88",
"speed": "10000"
"Ethernet38": {
"alias": "eth-0-38",
"speed": "10000",
"mtu": "9100"
},
"Ethernet39": {
"alias": "Ethernet39",
"lanes": "89",
"speed": "10000"
"Ethernet39": {
"alias": "eth-0-39",
"speed": "10000",
"mtu": "9100"
},
"Ethernet40": {
"alias": "Ethernet40",
"lanes": "90",
"speed": "10000"
"Ethernet40": {
"alias": "eth-0-40",
"speed": "10000",
"mtu": "9100"
},
"Ethernet41": {
"alias": "Ethernet41",
"lanes": "84",
"speed": "10000"
"Ethernet41": {
"alias": "eth-0-41",
"speed": "10000",
"mtu": "9100"
},
"Ethernet42": {
"alias": "Ethernet42",
"lanes": "85",
"speed": "10000"
"Ethernet42": {
"alias": "eth-0-42",
"speed": "10000",
"mtu": "9100"
},
"Ethernet43": {
"alias": "Ethernet43",
"lanes": "86",
"speed": "10000"
"Ethernet43": {
"alias": "eth-0-43",
"speed": "10000",
"mtu": "9100"
},
"Ethernet44": {
"alias": "Ethernet44",
"lanes": "87",
"speed": "10000"
"Ethernet44": {
"alias": "eth-0-44",
"speed": "10000",
"mtu": "9100"
},
"Ethernet45": {
"alias": "Ethernet45",
"lanes": "92",
"speed": "10000"
"Ethernet45": {
"alias": "eth-0-45",
"speed": "10000",
"mtu": "9100"
},
"Ethernet46": {
"alias": "Ethernet46",
"lanes": "93",
"speed": "10000"
"Ethernet46": {
"alias": "eth-0-46",
"speed": "10000",
"mtu": "9100"
},
"Ethernet47": {
"alias": "Ethernet47",
"lanes": "94",
"speed": "10000"
"Ethernet47": {
"alias": "eth-0-47",
"speed": "10000",
"mtu": "9100"
},
"Ethernet48": {
"alias": "Ethernet48",
"lanes": "95",
"speed": "10000"
"Ethernet48": {
"alias": "eth-0-48",
"speed": "10000",
"mtu": "9100"
},
"Ethernet49": {
"alias": "Ethernet49",
"lanes": "52,53,54,55",
"speed": "40000"
"Ethernet49": {
"alias": "eth-0-49",
"speed": "40000",
"mtu": "9100"
},
"Ethernet50": {
"alias": "Ethernet50",
"lanes": "56,57,58,59",
"speed": "40000"
"Ethernet50": {
"alias": "eth-0-50",
"speed": "40000",
"mtu": "9100"
},
"Ethernet51": {
"alias": "Ethernet51",
"lanes": "60,61,62,63",
"speed": "40000"
"Ethernet51": {
"alias": "eth-0-51",
"speed": "40000",
"mtu": "9100"
},
"Ethernet52": {
"alias": "Ethernet52",
"lanes": "68,69,70,71",
"speed": "40000"
"Ethernet52": {
"alias": "eth-0-52",
"speed": "40000",
"mtu": "9100"
},
"Ethernet53": {
"alias": "Ethernet53",
"lanes": "72,73,74,75",
"speed": "40000"
"Ethernet53": {
"alias": "eth-0-53",
"speed": "40000",
"mtu": "9100"
},
"Ethernet54": {
"alias": "Ethernet54",
"lanes": "76,77,78,79",
"speed": "40000"
"alias": "eth-0-54",
"speed": "40000",
"mtu": "9100"
}
},
"SYSLOG_SERVER": {},
@ -300,4 +300,3 @@
"Ethernet4|192.168.4.1/24": {}
}
}

View File

@ -112,274 +112,274 @@
},
"PORT": {
"Ethernet1": {
"alias": "Ethernet1",
"lanes": "4",
"speed": "1000"
"alias": "eth-0-1",
"speed": "1000",
"mtu": "9100"
},
"Ethernet2": {
"alias": "Ethernet2",
"lanes": "5",
"speed": "1000"
"alias": "eth-0-2",
"speed": "1000",
"mtu": "9100"
},
"Ethernet3": {
"alias": "Ethernet3",
"lanes": "6",
"speed": "1000"
"alias": "eth-0-3",
"speed": "1000",
"mtu": "9100"
},
"Ethernet4": {
"alias": "Ethernet4",
"lanes": "8",
"speed": "1000"
"alias": "eth-0-4",
"speed": "1000",
"mtu": "9100"
},
"Ethernet5": {
"alias": "Ethernet5",
"lanes": "9",
"speed": "1000"
"alias": "eth-0-5",
"speed": "1000",
"mtu": "9100"
},
"Ethernet6": {
"alias": "Ethernet6",
"lanes": "10",
"speed": "1000"
"alias": "eth-0-6",
"speed": "1000",
"mtu": "9100"
},
"Ethernet7": {
"alias": "Ethernet7",
"lanes": "12",
"speed": "1000"
"alias": "eth-0-7",
"speed": "1000",
"mtu": "9100"
},
"Ethernet8": {
"alias": "Ethernet8",
"lanes": "13",
"speed": "1000"
"alias": "eth-0-8",
"speed": "1000",
"mtu": "9100"
},
"Ethernet9": {
"alias": "Ethernet9",
"lanes": "14",
"speed": "1000"
"alias": "eth-0-9",
"speed": "1000",
"mtu": "9100"
},
"Ethernet10": {
"alias": "Ethernet10",
"lanes": "16",
"speed": "1000"
"alias": "eth-0-10",
"speed": "1000",
"mtu": "9100"
},
"Ethernet11": {
"alias": "Ethernet11",
"lanes": "17",
"speed": "1000"
"alias": "eth-0-11",
"speed": "1000",
"mtu": "9100"
},
"Ethernet12": {
"alias": "Ethernet12",
"lanes": "18",
"speed": "1000"
"alias": "eth-0-12",
"speed": "1000",
"mtu": "9100"
},
"Ethernet13": {
"alias": "Ethernet13",
"lanes": "20",
"speed": "10000"
"alias": "eth-0-13",
"speed": "10000",
"mtu": "9100"
},
"Ethernet14": {
"alias": "Ethernet14",
"lanes": "21",
"speed": "10000"
"alias": "eth-0-14",
"speed": "10000",
"mtu": "9100"
},
"Ethernet15": {
"alias": "Ethernet15",
"lanes": "22",
"speed": "10000"
"alias": "eth-0-15",
"speed": "10000",
"mtu": "9100"
},
"Ethernet16": {
"alias": "Ethernet16",
"lanes": "24",
"speed": "10000"
"alias": "eth-0-16",
"speed": "10000",
"mtu": "9100"
},
"Ethernet17": {
"alias": "Ethernet17",
"lanes": "25",
"speed": "10000"
"alias": "eth-0-17",
"speed": "10000",
"mtu": "9100"
},
"Ethernet18": {
"alias": "Ethernet18",
"lanes": "26",
"speed": "10000"
"alias": "eth-0-18",
"speed": "10000",
"mtu": "9100"
},
"Ethernet19": {
"alias": "Ethernet19",
"lanes": "28",
"speed": "10000"
"alias": "eth-0-19",
"speed": "10000",
"mtu": "9100"
},
"Ethernet20": {
"alias": "Ethernet20",
"lanes": "30",
"speed": "10000"
"alias": "eth-0-20",
"speed": "10000",
"mtu": "9100"
},
"Ethernet21": {
"alias": "Ethernet21",
"lanes": "31",
"speed": "10000"
"alias": "eth-0-21",
"speed": "10000",
"mtu": "9100"
},
"Ethernet22": {
"alias": "Ethernet22",
"lanes": "32",
"speed": "10000"
"alias": "eth-0-22",
"speed": "10000",
"mtu": "9100"
},
"Ethernet23": {
"alias": "Ethernet23",
"lanes": "34",
"speed": "10000"
"alias": "eth-0-23",
"speed": "10000",
"mtu": "9100"
},
"Ethernet24": {
"alias": "Ethernet24",
"lanes": "35",
"speed": "10000"
"alias": "eth-0-24",
"speed": "10000",
"mtu": "9100"
},
"Ethernet25": {
"alias": "Ethernet25",
"lanes": "40",
"speed": "10000"
"alias": "eth-0-25",
"speed": "10000",
"mtu": "9100"
},
"Ethernet26": {
"alias": "Ethernet26",
"lanes": "41",
"speed": "10000"
"alias": "eth-0-26",
"speed": "10000",
"mtu": "9100"
},
"Ethernet27": {
"alias": "Ethernet27",
"lanes": "43",
"speed": "10000"
"alias": "eth-0-27",
"speed": "10000",
"mtu": "9100"
},
"Ethernet28": {
"alias": "Ethernet28",
"lanes": "36",
"speed": "10000"
"alias": "eth-0-28",
"speed": "10000",
"mtu": "9100"
},
"Ethernet29": {
"alias": "Ethernet29",
"lanes": "37",
"speed": "10000"
"alias": "eth-0-29",
"speed": "10000",
"mtu": "9100"
},
"Ethernet30": {
"alias": "Ethernet30",
"lanes": "39",
"speed": "10000"
"alias": "eth-0-30",
"speed": "10000",
"mtu": "9100"
},
"Ethernet31": {
"alias": "Ethernet31",
"lanes": "44",
"speed": "10000"
"alias": "eth-0-31",
"speed": "10000",
"mtu": "9100"
},
"Ethernet32": {
"alias": "Ethernet32",
"lanes": "45",
"speed": "10000"
"alias": "eth-0-32",
"speed": "10000",
"mtu": "9100"
},
"Ethernet33": {
"alias": "Ethernet33",
"lanes": "46",
"speed": "10000"
"alias": "eth-0-33",
"speed": "10000",
"mtu": "9100"
},
"Ethernet34": {
"alias": "Ethernet34",
"lanes": "47",
"speed": "10000"
"alias": "eth-0-34",
"speed": "10000",
"mtu": "9100"
},
"Ethernet35": {
"alias": "Ethernet35",
"lanes": "80",
"speed": "10000"
"alias": "eth-0-35",
"speed": "10000",
"mtu": "9100"
},
"Ethernet36": {
"alias": "Ethernet36",
"lanes": "81",
"speed": "10000"
"alias": "eth-0-36",
"speed": "10000",
"mtu": "9100"
},
"Ethernet37": {
"alias": "Ethernet37",
"lanes": "82",
"speed": "10000"
"alias": "eth-0-37",
"speed": "10000",
"mtu": "9100"
},
"Ethernet38": {
"alias": "Ethernet38",
"lanes": "88",
"speed": "10000"
"alias": "eth-0-38",
"speed": "10000",
"mtu": "9100"
},
"Ethernet39": {
"alias": "Ethernet39",
"lanes": "89",
"speed": "10000"
"alias": "eth-0-39",
"speed": "10000",
"mtu": "9100"
},
"Ethernet40": {
"alias": "Ethernet40",
"lanes": "90",
"speed": "10000"
"alias": "eth-0-40",
"speed": "10000",
"mtu": "9100"
},
"Ethernet41": {
"alias": "Ethernet41",
"lanes": "84",
"speed": "10000"
"alias": "eth-0-41",
"speed": "10000",
"mtu": "9100"
},
"Ethernet42": {
"alias": "Ethernet42",
"lanes": "85",
"speed": "10000"
"alias": "eth-0-42",
"speed": "10000",
"mtu": "9100"
},
"Ethernet43": {
"alias": "Ethernet43",
"lanes": "86",
"speed": "10000"
"alias": "eth-0-43",
"speed": "10000",
"mtu": "9100"
},
"Ethernet44": {
"alias": "Ethernet44",
"lanes": "87",
"speed": "10000"
"alias": "eth-0-44",
"speed": "10000",
"mtu": "9100"
},
"Ethernet45": {
"alias": "Ethernet45",
"lanes": "92",
"speed": "10000"
"alias": "eth-0-45",
"speed": "10000",
"mtu": "9100"
},
"Ethernet46": {
"alias": "Ethernet46",
"lanes": "93",
"speed": "10000"
"alias": "eth-0-46",
"speed": "10000",
"mtu": "9100"
},
"Ethernet47": {
"alias": "Ethernet47",
"lanes": "94",
"speed": "10000"
"alias": "eth-0-47",
"speed": "10000",
"mtu": "9100"
},
"Ethernet48": {
"alias": "Ethernet48",
"lanes": "95",
"speed": "10000"
"alias": "eth-0-48",
"speed": "10000",
"mtu": "9100"
},
"Ethernet49": {
"alias": "Ethernet49",
"lanes": "52,53,54,55",
"speed": "40000"
"alias": "eth-0-49",
"speed": "40000",
"mtu": "9100"
},
"Ethernet50": {
"alias": "Ethernet50",
"lanes": "56,57,58,59",
"speed": "40000"
"alias": "eth-0-50",
"speed": "40000",
"mtu": "9100"
},
"Ethernet51": {
"alias": "Ethernet51",
"lanes": "60,61,62,63",
"speed": "40000"
"alias": "eth-0-51",
"speed": "40000",
"mtu": "9100"
},
"Ethernet52": {
"alias": "Ethernet52",
"lanes": "68,69,70,71",
"speed": "40000"
"alias": "eth-0-52",
"speed": "40000",
"mtu": "9100"
},
"Ethernet53": {
"alias": "Ethernet53",
"lanes": "72,73,74,75",
"speed": "40000"
"alias": "eth-0-53",
"speed": "40000",
"mtu": "9100"
},
"Ethernet54": {
"alias": "Ethernet54",
"lanes": "76,77,78,79",
"speed": "40000"
"alias": "eth-0-54",
"speed": "40000",
"mtu": "9100"
}
},
"PORT_QOS_MAP": {
@ -402,7 +402,7 @@
"weight": "20"
}
},
"VLAN": {
"VLAN": {
"Vlan500": {
"dhcp_servers": [
"192.168.5.1",
@ -418,7 +418,7 @@
],
"vlanid": "500"
},
"Vlan600": {
"Vlan600": {
"dhcp_servers": [
"192.168.6.1",
"192.168.6.2",
@ -431,7 +431,7 @@
],
"vlanid": "600"
},
"Vlan700": {
"Vlan700": {
"dhcp_servers": [
"192.168.7.1",
"192.168.7.2",
@ -444,7 +444,7 @@
],
"vlanid": "700"
},
"Vlan800": {
"Vlan800": {
"dhcp_servers": [
"192.168.8.1",
"192.168.8.2",
@ -458,32 +458,32 @@
"vlanid": "800"
}
},
"VLAN_MEMBER": {
"VLAN_MEMBER": {
"Vlan500|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan500|Ethernet6": {
"Vlan500|Ethernet6": {
"tagging_mode": "untagged"
},
"Vlan500|Ethernet7": {
"Vlan500|Ethernet7": {
"tagging_mode": "untagged"
},
"Vlan500|Ethernet8": {
"Vlan500|Ethernet8": {
"tagging_mode": "untagged"
},
"Vlan600|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan600|Ethernet6": {
"Vlan600|Ethernet6": {
"tagging_mode": "tagged"
},
"Vlan700|Ethernet5": {
"Vlan700|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan700|Ethernet7": {
"Vlan700|Ethernet7": {
"tagging_mode": "tagged"
},
"Vlan800|Ethernet5": {
"Vlan800|Ethernet5": {
"tagging_mode": "tagged"
},
"Vlan800|Ethernet8": {
@ -496,11 +496,11 @@
"Ethernet3|192.168.3.1/24": {},
"Ethernet4|192.168.4.1/24": {}
},
"VLAN_INTERFACE": {
"VLAN_INTERFACE": {
"Vlan500|192.168.5.1/24": {},
"Vlan600|192.168.6.1/24": {},
"Vlan700|192.168.7.1/24": {},
"Vlan800|192.168.8.1/24": {}
"Vlan600|192.168.6.1/24": {},
"Vlan700|192.168.7.1/24": {},
"Vlan800|192.168.8.1/24": {}
},
"LOOPBACK_INTERFACE": {
"Loopback0|127.0.0.1/8": {}

View File

@ -1,38 +0,0 @@
<DeviceMiniGraph xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Microsoft.Search.Autopilot.Evolution">
<CpgDec>
<IsisRouters xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
<PeeringSessions/>
<Routers xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</CpgDec>
<DpgDec>
<DeviceDataPlaneInfo>
<IPSecTunnels/>
<LoopbackIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
</LoopbackIPInterfaces>
<ManagementIPInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
</ManagementIPInterfaces>
<MplsInterfaces/>
<MplsTeInterfaces/>
<RsvpInterfaces/>
<Hostname>switch1</Hostname>
<PortChannelInterfaces/>
<VlanInterfaces/>
<IPInterfaces/>
<DataAcls/>
<AclInterfaces/>
<DownstreamSummaries/>
<DownstreamSummarySet xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution"/>
</DeviceDataPlaneInfo>
</DpgDec>
<PngDec>
<Devices>
<Device i:type="LeafRouter">
<Hostname>switch1</Hostname>
<HwSku>E582-48x6q</HwSku>
</Device>
</Devices>
</PngDec>
<Hostname>switch1</Hostname>
<HwSku>E582-48x6q</HwSku>
</DeviceMiniGraph>

View File

@ -845,7 +845,7 @@ enum led_brightness e582_48x6q_led_get(struct led_classdev *led_cdev)
if (ret != 0)
{
printk(KERN_CRIT "Error: read %s led attr failed\n", led_cdev->name);
return;
return 0;
}
led_value = ((led_value & mask) >> shift);
@ -1189,7 +1189,8 @@ static ssize_t e582_48x6q_sfp_write_enable(struct device *dev, struct device_att
ret = e582_48x6q_smbus_write_reg(i2c_sfp_client, dir_bank, 0x0);
if (ret != 0)
{
return sprintf(buf, "Error: read sfp data:%s set dir-ctl failed\n", attr->attr.name);
printk(KERN_CRIT "Error: read sfp data:%s set dir-ctl failed\n", attr->attr.name);
return size;
}
input_bank = (reg_no/8) + 0x8;
@ -1221,7 +1222,7 @@ static ssize_t e582_48x6q_sfp_write_enable(struct device *dev, struct device_att
}
static DEVICE_ATTR(sfp_presence, S_IRUGO, e582_48x6q_sfp_read_presence, NULL);
static DEVICE_ATTR(sfp_enable, S_IRUGO|S_IWUGO, e582_48x6q_sfp_read_enable, e582_48x6q_sfp_write_enable);
static DEVICE_ATTR(sfp_enable, S_IRUGO|S_IWUSR, e582_48x6q_sfp_read_enable, e582_48x6q_sfp_write_enable);
static int e582_48x6q_init_sfp(void)
{
int ret = 0;

View File

@ -25,7 +25,7 @@
#endif
#include "dal_kernel.h"
#include "dal_mpool.h"
#include <linux/slab.h>
MODULE_AUTHOR("Centec Networks Inc.");
MODULE_DESCRIPTION("DAL kernel module");
MODULE_LICENSE("GPL");
@ -47,7 +47,9 @@ MODULE_PARM_DESC(dma_pool_size,
#define CTC_VENDOR_VID 0xc001
#define CTC_HUMBER_DEVICE_ID 0x6048
#define CTC_GOLDENGATE_DEVICE_ID 0xcb10
#define CTC_GOLDENGATE_DEVICE_ID 0xc010
#define CTC_PCIE_VENDOR_ID 0xcb10
#define CTC_DUET2_DEVICE_ID 0x7148
#define MEM_MAP_RESERVE SetPageReserved
#define MEM_MAP_UNRESERVE ClearPageReserved
@ -82,7 +84,7 @@ typedef struct dal_kernel_dev_s
uintptr logic_address;
/* Physical address */
uintptr phys_address;
unsigned long long phys_address;
} dal_kern_dev_t;
typedef struct _dma_segment
@ -126,8 +128,8 @@ static unsigned int* dma_virt_base[DAL_MAX_CHIP_NUM];
#ifndef DMA_MEM_MODE_PLATFORM
static unsigned int* dma_virt_base_tmp[DAL_MAX_CHIP_NUM];
#endif
static uintptr dma_phy_base[DAL_MAX_CHIP_NUM];
static unsigned int dma_mem_size = 0x800000;
static unsigned long long dma_phy_base[DAL_MAX_CHIP_NUM];
static unsigned int dma_mem_size = 0xc00000;
static unsigned int msi_irq_base[DAL_MAX_CHIP_NUM];
static unsigned int msi_irq_num[DAL_MAX_CHIP_NUM];
static unsigned int msi_used = 0;
@ -141,7 +143,9 @@ MODULE_PARM_DESC(dal_debug, "Set debug level (default 0)");
static struct pci_device_id dal_id_table[] =
{
{PCI_DEVICE(CTC_VENDOR_VID, CTC_GREATBELT_DEVICE_ID)},
{PCI_DEVICE(0xcb10, 0xc010)},
{PCI_DEVICE(CTC_PCIE_VENDOR_ID, CTC_GOLDENGATE_DEVICE_ID)},
{PCI_DEVICE((CTC_PCIE_VENDOR_ID+1), (CTC_GOLDENGATE_DEVICE_ID+1))},
{PCI_DEVICE(CTC_PCIE_VENDOR_ID, CTC_DUET2_DEVICE_ID)},
{0, },
};
@ -186,7 +190,11 @@ static struct file_operations dal_intr_fops[CTC_MAX_INTR_NUM] =
.poll = linux_dal_poll7,
},
};
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
#include <linux/slab.h>
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
#endif
/*****************************************************************************
* macros
*****************************************************************************/
@ -450,9 +458,12 @@ dal_interrupt_register(unsigned int irq, int prio, void (* isr)(void*), void* da
{
if (irq == dal_isr[intr_num_tmp].irq)
{
dal_isr[intr_num_tmp].count++;
printk("Interrupt irq %d register count %d.\n", irq, dal_isr[intr_num_tmp].count);
return 0;
if (0 == msi_used)
{
dal_isr[intr_num_tmp].count++;
printk("Interrupt irq %d register count %d.\n", irq, dal_isr[intr_num_tmp].count);
}
return 0;
}
if ((0 == dal_isr[intr_num_tmp].irq) && (CTC_MAX_INTR_NUM == intr_num))
{
@ -558,14 +569,6 @@ _dal_set_msi_enabe(unsigned int lchip, unsigned int irq_num)
if (irq_num == 1)
{
if (msi_irq_base[lchip])
{
dal_interrupt_unregister(msi_irq_base[lchip]);
pci_disable_msi(dal_dev[lchip].pci_dev);
msi_used = 0;
msi_irq_base[lchip] = 0;
msi_irq_num[lchip] = 0;
}
ret = pci_enable_msi(dal_dev[lchip].pci_dev);
if (ret)
{
@ -616,6 +619,7 @@ int
dal_set_msi_cap(unsigned long arg)
{
int ret = 0;
int index = 0;
dal_msi_info_t msi_info;
if (copy_from_user(&msi_info, (void*)arg, sizeof(dal_msi_info_t)))
@ -626,8 +630,21 @@ dal_set_msi_cap(unsigned long arg)
printk("####dal_set_msi_cap lchip %d base %d num:%d\n", msi_info.lchip, msi_info.irq_base, msi_info.irq_num);
if (msi_info.irq_num > 0)
{
msi_used = 1;
ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num);
if (0 == msi_used)
{
msi_used = 1;
ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num);
}
else if ((1 == msi_used) && (msi_info.irq_num != msi_irq_num[msi_info.lchip]))
{
for (index = 0; index < msi_irq_num[msi_info.lchip]; index++)
{
dal_interrupt_unregister(msi_irq_base[msi_info.lchip]+index);
}
_dal_set_msi_disable(msi_info.lchip);
msi_used = 1;
ret = _dal_set_msi_enabe(msi_info.lchip, msi_info.irq_num);
}
}
else
{
@ -1062,6 +1079,10 @@ int
dal_create_irq_mapping(unsigned long arg)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
#ifndef NO_IRQ
#define NO_IRQ (-1)
#endif
dal_irq_mapping_t irq_map;
if (copy_from_user(&irq_map, (void*)arg, sizeof(dal_irq_mapping_t)))
@ -1094,7 +1115,7 @@ dal_pci_read(unsigned long arg)
return -EFAULT;
}
_dal_pci_read((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr,
_dal_pci_read((unsigned char)cmdpara_chip.lchip, (unsigned int)cmdpara_chip.reg_addr,
(unsigned int*)(&(cmdpara_chip.value)));
if (copy_to_user((dal_chip_parm_t*)arg, (void*)&cmdpara_chip, sizeof(dal_chip_parm_t)))
@ -1127,7 +1148,7 @@ dal_pci_write(unsigned long arg)
return -EFAULT;
}
_dal_pci_write((unsigned char)cmdpara_chip.chip_id, (unsigned int)cmdpara_chip.reg_addr,
_dal_pci_write((unsigned char)cmdpara_chip.lchip, (unsigned int)cmdpara_chip.reg_addr,
(unsigned int)cmdpara_chip.value);
return 0;
@ -1166,7 +1187,7 @@ dal_user_read_pci_conf(unsigned long arg)
return -EFAULT;
}
if (dal_pci_conf_read(dal_cfg.chip_id, dal_cfg.offset, &dal_cfg.value))
if (dal_pci_conf_read(dal_cfg.lchip, dal_cfg.offset, &dal_cfg.value))
{
printk("dal_pci_conf_read failed.\n");
return -EFAULT;
@ -1190,14 +1211,14 @@ dal_user_write_pci_conf(unsigned long arg)
return -EFAULT;
}
return dal_pci_conf_write(dal_cfg.chip_id, dal_cfg.offset, dal_cfg.value);
return dal_pci_conf_write(dal_cfg.lchip, dal_cfg.offset, dal_cfg.value);
}
static int
linux_get_device(unsigned long arg)
{
dal_user_dev_t user_dev;
int chip_id = 0;
int lchip = 0;
if (copy_from_user(&user_dev, (void*)arg, sizeof(user_dev)))
{
@ -1205,20 +1226,16 @@ linux_get_device(unsigned long arg)
}
user_dev.chip_num = dal_chip_num;
chip_id = user_dev.chip_id;
lchip = user_dev.lchip;
if (chip_id < dal_chip_num)
if (lchip < dal_chip_num)
{
user_dev.phy_base0 = (unsigned int)dal_dev[chip_id].phys_address;
#ifdef PHYS_ADDR_IS_64BIT
user_dev.phy_base1 = (unsigned int)(dal_dev[chip_id].phys_address >> 32);
#else
user_dev.phy_base1 = 0;
#endif
user_dev.phy_base0 = (unsigned int)dal_dev[lchip].phys_address;
user_dev.phy_base1 = (unsigned int)(dal_dev[lchip].phys_address >> 32);
user_dev.bus_no = dal_dev[chip_id].pci_dev->bus->number;
user_dev.dev_no = dal_dev[chip_id].pci_dev->device;
user_dev.fun_no = dal_dev[chip_id].pci_dev->devfn;
user_dev.bus_no = dal_dev[lchip].pci_dev->bus->number;
user_dev.dev_no = dal_dev[lchip].pci_dev->device;
user_dev.fun_no = dal_dev[lchip].pci_dev->devfn;
}
if (copy_to_user((dal_user_dev_t*)arg, (void*)&user_dev, sizeof(user_dev)))
@ -1256,11 +1273,7 @@ linux_get_dma_info(unsigned long arg)
}
dma_para.phy_base = (unsigned int)dma_phy_base[dma_para.lchip];
#ifdef PHYS_ADDR_IS_64BIT
dma_para.phy_base_hi = dma_phy_base[dma_para.lchip] >> 32;
#else
dma_para.phy_base_hi = 0;
#endif
dma_para.size = dma_mem_size;
if (copy_to_user((dma_info_t*)arg, (void*)&dma_para, sizeof(dma_info_t)))
@ -1348,10 +1361,10 @@ dal_cache_inval(unsigned long arg)
#if 0
dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
return 0;
}
@ -1371,10 +1384,10 @@ dal_cache_flush(unsigned long arg)
#if 0
dma_sync_single_for_cpu(NULL, intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
dma_cache_sync(NULL, (void*)intr_para.ptr, intr_para.length, DMA_BIDIRECTIONAL);
#endif
return 0;
}
@ -1386,31 +1399,30 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
int ret = 0;
unsigned int temp = 0;
unsigned int lchip = 0;
unsigned int chip_id = 0;
printk(KERN_WARNING "********found dal device*****\n");
for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++)
for (lchip = 0; lchip < DAL_MAX_CHIP_NUM; lchip ++)
{
if (NULL == dal_dev[chip_id].pci_dev)
if (NULL == dal_dev[lchip].pci_dev)
{
break;
}
}
if (chip_id >= DAL_MAX_CHIP_NUM)
if (lchip >= DAL_MAX_CHIP_NUM)
{
printk("Exceed max local chip num\n");
return -1;
}
dev = &dal_dev[chip_id];
dev = &dal_dev[lchip];
if (NULL == dev)
{
printk("Cannot obtain PCI resources\n");
}
lchip = chip_id;
lchip = lchip;
dal_chip_num += 1;
dev->pci_dev = pdev;
@ -1454,7 +1466,6 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
if (dma_mem_size)
{
dal_alloc_dma_pool(lchip, dma_mem_size);
#ifdef PHYS_ADDR_IS_64BIT
/*add check Dma memory pool cannot cross 4G space*/
if ((0==(dma_phy_base[lchip]>>32)) && (0!=((dma_phy_base[lchip]+dma_mem_size)>>32)))
@ -1462,7 +1473,6 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
printk("Dma malloc memory cross 4G space!!!!!! \n");
return -1;
}
#endif
}
printk(KERN_WARNING "linux_dal_probe end*****\n");
@ -1473,12 +1483,12 @@ linux_dal_probe(struct pci_dev* pdev, const struct pci_device_id* id)
void
linux_dal_remove(struct pci_dev* pdev)
{
unsigned int chip_id = 0;
unsigned int lchip = 0;
unsigned int flag = 0;
for (chip_id = 0; chip_id < DAL_MAX_CHIP_NUM; chip_id ++)
for (lchip = 0; lchip < DAL_MAX_CHIP_NUM; lchip ++)
{
if (pdev == dal_dev[chip_id].pci_dev)
if (pdev == dal_dev[lchip].pci_dev)
{
flag = 1;
break;
@ -1487,11 +1497,11 @@ linux_dal_remove(struct pci_dev* pdev)
if (1 == flag)
{
dal_free_dma_pool(chip_id);
dal_free_dma_pool(lchip);
pci_release_regions(pdev);
pci_disable_device(pdev);
dal_dev[chip_id].pci_dev = NULL;
dal_dev[lchip].pci_dev = NULL;
dal_chip_num--;
}
@ -1504,7 +1514,7 @@ linux_dal_ioctl(struct file* file,
unsigned int cmd, unsigned long arg)
#else
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 13))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36))
static int
linux_dal_ioctl(struct file* file,
unsigned int cmd, unsigned long arg)
@ -1820,3 +1830,4 @@ linux_dal_exit(void)
module_init(linux_dal_init);
module_exit(linux_dal_exit);

View File

@ -54,7 +54,7 @@ typedef unsigned int uintptr;
#define DAL_ONE_MB (1024*1024)
struct dal_chip_parm_s
{
unsigned int chip_id; /*tmp should be uint8*/
unsigned int lchip; /*tmp should be uint8*/
unsigned int fpga_id; /*tmp add*/
unsigned int reg_addr;
unsigned int value;
@ -78,7 +78,7 @@ typedef struct dal_irq_mapping_s dal_irq_mapping_t;
struct dal_user_dev_s
{
unsigned int chip_num; /*output: local chip number*/
unsigned int chip_id; /*input: local chip id*/
unsigned int lchip; /*input: local chip id*/
unsigned int phy_base0; /* low 32bits physical base address */
unsigned int phy_base1; /* high 32bits physical base address */
unsigned int bus_no;
@ -100,7 +100,7 @@ typedef struct dma_info_s dma_info_t;
struct dal_pci_cfg_ioctl_s
{
unsigned int chip_id; /* Device ID */
unsigned int lchip; /* Device ID */
unsigned int offset;
unsigned int value;
};
@ -168,3 +168,4 @@ typedef enum dal_version_e dal_version_t;
#endif

View File

@ -1,4 +1,3 @@
#include "dal_mpool.h"
#ifdef __KERNEL__
@ -27,6 +26,8 @@ static sal_mutex_t* dal_mpool_lock;
#endif /* __KERNEL__ */
dal_mpool_mem_t* g_free_block_ptr = NULL;
/* System cache line size */
@ -34,8 +35,9 @@ dal_mpool_mem_t* g_free_block_ptr = NULL;
#define DAL_CACHE_LINE_BYTES 256
#endif
static dal_mpool_mem_t* p_desc_pool = NULL;
static dal_mpool_mem_t* p_data_pool = NULL;
#define DAL_MAX_CHIP_NUM 32
static dal_mpool_mem_t* p_desc_pool[DAL_MAX_CHIP_NUM] = {0};
static dal_mpool_mem_t* p_data_pool[DAL_MAX_CHIP_NUM] = {0};
int
dal_mpool_init(void)
@ -74,7 +76,7 @@ _dal_mpool_create(void* base, int size, int type)
}
dal_mpool_mem_t*
dal_mpool_create(void* base, int size)
dal_mpool_create(unsigned char lchip, void* base, int size)
{
dal_mpool_mem_t* head = NULL;
int mod = (int)(((unsigned long)base) & (DAL_CACHE_LINE_BYTES - 1));
@ -98,8 +100,8 @@ dal_mpool_create(void* base, int size)
}
/* init for desc linkptr */
p_desc_pool = _dal_mpool_create(base, DAL_MPOOL_MAX_DESX_SIZE, DAL_MPOOL_TYPE_DESC);
if (NULL == p_desc_pool)
p_desc_pool[lchip] = _dal_mpool_create(base, DAL_MPOOL_MAX_DESX_SIZE, DAL_MPOOL_TYPE_DESC);
if (NULL == p_desc_pool[lchip])
{
MPOOL_UNLOCK();
DAL_FREE(head->next);
@ -108,14 +110,14 @@ dal_mpool_create(void* base, int size)
}
/* init for data linkptr */
p_data_pool = _dal_mpool_create(((char*)base+DAL_MPOOL_MAX_DESX_SIZE), (size - DAL_MPOOL_MAX_DESX_SIZE), DAL_MPOOL_TYPE_DATA);
if (NULL == p_data_pool)
p_data_pool[lchip] = _dal_mpool_create(((char*)base+DAL_MPOOL_MAX_DESX_SIZE), (size - DAL_MPOOL_MAX_DESX_SIZE), DAL_MPOOL_TYPE_DATA);
if (NULL == p_data_pool[lchip])
{
MPOOL_UNLOCK();
DAL_FREE(head->next);
DAL_FREE(head);
DAL_FREE(p_desc_pool->next);
DAL_FREE(p_desc_pool);
DAL_FREE(p_desc_pool[lchip]->next);
DAL_FREE(p_desc_pool[lchip]);
return NULL;
}
@ -160,7 +162,7 @@ _dal_mpool_alloc_comon(dal_mpool_mem_t* ptr, int size, int type)
}
void*
dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
dal_mpool_alloc(unsigned char lchip, dal_mpool_mem_t* pool, int size, int type)
{
dal_mpool_mem_t* ptr = NULL;
dal_mpool_mem_t* new_ptr = NULL;
@ -186,7 +188,7 @@ dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
}
break;
case DAL_MPOOL_TYPE_DESC:
ptr = p_desc_pool;
ptr = p_desc_pool[lchip];
new_ptr = _dal_mpool_alloc_comon(ptr, size, type);
if (NULL == new_ptr)
{
@ -195,7 +197,7 @@ dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
}
break;
case DAL_MPOOL_TYPE_DATA:
ptr = p_data_pool;
ptr = p_data_pool[lchip];
new_ptr = _dal_mpool_alloc_comon(ptr, size, type);
if (NULL == new_ptr)
{
@ -210,6 +212,10 @@ dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type)
}
MPOOL_UNLOCK();
if( NULL == new_ptr )
{
return NULL;
}
return new_ptr->address;
}
@ -242,7 +248,7 @@ _dal_mpool_free(dal_mpool_mem_t* ptr, void* addr, int type)
}
void
dal_mpool_free(dal_mpool_mem_t* pool, void* addr)
dal_mpool_free(unsigned char lchip, dal_mpool_mem_t* pool, void* addr)
{
dal_mpool_mem_t* ptr = pool;
@ -255,11 +261,11 @@ dal_mpool_free(dal_mpool_mem_t* pool, void* addr)
_dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_USELESS);
break;
case DAL_MPOOL_TYPE_DESC:
ptr = p_desc_pool;
ptr = p_desc_pool[lchip];
_dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DESC);
break;
case DAL_MPOOL_TYPE_DATA:
ptr = p_data_pool;
ptr = p_data_pool[lchip];
_dal_mpool_free(ptr, addr, DAL_MPOOL_TYPE_DATA);
break;
default:
@ -271,7 +277,7 @@ dal_mpool_free(dal_mpool_mem_t* pool, void* addr)
}
int
dal_mpool_destroy(dal_mpool_mem_t* pool)
dal_mpool_destroy(unsigned char lchip, dal_mpool_mem_t* pool)
{
dal_mpool_mem_t* ptr, * next;
@ -283,13 +289,13 @@ dal_mpool_destroy(dal_mpool_mem_t* pool)
DAL_FREE(ptr);
}
for (ptr = p_desc_pool; ptr; ptr = next)
for (ptr = p_desc_pool[lchip]; ptr; ptr = next)
{
next = ptr->next;
DAL_FREE(ptr);
}
for (ptr = p_data_pool; ptr; ptr = next)
for (ptr = p_data_pool[lchip]; ptr; ptr = next)
{
next = ptr->next;
DAL_FREE(ptr);
@ -341,3 +347,4 @@ dal_mpool_debug(dal_mpool_mem_t* pool)
return 0;
}

View File

@ -47,16 +47,16 @@ extern int
dal_mpool_init(void);
extern dal_mpool_mem_t*
dal_mpool_create(void* base_ptr, int size);
dal_mpool_create(unsigned char lchip, void* base_ptr, int size);
extern void*
dal_mpool_alloc(dal_mpool_mem_t* pool, int size, int type);
dal_mpool_alloc(unsigned char lchip, dal_mpool_mem_t* pool, int size, int type);
extern void
dal_mpool_free(dal_mpool_mem_t* pool, void* addr);
dal_mpool_free(unsigned char lchip, dal_mpool_mem_t* pool, void* addr);
extern int
dal_mpool_destroy(dal_mpool_mem_t* pool);
dal_mpool_destroy(unsigned char lchip, dal_mpool_mem_t* pool);
extern int
dal_mpool_usage(dal_mpool_mem_t* pool, int type);
@ -69,3 +69,4 @@ dal_mpool_debug(dal_mpool_mem_t* pool);
#endif /* !_DMA_MPOOL_H */

View File

@ -0,0 +1,13 @@
[Unit]
Description=Centec e582 48x6q platform modules
After=local-fs.target
Before=pmon.service
[Service]
Type=oneshot
ExecStart=-/etc/init.d/platform-modules-e582-48x6q start
ExecStop=-/etc/init.d/platform-modules-e582-48x6q stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -2,10 +2,10 @@ sonic-centec-platform-modules (1.1) unstable; urgency=low
* Add support for centec e582-48x2q4z
-- xuwj <xuwj@centecnetworks.com> Thus, 25 Jan 2018 13:43:40 +0800
-- yangbs <yangbs@centecnetworks.com> Thu, 25 Jan 2018 13:43:40 +0800
sonic-centec-platform-modules (1.0) unstable; urgency=low
* Initial release
-- xuwj <xuwj@centecnetworks.com> Mon, 22 Jan 2018 13:43:40 +0800
-- yangbs <yangbs@centecnetworks.com> Mon, 22 Jan 2018 13:43:40 +0800

View File

@ -7,11 +7,11 @@ Standards-Version: 3.9.3
Package: platform-modules-e582-48x2q4z
Architecture: amd64
Depends: linux-image-3.16.0-5-amd64
Depends: linux-image-4.9.0-7-amd64
Description: kernel modules for platform devices such as fan, led, sfp
Package: platform-modules-e582-48x6q
Architecture: amd64
Depends: linux-image-3.16.0-5-amd64
Depends: linux-image-4.9.0-7-amd64
Description: kernel modules for platform devices such as fan, led, sfp

View File

@ -1,2 +1,6 @@
48x2q4z/cfg/48x2q4z-modules.conf etc/modules-load.d
48x2q4z/cfg/config_db.json etc/sonic
48x2q4z/cfg/config_db_l2l3.json etc/sonic
48x2q4z/scripts/48x2q4z_platform.sh usr/bin
48x2q4z/scripts/48x2q4z_platform_monitor.py usr/bin
48x2q4z/service/48x2q4z_platform.service lib/systemd/system

View File

@ -0,0 +1,3 @@
depmod -a
systemctl enable 48x2q4z_platform.service
systemctl start 48x2q4z_platform.service

View File

@ -1,6 +1,6 @@
48x6q/cfg/48x6q-modules.conf etc/modules-load.d
48x6q/cfg/minigraph.xml etc/sonic
48x6q/cfg/config_db.json etc/sonic
48x6q/cfg/config_db_l2l3.json etc/sonic
48x6q/scripts/48x6q_platform.sh usr/bin
48x6q/scripts/48x6q_platform_monitor.py usr/bin
48x6q/service/48x6q_platform.service lib/systemd/system

View File

@ -0,0 +1,3 @@
depmod -a
systemctl enable 48x6q_platform.service
systemctl start 48x6q_platform.service