* [dpdk-dev] [PATCH v1] net/axgbe: add debug logs
@ 2020-02-11 8:19 cnamburu
2020-02-16 6:49 ` Kumar, Ravi1
0 siblings, 1 reply; 3+ messages in thread
From: cnamburu @ 2020-02-11 8:19 UTC (permalink / raw)
To: dev; +Cc: Ravi1.Kumar, Amaranath.Somalapuram
From: Chandu Babu N <chandu@amd.com>
Add debug logs in various modules in axgbe
Signed-off-by: Chandu Babu N <chandu@amd.com>
---
drivers/net/axgbe/axgbe_dev.c | 17 ++++++++--
drivers/net/axgbe/axgbe_ethdev.c | 2 ++
drivers/net/axgbe/axgbe_i2c.c | 10 ++++++
drivers/net/axgbe/axgbe_mdio.c | 51 +++++++++++++++++++++++++++++-
drivers/net/axgbe/axgbe_phy_impl.c | 43 ++++++++++++++++++++++++-
5 files changed, 119 insertions(+), 4 deletions(-)
diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c
index 83089f20d..2e796c0b3 100644
--- a/drivers/net/axgbe/axgbe_dev.c
+++ b/drivers/net/axgbe/axgbe_dev.c
@@ -260,6 +260,9 @@ static int axgbe_enable_tx_flow_control(struct axgbe_port *pdata)
ehfc = 1;
AXGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, ehfc);
+
+ PMD_DRV_LOG(DEBUG, "flow control %s for RXq%u\n",
+ ehfc ? "enabled" : "disabled", i);
}
/* Set MAC flow control */
@@ -915,6 +918,9 @@ static void axgbe_config_rx_fifo_size(struct axgbe_port *pdata)
/*Calculate and config Flow control threshold*/
axgbe_calculate_flow_control_threshold(pdata);
axgbe_config_flow_control_threshold(pdata);
+
+ PMD_DRV_LOG(DEBUG, "%d Rx hardware queues, %d byte fifo per queue\n",
+ pdata->rx_q_count, q_fifo_size);
}
static void axgbe_config_tx_fifo_size(struct axgbe_port *pdata)
@@ -938,6 +944,9 @@ static void axgbe_config_tx_fifo_size(struct axgbe_port *pdata)
for (i = 0; i < pdata->tx_q_count; i++)
AXGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_TQOMR, TQS, p_fifo);
+
+ PMD_DRV_LOG(DEBUG, "%d Tx hardware queues, %d byte fifo per queue\n",
+ pdata->tx_q_count, q_fifo_size);
}
static void axgbe_config_queue_mapping(struct axgbe_port *pdata)
@@ -952,12 +961,16 @@ static void axgbe_config_queue_mapping(struct axgbe_port *pdata)
qptc_extra = pdata->tx_q_count % pdata->hw_feat.tc_cnt;
for (i = 0, queue = 0; i < pdata->hw_feat.tc_cnt; i++) {
- for (j = 0; j < qptc; j++)
+ for (j = 0; j < qptc; j++) {
+ PMD_DRV_LOG(DEBUG, "TXq%u mapped to TC%u\n", queue, i);
AXGMAC_MTL_IOWRITE_BITS(pdata, queue, MTL_Q_TQOMR,
Q2TCMAP, i);
- if (i < qptc_extra)
+ }
+ if (i < qptc_extra) {
+ PMD_DRV_LOG(DEBUG, "TXq%u mapped to TC%u\n", queue, i);
AXGMAC_MTL_IOWRITE_BITS(pdata, queue, MTL_Q_TQOMR,
Q2TCMAP, i);
+ }
}
if (pdata->rss_enable) {
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index d0b6f091f..7445c544d 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -201,12 +201,14 @@ axgbe_dev_interrupt_handler(void *param)
pdata->phy_if.an_isr(pdata);
/*DMA related interrupts*/
dma_isr = AXGMAC_IOREAD(pdata, DMA_ISR);
+ PMD_DRV_LOG(DEBUG, "DMA_ISR=%#010x\n", dma_isr);
if (dma_isr) {
if (dma_isr & 1) {
dma_ch_isr =
AXGMAC_DMA_IOREAD((struct axgbe_rx_queue *)
pdata->rx_queues[0],
DMA_CH_SR);
+ PMD_DRV_LOG(DEBUG, "DMA_CH0_ISR=%#010x\n", dma_ch_isr);
AXGMAC_DMA_IOWRITE((struct axgbe_rx_queue *)
pdata->rx_queues[0],
DMA_CH_SR, dma_ch_isr);
diff --git a/drivers/net/axgbe/axgbe_i2c.c b/drivers/net/axgbe/axgbe_i2c.c
index 204ec3679..ab3738a12 100644
--- a/drivers/net/axgbe/axgbe_i2c.c
+++ b/drivers/net/axgbe/axgbe_i2c.c
@@ -162,9 +162,15 @@ static int axgbe_i2c_isr(struct axgbe_port *pdata)
isr = XI2C_IOREAD(pdata, IC_RAW_INTR_STAT);
+ PMD_DRV_LOG(DEBUG, "I2C interrupt received: status=%#010x\n", isr);
+
axgbe_i2c_clear_isr_interrupts(pdata, isr);
if (isr & AXGBE_INTR_TX_ABRT) {
+ PMD_DRV_LOG(DEBUG,
+ "I2C TX_ABRT received (%#010x) for target %#04x\n",
+ state->tx_abort_source, state->op->target);
+
axgbe_i2c_disable_interrupts(pdata);
state->ret = -EIO;
@@ -285,6 +291,8 @@ static void axgbe_i2c_stop(struct axgbe_port *pdata)
if (!pdata->i2c.started)
return;
+ PMD_DRV_LOG(DEBUG, "stopping I2C\n");
+
pdata->i2c.started = 0;
axgbe_i2c_disable_interrupts(pdata);
axgbe_i2c_disable(pdata);
@@ -296,6 +304,8 @@ static int axgbe_i2c_start(struct axgbe_port *pdata)
if (pdata->i2c.started)
return 0;
+ PMD_DRV_LOG(DEBUG, "starting I2C\n");
+
pdata->i2c.started = 1;
return 0;
diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.c
index 4b280b72d..0f226c3f2 100644
--- a/drivers/net/axgbe/axgbe_mdio.c
+++ b/drivers/net/axgbe/axgbe_mdio.c
@@ -300,6 +300,8 @@ static void axgbe_an73_restart(struct axgbe_port *pdata)
{
axgbe_an73_enable_interrupts(pdata);
axgbe_an73_set(pdata, true, true);
+
+ PMD_DRV_LOG(DEBUG, "CL73 AN enabled/restarted\n");
}
static void axgbe_an73_disable(struct axgbe_port *pdata)
@@ -307,6 +309,8 @@ static void axgbe_an73_disable(struct axgbe_port *pdata)
axgbe_an73_set(pdata, false, false);
axgbe_an73_disable_interrupts(pdata);
pdata->an_start = 0;
+
+ PMD_DRV_LOG(DEBUG, "CL73 AN disabled\n");
}
static void axgbe_an_restart(struct axgbe_port *pdata)
@@ -384,6 +388,8 @@ static enum axgbe_an axgbe_an73_tx_training(struct axgbe_port *pdata,
XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL,
reg);
+ PMD_DRV_LOG(DEBUG, "KR training initiated\n");
+
if (pdata->phy_if.phy_impl.kr_training_post)
pdata->phy_if.phy_impl.kr_training_post(pdata);
}
@@ -466,6 +472,9 @@ static enum axgbe_an axgbe_an73_page_received(struct axgbe_port *pdata)
pdata->kx_state = AXGBE_RX_BPA;
pdata->an_start = rte_get_timer_cycles();
+
+ PMD_DRV_LOG(NOTICE,
+ "CL73 AN timed out, resetting state\n");
}
}
@@ -515,6 +524,26 @@ static enum axgbe_an axgbe_an73_incompat_link(struct axgbe_port *pdata)
return AXGBE_AN_INCOMPAT_LINK;
}
+static const char *axgbe_state_as_string(enum axgbe_an state)
+{
+ switch (state) {
+ case AXGBE_AN_READY:
+ return "Ready";
+ case AXGBE_AN_PAGE_RECEIVED:
+ return "Page-Received";
+ case AXGBE_AN_INCOMPAT_LINK:
+ return "Incompatible-Link";
+ case AXGBE_AN_COMPLETE:
+ return "Complete";
+ case AXGBE_AN_NO_LINK:
+ return "No-Link";
+ case AXGBE_AN_ERROR:
+ return "Error";
+ default:
+ return "Undefined";
+ }
+}
+
static void axgbe_an73_state_machine(struct axgbe_port *pdata)
{
enum axgbe_an cur_state = pdata->an_state;
@@ -536,6 +565,9 @@ static void axgbe_an73_state_machine(struct axgbe_port *pdata)
pdata->an_state = AXGBE_AN_ERROR;
}
+ PMD_DRV_LOG(DEBUG, "CL73 AN : %s\n",
+ axgbe_state_as_string(pdata->an_state));
+
again:
cur_state = pdata->an_state;
@@ -581,6 +613,9 @@ static void axgbe_an73_state_machine(struct axgbe_port *pdata)
pdata->an_start = 0;
if (pdata->phy_if.phy_impl.an_post)
pdata->phy_if.phy_impl.an_post(pdata);
+
+ PMD_DRV_LOG(DEBUG, "CL73 AN result: %s\n",
+ axgbe_state_as_string(pdata->an_result));
}
if (cur_state != pdata->an_state)
@@ -685,6 +720,8 @@ static void axgbe_an37_isr(struct axgbe_port *pdata)
static void axgbe_an_isr(struct axgbe_port *pdata)
{
+ PMD_DRV_LOG(DEBUG, "AN interrupt received\n");
+
switch (pdata->an_mode) {
case AXGBE_AN_MODE_CL73:
case AXGBE_AN_MODE_CL73_REDRV:
@@ -792,6 +829,8 @@ static void axgbe_an73_init(struct axgbe_port *pdata)
reg &= ~AXGBE_XNP_NP_EXCHANGE;
XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg);
+
+ PMD_DRV_LOG(DEBUG, "CL73 AN initialized\n");
}
static void axgbe_an_init(struct axgbe_port *pdata)
@@ -843,6 +882,8 @@ static int axgbe_phy_config_fixed(struct axgbe_port *pdata)
{
enum axgbe_mode mode;
+ PMD_DRV_LOG(DEBUG, "fixed PHY configuration\n");
+
/* Disable auto-negotiation */
axgbe_an_disable(pdata);
@@ -886,6 +927,9 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata)
ret = axgbe_phy_config_fixed(pdata);
if (ret || !pdata->kr_redrv)
return ret;
+ PMD_DRV_LOG(DEBUG, "AN redriver support\n");
+ } else {
+ PMD_DRV_LOG(DEBUG, "AN PHY configuration\n");
}
/* Disable auto-negotiation interrupt */
@@ -959,8 +1003,10 @@ static void axgbe_check_link_timeout(struct axgbe_port *pdata)
link_timeout = pdata->link_check + (AXGBE_LINK_TIMEOUT *
2 * rte_get_timer_hz());
ticks = rte_get_timer_cycles();
- if (time_after(ticks, link_timeout))
+ if (time_after(ticks, link_timeout)) {
+ PMD_DRV_LOG(NOTICE, "AN link timeout\n");
axgbe_phy_config_aneg(pdata);
+ }
}
static enum axgbe_mode axgbe_phy_status_aneg(struct axgbe_port *pdata)
@@ -1088,6 +1134,7 @@ static void axgbe_phy_status(struct axgbe_port *pdata)
static void axgbe_phy_stop(struct axgbe_port *pdata)
{
+ PMD_DRV_LOG(DEBUG, "stopping PHY\n");
if (!pdata->phy_started)
return;
/* Indicate the PHY is down */
@@ -1103,6 +1150,8 @@ static int axgbe_phy_start(struct axgbe_port *pdata)
{
int ret;
+ PMD_DRV_LOG(DEBUG, "starting PHY\n");
+
ret = pdata->phy_if.phy_impl.start(pdata);
if (ret)
return ret;
diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c
index a324a2bc9..02236ec19 100644
--- a/drivers/net/axgbe/axgbe_phy_impl.c
+++ b/drivers/net/axgbe/axgbe_phy_impl.c
@@ -790,6 +790,32 @@ static void axgbe_phy_sfp_reset(struct axgbe_phy_data *phy_data)
phy_data->sfp_speed = AXGBE_SFP_SPEED_UNKNOWN;
}
+static const char *axgbe_base_as_string(enum axgbe_sfp_base sfp_base)
+{
+ switch (sfp_base) {
+ case AXGBE_SFP_BASE_1000_T:
+ return "1G_T";
+ case AXGBE_SFP_BASE_1000_SX:
+ return "1G_SX";
+ case AXGBE_SFP_BASE_1000_LX:
+ return "1G_LX";
+ case AXGBE_SFP_BASE_1000_CX:
+ return "1G_CX";
+ case AXGBE_SFP_BASE_10000_SR:
+ return "10G_SR";
+ case AXGBE_SFP_BASE_10000_LR:
+ return "10G_LR";
+ case AXGBE_SFP_BASE_10000_LRM:
+ return "10G_LRM";
+ case AXGBE_SFP_BASE_10000_ER:
+ return "10G_ER";
+ case AXGBE_SFP_BASE_10000_CR:
+ return "10G_CR";
+ default:
+ return "Unknown";
+ }
+}
+
static void axgbe_phy_sfp_detect(struct axgbe_port *pdata)
{
struct axgbe_phy_data *phy_data = pdata->phy_data;
@@ -820,6 +846,9 @@ static void axgbe_phy_sfp_detect(struct axgbe_port *pdata)
axgbe_phy_sfp_parse_eeprom(pdata);
axgbe_phy_sfp_external_phy(pdata);
+ PMD_DRV_LOG(DEBUG, "SFP Base: %s\n",
+ axgbe_base_as_string(phy_data->sfp_base));
+
put:
axgbe_phy_sfp_phy_settings(pdata);
axgbe_phy_put_comm_ownership(pdata);
@@ -1169,7 +1198,10 @@ static void axgbe_phy_set_redrv_mode(struct axgbe_port *pdata)
static void axgbe_phy_start_ratechange(struct axgbe_port *pdata)
{
- if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
+ /* Log if a previous command did not complete */
+ if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
+ PMD_DRV_LOG(NOTICE, "firmware mailbox not ready for command\n");
+ else
return;
}
@@ -1185,6 +1217,7 @@ static void axgbe_phy_complete_ratechange(struct axgbe_port *pdata)
rte_delay_us(1500);
}
+ PMD_DRV_LOG(NOTICE, "firmware mailbox command did not complete\n");
}
static void axgbe_phy_rrc(struct axgbe_port *pdata)
@@ -1204,6 +1237,8 @@ static void axgbe_phy_rrc(struct axgbe_port *pdata)
XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
axgbe_phy_complete_ratechange(pdata);
+
+ PMD_DRV_LOG(DEBUG, "receiver reset complete\n");
}
static void axgbe_phy_power_off(struct axgbe_port *pdata)
@@ -1218,6 +1253,8 @@ static void axgbe_phy_power_off(struct axgbe_port *pdata)
XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
axgbe_phy_complete_ratechange(pdata);
phy_data->cur_mode = AXGBE_MODE_UNKNOWN;
+
+ PMD_DRV_LOG(DEBUG, "phy powered off\n");
}
static void axgbe_phy_sfi_mode(struct axgbe_port *pdata)
@@ -1249,6 +1286,8 @@ static void axgbe_phy_sfi_mode(struct axgbe_port *pdata)
XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
axgbe_phy_complete_ratechange(pdata);
phy_data->cur_mode = AXGBE_MODE_SFI;
+
+ PMD_DRV_LOG(DEBUG, "10GbE SFI mode set\n");
}
static void axgbe_phy_kr_mode(struct axgbe_port *pdata)
@@ -1271,6 +1310,8 @@ static void axgbe_phy_kr_mode(struct axgbe_port *pdata)
XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
axgbe_phy_complete_ratechange(pdata);
phy_data->cur_mode = AXGBE_MODE_KR;
+
+ PMD_DRV_LOG(DEBUG, "10GbE KR mode set\n");
}
static void axgbe_phy_kx_2500_mode(struct axgbe_port *pdata)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add debug logs
2020-02-11 8:19 [dpdk-dev] [PATCH v1] net/axgbe: add debug logs cnamburu
@ 2020-02-16 6:49 ` Kumar, Ravi1
2020-02-27 9:18 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Kumar, Ravi1 @ 2020-02-16 6:49 UTC (permalink / raw)
To: Namburu, Chandu-babu, dev; +Cc: Somalapuram, Amaranath
[AMD Official Use Only - Internal Distribution Only]
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
>
>
>-----Original Message-----
>From: Namburu, Chandu-babu <chandu@amd.com>
>Sent: Tuesday, February 11, 2020 1:50 PM
>To: dev@dpdk.org
>Cc: Kumar, Ravi1 <Ravi1.Kumar@amd.com>; Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
>Subject: [PATCH v1] net/axgbe: add debug logs
>
>From: Chandu Babu N <chandu@amd.com>
>
>Add debug logs in various modules in axgbe
>
>Signed-off-by: Chandu Babu N <chandu@amd.com>
>---
> drivers/net/axgbe/axgbe_dev.c | 17 ++++++++--
> drivers/net/axgbe/axgbe_ethdev.c | 2 ++
> drivers/net/axgbe/axgbe_i2c.c | 10 ++++++
> drivers/net/axgbe/axgbe_mdio.c | 51 +++++++++++++++++++++++++++++-
> drivers/net/axgbe/axgbe_phy_impl.c | 43 ++++++++++++++++++++++++-
> 5 files changed, 119 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c index 83089f20d..2e796c0b3 100644
>--- a/drivers/net/axgbe/axgbe_dev.c
>+++ b/drivers/net/axgbe/axgbe_dev.c
>@@ -260,6 +260,9 @@ static int axgbe_enable_tx_flow_control(struct axgbe_port *pdata)
> ehfc = 1;
>
> AXGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, ehfc);
>+
>+ PMD_DRV_LOG(DEBUG, "flow control %s for RXq%u\n",
>+ ehfc ? "enabled" : "disabled", i);
> }
>
> /* Set MAC flow control */
>@@ -915,6 +918,9 @@ static void axgbe_config_rx_fifo_size(struct axgbe_port *pdata)
> /*Calculate and config Flow control threshold*/
> axgbe_calculate_flow_control_threshold(pdata);
> axgbe_config_flow_control_threshold(pdata);
>+
>+ PMD_DRV_LOG(DEBUG, "%d Rx hardware queues, %d byte fifo per queue\n",
>+ pdata->rx_q_count, q_fifo_size);
> }
>
> static void axgbe_config_tx_fifo_size(struct axgbe_port *pdata) @@ -938,6 +944,9 @@ static void axgbe_config_tx_fifo_size(struct axgbe_port *pdata)
>
> for (i = 0; i < pdata->tx_q_count; i++)
> AXGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_TQOMR, TQS, p_fifo);
>+
>+ PMD_DRV_LOG(DEBUG, "%d Tx hardware queues, %d byte fifo per queue\n",
>+ pdata->tx_q_count, q_fifo_size);
> }
>
> static void axgbe_config_queue_mapping(struct axgbe_port *pdata) @@ -952,12 +961,16 @@ static void axgbe_config_queue_mapping(struct axgbe_port *pdata)
> qptc_extra = pdata->tx_q_count % pdata->hw_feat.tc_cnt;
>
> for (i = 0, queue = 0; i < pdata->hw_feat.tc_cnt; i++) {
>- for (j = 0; j < qptc; j++)
>+ for (j = 0; j < qptc; j++) {
>+ PMD_DRV_LOG(DEBUG, "TXq%u mapped to TC%u\n", queue, i);
> AXGMAC_MTL_IOWRITE_BITS(pdata, queue, MTL_Q_TQOMR,
> Q2TCMAP, i);
>- if (i < qptc_extra)
>+ }
>+ if (i < qptc_extra) {
>+ PMD_DRV_LOG(DEBUG, "TXq%u mapped to TC%u\n", queue, i);
> AXGMAC_MTL_IOWRITE_BITS(pdata, queue, MTL_Q_TQOMR,
> Q2TCMAP, i);
>+ }
> }
>
> if (pdata->rss_enable) {
>diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
>index d0b6f091f..7445c544d 100644
>--- a/drivers/net/axgbe/axgbe_ethdev.c
>+++ b/drivers/net/axgbe/axgbe_ethdev.c
>@@ -201,12 +201,14 @@ axgbe_dev_interrupt_handler(void *param)
> pdata->phy_if.an_isr(pdata);
> /*DMA related interrupts*/
> dma_isr = AXGMAC_IOREAD(pdata, DMA_ISR);
>+ PMD_DRV_LOG(DEBUG, "DMA_ISR=%#010x\n", dma_isr);
> if (dma_isr) {
> if (dma_isr & 1) {
> dma_ch_isr =
> AXGMAC_DMA_IOREAD((struct axgbe_rx_queue *)
> pdata->rx_queues[0],
> DMA_CH_SR);
>+ PMD_DRV_LOG(DEBUG, "DMA_CH0_ISR=%#010x\n", dma_ch_isr);
> AXGMAC_DMA_IOWRITE((struct axgbe_rx_queue *)
> pdata->rx_queues[0],
> DMA_CH_SR, dma_ch_isr);
>diff --git a/drivers/net/axgbe/axgbe_i2c.c b/drivers/net/axgbe/axgbe_i2c.c index 204ec3679..ab3738a12 100644
>--- a/drivers/net/axgbe/axgbe_i2c.c
>+++ b/drivers/net/axgbe/axgbe_i2c.c
>@@ -162,9 +162,15 @@ static int axgbe_i2c_isr(struct axgbe_port *pdata)
>
> isr = XI2C_IOREAD(pdata, IC_RAW_INTR_STAT);
>
>+ PMD_DRV_LOG(DEBUG, "I2C interrupt received: status=%#010x\n", isr);
>+
> axgbe_i2c_clear_isr_interrupts(pdata, isr);
>
> if (isr & AXGBE_INTR_TX_ABRT) {
>+ PMD_DRV_LOG(DEBUG,
>+ "I2C TX_ABRT received (%#010x) for target %#04x\n",
>+ state->tx_abort_source, state->op->target);
>+
> axgbe_i2c_disable_interrupts(pdata);
>
> state->ret = -EIO;
>@@ -285,6 +291,8 @@ static void axgbe_i2c_stop(struct axgbe_port *pdata)
> if (!pdata->i2c.started)
> return;
>
>+ PMD_DRV_LOG(DEBUG, "stopping I2C\n");
>+
> pdata->i2c.started = 0;
> axgbe_i2c_disable_interrupts(pdata);
> axgbe_i2c_disable(pdata);
>@@ -296,6 +304,8 @@ static int axgbe_i2c_start(struct axgbe_port *pdata)
> if (pdata->i2c.started)
> return 0;
>
>+ PMD_DRV_LOG(DEBUG, "starting I2C\n");
>+
> pdata->i2c.started = 1;
>
> return 0;
>diff --git a/drivers/net/axgbe/axgbe_mdio.c b/drivers/net/axgbe/axgbe_mdio.c index 4b280b72d..0f226c3f2 100644
>--- a/drivers/net/axgbe/axgbe_mdio.c
>+++ b/drivers/net/axgbe/axgbe_mdio.c
>@@ -300,6 +300,8 @@ static void axgbe_an73_restart(struct axgbe_port *pdata) {
> axgbe_an73_enable_interrupts(pdata);
> axgbe_an73_set(pdata, true, true);
>+
>+ PMD_DRV_LOG(DEBUG, "CL73 AN enabled/restarted\n");
> }
>
> static void axgbe_an73_disable(struct axgbe_port *pdata) @@ -307,6 +309,8 @@ static void axgbe_an73_disable(struct axgbe_port *pdata)
> axgbe_an73_set(pdata, false, false);
> axgbe_an73_disable_interrupts(pdata);
> pdata->an_start = 0;
>+
>+ PMD_DRV_LOG(DEBUG, "CL73 AN disabled\n");
> }
>
> static void axgbe_an_restart(struct axgbe_port *pdata) @@ -384,6 +388,8 @@ static enum axgbe_an axgbe_an73_tx_training(struct axgbe_port *pdata,
> XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL,
> reg);
>
>+ PMD_DRV_LOG(DEBUG, "KR training initiated\n");
>+
> if (pdata->phy_if.phy_impl.kr_training_post)
> pdata->phy_if.phy_impl.kr_training_post(pdata);
> }
>@@ -466,6 +472,9 @@ static enum axgbe_an axgbe_an73_page_received(struct axgbe_port *pdata)
> pdata->kx_state = AXGBE_RX_BPA;
>
> pdata->an_start = rte_get_timer_cycles();
>+
>+ PMD_DRV_LOG(NOTICE,
>+ "CL73 AN timed out, resetting state\n");
> }
> }
>
>@@ -515,6 +524,26 @@ static enum axgbe_an axgbe_an73_incompat_link(struct axgbe_port *pdata)
> return AXGBE_AN_INCOMPAT_LINK;
> }
>
>+static const char *axgbe_state_as_string(enum axgbe_an state) {
>+ switch (state) {
>+ case AXGBE_AN_READY:
>+ return "Ready";
>+ case AXGBE_AN_PAGE_RECEIVED:
>+ return "Page-Received";
>+ case AXGBE_AN_INCOMPAT_LINK:
>+ return "Incompatible-Link";
>+ case AXGBE_AN_COMPLETE:
>+ return "Complete";
>+ case AXGBE_AN_NO_LINK:
>+ return "No-Link";
>+ case AXGBE_AN_ERROR:
>+ return "Error";
>+ default:
>+ return "Undefined";
>+ }
>+}
>+
> static void axgbe_an73_state_machine(struct axgbe_port *pdata) {
> enum axgbe_an cur_state = pdata->an_state; @@ -536,6 +565,9 @@ static void axgbe_an73_state_machine(struct axgbe_port *pdata)
> pdata->an_state = AXGBE_AN_ERROR;
> }
>
>+ PMD_DRV_LOG(DEBUG, "CL73 AN : %s\n",
>+ axgbe_state_as_string(pdata->an_state));
>+
> again:
> cur_state = pdata->an_state;
>
>@@ -581,6 +613,9 @@ static void axgbe_an73_state_machine(struct axgbe_port *pdata)
> pdata->an_start = 0;
> if (pdata->phy_if.phy_impl.an_post)
> pdata->phy_if.phy_impl.an_post(pdata);
>+
>+ PMD_DRV_LOG(DEBUG, "CL73 AN result: %s\n",
>+ axgbe_state_as_string(pdata->an_result));
> }
>
> if (cur_state != pdata->an_state)
>@@ -685,6 +720,8 @@ static void axgbe_an37_isr(struct axgbe_port *pdata)
>
> static void axgbe_an_isr(struct axgbe_port *pdata) {
>+ PMD_DRV_LOG(DEBUG, "AN interrupt received\n");
>+
> switch (pdata->an_mode) {
> case AXGBE_AN_MODE_CL73:
> case AXGBE_AN_MODE_CL73_REDRV:
>@@ -792,6 +829,8 @@ static void axgbe_an73_init(struct axgbe_port *pdata)
> reg &= ~AXGBE_XNP_NP_EXCHANGE;
>
> XMDIO_WRITE(pdata, MDIO_MMD_AN, MDIO_AN_ADVERTISE, reg);
>+
>+ PMD_DRV_LOG(DEBUG, "CL73 AN initialized\n");
> }
>
> static void axgbe_an_init(struct axgbe_port *pdata) @@ -843,6 +882,8 @@ static int axgbe_phy_config_fixed(struct axgbe_port *pdata) {
> enum axgbe_mode mode;
>
>+ PMD_DRV_LOG(DEBUG, "fixed PHY configuration\n");
>+
> /* Disable auto-negotiation */
> axgbe_an_disable(pdata);
>
>@@ -886,6 +927,9 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata)
> ret = axgbe_phy_config_fixed(pdata);
> if (ret || !pdata->kr_redrv)
> return ret;
>+ PMD_DRV_LOG(DEBUG, "AN redriver support\n");
>+ } else {
>+ PMD_DRV_LOG(DEBUG, "AN PHY configuration\n");
> }
>
> /* Disable auto-negotiation interrupt */ @@ -959,8 +1003,10 @@ static void axgbe_check_link_timeout(struct axgbe_port *pdata)
> link_timeout = pdata->link_check + (AXGBE_LINK_TIMEOUT *
> 2 * rte_get_timer_hz());
> ticks = rte_get_timer_cycles();
>- if (time_after(ticks, link_timeout))
>+ if (time_after(ticks, link_timeout)) {
>+ PMD_DRV_LOG(NOTICE, "AN link timeout\n");
> axgbe_phy_config_aneg(pdata);
>+ }
> }
>
> static enum axgbe_mode axgbe_phy_status_aneg(struct axgbe_port *pdata) @@ -1088,6 +1134,7 @@ static void axgbe_phy_status(struct axgbe_port *pdata)
>
> static void axgbe_phy_stop(struct axgbe_port *pdata) {
>+ PMD_DRV_LOG(DEBUG, "stopping PHY\n");
> if (!pdata->phy_started)
> return;
> /* Indicate the PHY is down */
>@@ -1103,6 +1150,8 @@ static int axgbe_phy_start(struct axgbe_port *pdata) {
> int ret;
>
>+ PMD_DRV_LOG(DEBUG, "starting PHY\n");
>+
> ret = pdata->phy_if.phy_impl.start(pdata);
> if (ret)
> return ret;
>diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c
>index a324a2bc9..02236ec19 100644
>--- a/drivers/net/axgbe/axgbe_phy_impl.c
>+++ b/drivers/net/axgbe/axgbe_phy_impl.c
>@@ -790,6 +790,32 @@ static void axgbe_phy_sfp_reset(struct axgbe_phy_data *phy_data)
> phy_data->sfp_speed = AXGBE_SFP_SPEED_UNKNOWN; }
>
>+static const char *axgbe_base_as_string(enum axgbe_sfp_base sfp_base) {
>+ switch (sfp_base) {
>+ case AXGBE_SFP_BASE_1000_T:
>+ return "1G_T";
>+ case AXGBE_SFP_BASE_1000_SX:
>+ return "1G_SX";
>+ case AXGBE_SFP_BASE_1000_LX:
>+ return "1G_LX";
>+ case AXGBE_SFP_BASE_1000_CX:
>+ return "1G_CX";
>+ case AXGBE_SFP_BASE_10000_SR:
>+ return "10G_SR";
>+ case AXGBE_SFP_BASE_10000_LR:
>+ return "10G_LR";
>+ case AXGBE_SFP_BASE_10000_LRM:
>+ return "10G_LRM";
>+ case AXGBE_SFP_BASE_10000_ER:
>+ return "10G_ER";
>+ case AXGBE_SFP_BASE_10000_CR:
>+ return "10G_CR";
>+ default:
>+ return "Unknown";
>+ }
>+}
>+
> static void axgbe_phy_sfp_detect(struct axgbe_port *pdata) {
> struct axgbe_phy_data *phy_data = pdata->phy_data; @@ -820,6 +846,9 @@ static void axgbe_phy_sfp_detect(struct axgbe_port *pdata)
> axgbe_phy_sfp_parse_eeprom(pdata);
> axgbe_phy_sfp_external_phy(pdata);
>
>+ PMD_DRV_LOG(DEBUG, "SFP Base: %s\n",
>+ axgbe_base_as_string(phy_data->sfp_base));
>+
> put:
> axgbe_phy_sfp_phy_settings(pdata);
> axgbe_phy_put_comm_ownership(pdata);
>@@ -1169,7 +1198,10 @@ static void axgbe_phy_set_redrv_mode(struct axgbe_port *pdata)
>
> static void axgbe_phy_start_ratechange(struct axgbe_port *pdata) {
>- if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
>+ /* Log if a previous command did not complete */
>+ if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
>+ PMD_DRV_LOG(NOTICE, "firmware mailbox not ready for command\n");
>+ else
> return;
> }
>
>@@ -1185,6 +1217,7 @@ static void axgbe_phy_complete_ratechange(struct axgbe_port *pdata)
>
> rte_delay_us(1500);
> }
>+ PMD_DRV_LOG(NOTICE, "firmware mailbox command did not complete\n");
> }
>
> static void axgbe_phy_rrc(struct axgbe_port *pdata) @@ -1204,6 +1237,8 @@ static void axgbe_phy_rrc(struct axgbe_port *pdata)
> XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
>
> axgbe_phy_complete_ratechange(pdata);
>+
>+ PMD_DRV_LOG(DEBUG, "receiver reset complete\n");
> }
>
> static void axgbe_phy_power_off(struct axgbe_port *pdata) @@ -1218,6 +1253,8 @@ static void axgbe_phy_power_off(struct axgbe_port *pdata)
> XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
> axgbe_phy_complete_ratechange(pdata);
> phy_data->cur_mode = AXGBE_MODE_UNKNOWN;
>+
>+ PMD_DRV_LOG(DEBUG, "phy powered off\n");
> }
>
> static void axgbe_phy_sfi_mode(struct axgbe_port *pdata) @@ -1249,6 +1286,8 @@ static void axgbe_phy_sfi_mode(struct axgbe_port *pdata)
> XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
> axgbe_phy_complete_ratechange(pdata);
> phy_data->cur_mode = AXGBE_MODE_SFI;
>+
>+ PMD_DRV_LOG(DEBUG, "10GbE SFI mode set\n");
> }
>
> static void axgbe_phy_kr_mode(struct axgbe_port *pdata) @@ -1271,6 +1310,8 @@ static void axgbe_phy_kr_mode(struct axgbe_port *pdata)
> XP_IOWRITE_BITS(pdata, XP_DRIVER_INT_REQ, REQUEST, 1);
> axgbe_phy_complete_ratechange(pdata);
> phy_data->cur_mode = AXGBE_MODE_KR;
>+
>+ PMD_DRV_LOG(DEBUG, "10GbE KR mode set\n");
> }
>
> static void axgbe_phy_kx_2500_mode(struct axgbe_port *pdata)
>--
>2.17.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] net/axgbe: add debug logs
2020-02-16 6:49 ` Kumar, Ravi1
@ 2020-02-27 9:18 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2020-02-27 9:18 UTC (permalink / raw)
To: Kumar, Ravi1, Namburu, Chandu-babu, dev; +Cc: Somalapuram, Amaranath
On 2/16/2020 6:49 AM, Kumar, Ravi1 wrote:
<...>
>> -----Original Message-----
>> From: Namburu, Chandu-babu <chandu@amd.com>
>> Sent: Tuesday, February 11, 2020 1:50 PM
>> To: dev@dpdk.org
>> Cc: Kumar, Ravi1 <Ravi1.Kumar@amd.com>; Somalapuram, Amaranath <Amaranath.Somalapuram@amd.com>
>> Subject: [PATCH v1] net/axgbe: add debug logs
>>
>> From: Chandu Babu N <chandu@amd.com>
>>
>> Add debug logs in various modules in axgbe
>>
>> Signed-off-by: Chandu Babu N <chandu@amd.com>
>
> Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-02-27 9:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-11 8:19 [dpdk-dev] [PATCH v1] net/axgbe: add debug logs cnamburu
2020-02-16 6:49 ` Kumar, Ravi1
2020-02-27 9:18 ` Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).