Commit ceca38bc authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Adam Wujek

userspace/libwr: change SFP delay_[tr]x to be signed

delta_tx and delta_rx in the SFP information are differences from
the values in the "calibration" SFP model. Thus they are signed
not uint32_t.  Fortunately nobody used negative values so far.

I also renamed the fields, to ensure the compiler would find all uses.

The commit also syncs headers to ppsi, including the changes that
happened here but were irrelevant to there.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 4607adc6
......@@ -52,9 +52,9 @@ int hal_port_get_exported_state(struct hexp_port_state *state,
state->rx_calibrated = p->calib.rx_calibrated;
state->delta_tx = p->calib.delta_tx_phy
+ p->calib.sfp.delta_tx + p->calib.delta_tx_board;
+ p->calib.sfp.delta_tx_ps + p->calib.delta_tx_board;
state->delta_rx = p->calib.delta_rx_phy
+ p->calib.sfp.delta_rx + p->calib.delta_rx_board;
+ p->calib.sfp.delta_rx_ps + p->calib.delta_rx_board;
state->t2_phase_transition = DEFAULT_T2_PHASE_TRANS;
state->t4_phase_transition = DEFAULT_T4_PHASE_TRANS;
......
......@@ -578,13 +578,13 @@ int shw_sfp_read_db(void)
LIBWR_INT, &val, index);
if (error)
__err_msg(index, "tx", NULL);
sfp->delta_tx = val;
sfp->delta_tx_ps = val;
val = 0;
error = libwr_cfg_convert2("SFP%02i_PARAMS", "rx",
LIBWR_INT, &val, index);
if (error)
__err_msg(index, "rx", NULL);
sfp->delta_rx = val;
sfp->delta_rx_ps = val;
/* We also store the wavelength, used to get alpha */
error = libwr_cfg_convert2("SFP%02i_PARAMS", "wl_txrx",
......
......@@ -92,7 +92,7 @@ struct hal_port_state {
};
/* This is the overall structure stored in shared memory */
#define HAL_SHMEM_VERSION 2 /* Version 2 because sfp calib changed */
#define HAL_SHMEM_VERSION 3 /* Version 3 because sfp delta is signed */
struct hal_shmem_header {
int nports;
struct hal_port_state *ports;
......
......@@ -32,8 +32,8 @@ struct shw_sfp_caldata {
char vendor_serial[16];
/* Callibration data */
double alpha;
uint32_t delta_tx;
uint32_t delta_rx;
int delta_tx_ps; /* "delta" of this SFP type WRT calibration type */
int delta_rx_ps;
/* wavelengths, used to get alpha from fiber type */
int tx_wl;
int rx_wl;
......
ppsi @ d724bd8f
Subproject commit 4dbc6b0b71e1b5376e157f1e79a83842a8e1fe3e
Subproject commit d724bd8f100aa227d5aa01ccace3ed023b140a8b
......@@ -205,8 +205,8 @@ struct dump_info hal_port_info [] = {
DUMP_FIELD_SIZE(char, calib.sfp.part_num, 16),
DUMP_FIELD_SIZE(char, calib.sfp.vendor_serial, 16),
DUMP_FIELD(double, calib.sfp.alpha),
DUMP_FIELD(uint32_t, calib.sfp.delta_tx),
DUMP_FIELD(uint32_t, calib.sfp.delta_rx),
DUMP_FIELD(int, calib.sfp.delta_tx_ps),
DUMP_FIELD(int, calib.sfp.delta_rx_ps),
DUMP_FIELD(int, calib.sfp.tx_wl),
DUMP_FIELD(int, calib.sfp.rx_wl),
DUMP_FIELD(pointer, calib.sfp.next),
......
......@@ -453,7 +453,7 @@ static void hal_port_insert_sfp(struct hal_port_state * p)
"delta Rx %d alpha %.3f (* 1e6)",
cdata->flags & SFP_FLAG_CLASS_DATA
? "class-specific" : "device-specific",
cdata->delta_tx, cdata->delta_rx,
cdata->delta_tx_ps, cdata->delta_rx_ps,
cdata->alpha * 1e6);
memcpy(&p->calib.sfp, cdata,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment