The SFPI layer should not implement transmitter disable for QSFP modules as part of the TX_DISABLE control.

The transmitter disable bytes are standardized by the MSA and managed by the upper layer using the dev_writeb() routines when
appropriate based on module type.

Writing the transmitter enable bytes are not appropriate for CR cables and will generate write errors so attempting to
emulate this behavior without knowing the type of module is also troublesome.
This commit is contained in:
Jeffrey Townsend
2018-08-17 23:15:16 +00:00
parent 398084e525
commit f29aa9086b

View File

@@ -52,7 +52,7 @@ int sfp_map_bus[] ={21, 22, 23, 24, 26, 25, 28, 27,
* SFPI Entry Points
*
***********************************************************/
int
onlp_sfpi_init(void)
{
@@ -92,18 +92,18 @@ onlp_sfpi_is_present(int port)
*/
int present;
int bus, addr;
if(port <0 || port > 34)
return ONLP_STATUS_E_INTERNAL;
addr = 60;
bus = 11;
if (onlp_file_read_int(&present, MODULE_PRESENT_FORMAT, bus, addr, (port+1)) < 0) {
AIM_LOG_ERROR("Unable to read present status from port(%d)\r\n", port);
return ONLP_STATUS_E_INTERNAL;
}
return present;
}
@@ -116,8 +116,8 @@ onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
int bus=11;
char file[64] = {0};
int count;
ptr = bytes;
ptr = bytes;
sprintf(file, MODULE_PRESENT_ALL_ATTR, bus, addr);
fp = fopen(file, "r");
if(fp == NULL) {
@@ -132,7 +132,7 @@ onlp_sfpi_presence_bitmap_get(onlp_sfp_bitmap_t* dst)
AIM_LOG_ERROR("Unable to read all fields the module_present_all device file of CPLD3.");
return ONLP_STATUS_E_INTERNAL;
}
/* Convert to 64 bit integer in port order */
uint64_t presence_all = 0 ;
int i = 0;
@@ -158,7 +158,7 @@ onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst)
FILE* fp;
int addr=60, i = 0;
fp = fopen(MODULE_RXLOS_ALL_ATTR_CPLD, "r");
if(fp == NULL) {
AIM_LOG_ERROR("Unable to open the module_rx_los_all device file of CPLD(0x%d)", addr);
@@ -181,7 +181,7 @@ onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst)
}
/* Populate bitmap */
for(i = 0; rx_los_all; i++) {
for(i = 0; rx_los_all; i++) {
AIM_BITMAP_MOD(dst, i, (rx_los_all & 1));
rx_los_all >>= 1;
}
@@ -221,7 +221,7 @@ onlp_sfpi_dom_read(int port, uint8_t data[256])
{
FILE* fp;
char file[64] = {0};
sprintf(file, PORT_EEPROM_FORMAT, onlp_sfpi_map_bus_index(port));
fp = fopen(file, "r");
if(fp == NULL) {
@@ -279,17 +279,13 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
int rv;
int addr = 60;
int bus = 11;
if(port <0 || port > 34)
return ONLP_STATUS_E_INTERNAL;
switch(control)
{
case ONLP_SFP_CONTROL_TX_DISABLE:
{
if(port==32 || port==33)
{
if (onlp_file_write_int(0, MODULE_TXDISABLE_FORMAT, bus, addr, (port+1)) < 0) {
if(port==32 || port==33) {
if (onlp_file_write_int(0, MODULE_TXDISABLE_FORMAT, bus, addr, (port+1)) < 0) {
AIM_LOG_ERROR("Unable to set tx_disable status to port(%d)\r\n", port);
rv = ONLP_STATUS_E_INTERNAL;
}
@@ -297,21 +293,9 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
rv = ONLP_STATUS_OK;
}
}
else if(port >=0)
{
if(!onlp_sfpi_is_present(port))
return ONLP_STATUS_OK;
rv=onlp_sfpi_dev_writeb(port, 0x50, 86, 1);
if(rv < 0)
{
AIM_LOG_ERROR("Fail to read onlp_sfpi_dev_writeb, port=%d\r\n", port);
rv = ONLP_STATUS_E_INTERNAL;
}
else
{
rv = ONLP_STATUS_OK;
}
}
else {
rv = ONLP_STATUS_E_UNSUPPORTED;
}
break;
}
@@ -329,16 +313,12 @@ onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
int rv;
int addr = 60;
int bus = 11;
if(port <0 || port > 34)
return ONLP_STATUS_E_INTERNAL;
switch(control)
{
case ONLP_SFP_CONTROL_RX_LOS:
{
if(port==32 || port==33)
{
if(port==32 || port==33) {
if (onlp_file_read_int(value, MODULE_RXLOS_FORMAT, bus, addr, (port+1)) < 0) {
AIM_LOG_ERROR("Unable to read rx_loss status from port(%d)\r\n", port);
rv = ONLP_STATUS_E_INTERNAL;
@@ -347,16 +327,15 @@ onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
rv = ONLP_STATUS_OK;
}
}
else
return ONLP_STATUS_E_UNSUPPORTED;
else {
rv = ONLP_STATUS_E_UNSUPPORTED;
}
break;
}
case ONLP_SFP_CONTROL_TX_FAULT:
{
if(port==32 || port==33)
{
if(port==32 || port==33) {
if (onlp_file_read_int(value, MODULE_TXFAULT_FORMAT, bus, addr, (port+1)) < 0) {
AIM_LOG_ERROR("Unable to read tx_fault status from port(%d)\r\n", port);
rv = ONLP_STATUS_E_INTERNAL;
@@ -365,15 +344,15 @@ onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
rv = ONLP_STATUS_OK;
}
}
else
return ONLP_STATUS_E_UNSUPPORTED;
else {
rv = ONLP_STATUS_E_UNSUPPORTED;
}
break;
}
case ONLP_SFP_CONTROL_TX_DISABLE:
{
if(port==32 || port==33)
{
if(port==32 || port==33) {
if (onlp_file_read_int(value, MODULE_TXDISABLE_FORMAT, bus, addr, (port+1)) < 0) {
AIM_LOG_ERROR("Unable to read tx_disabled status from port(%d)\r\n", port);
rv = ONLP_STATUS_E_INTERNAL;
@@ -382,27 +361,8 @@ onlp_sfpi_control_get(int port, onlp_sfp_control_t control, int* value)
rv = ONLP_STATUS_OK;
}
}
else
{
if(port >= 0)
{
if(!onlp_sfpi_is_present(port))
{
*value=0;
return ONLP_STATUS_OK;
}
rv=onlp_sfpi_dev_readb(port, 0x50, 86);
if(rv < 0)
{
AIM_LOG_ERROR("Unable to read tx_disabled status from port(%d)\r\n", port);
rv = ONLP_STATUS_E_INTERNAL;
}
else
{
*value= (rv & 0x1);
rv = ONLP_STATUS_OK;
}
}
else {
rv = ONLP_STATUS_E_UNSUPPORTED;
}
break;
}
@@ -419,4 +379,3 @@ onlp_sfpi_denit(void)
{
return ONLP_STATUS_OK;
}