patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 2/5] net/ena: fix dev init for RTE_PROC_SECONDARY
       [not found] <1548403828-31870-1-git-send-email-mk@semihalf.com>
@ 2019-01-25  8:10 ` Michal Krawczyk
  2019-01-25  8:10 ` [dpdk-stable] [PATCH 3/5] net/ena: fix setting rte_errno to negative value Michal Krawczyk
  1 sibling, 0 replies; 2+ messages in thread
From: Michal Krawczyk @ 2019-01-25  8:10 UTC (permalink / raw)
  To: gtzalik, mw, matua; +Cc: rk, dev, Michal Krawczyk, stable

The check for proc type in eth_ena_dev_init() should appear before
modyfing adapter structure.

Calling memset on ena_adapter from secondary process context, was
erasing all structure information, and it was causing the crash of the
main process.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index fde5fa7..747390b 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -1715,19 +1715,20 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev)
 	static int adapters_found;
 	bool wd_state;
 
-	memset(adapter, 0, sizeof(struct ena_adapter));
-	ena_dev = &adapter->ena_dev;
-
 	eth_dev->dev_ops = &ena_dev_ops;
 	eth_dev->rx_pkt_burst = &eth_ena_recv_pkts;
 	eth_dev->tx_pkt_burst = &eth_ena_xmit_pkts;
 	eth_dev->tx_pkt_prepare = &eth_ena_prep_pkts;
-	adapter->rte_eth_dev_data = eth_dev->data;
-	adapter->rte_dev = eth_dev;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	memset(adapter, 0, sizeof(struct ena_adapter));
+	ena_dev = &adapter->ena_dev;
+
+	adapter->rte_eth_dev_data = eth_dev->data;
+	adapter->rte_dev = eth_dev;
+
 	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 	adapter->pdev = pci_dev;
 
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [dpdk-stable] [PATCH 3/5] net/ena: fix setting rte_errno to negative value
       [not found] <1548403828-31870-1-git-send-email-mk@semihalf.com>
  2019-01-25  8:10 ` [dpdk-stable] [PATCH 2/5] net/ena: fix dev init for RTE_PROC_SECONDARY Michal Krawczyk
@ 2019-01-25  8:10 ` Michal Krawczyk
  1 sibling, 0 replies; 2+ messages in thread
From: Michal Krawczyk @ 2019-01-25  8:10 UTC (permalink / raw)
  To: gtzalik, mw, matua; +Cc: rk, dev, Michal Krawczyk, stable

The rte_errno shouldn't have assigned negative error codes, so it has
to be fixed.

Fixes: b3fc5a1ae10d ("net/ena: add Tx preparation")
Cc: stable@dpdk.org

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
---
 drivers/net/ena/ena_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index 747390b..8bb05ca 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -2178,14 +2178,14 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		if ((ol_flags & ENA_TX_OFFLOAD_NOTSUP_MASK) != 0 ||
 				(ol_flags & PKT_TX_L4_MASK) ==
 				PKT_TX_SCTP_CKSUM) {
-			rte_errno = -ENOTSUP;
+			rte_errno = ENOTSUP;
 			return i;
 		}
 
 #ifdef RTE_LIBRTE_ETHDEV_DEBUG
 		ret = rte_validate_tx_offload(m);
 		if (ret != 0) {
-			rte_errno = ret;
+			rte_errno = -ret;
 			return i;
 		}
 #endif
@@ -2198,7 +2198,7 @@ eth_ena_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		ret = rte_net_intel_cksum_flags_prepare(m,
 			ol_flags & ~PKT_TX_TCP_SEG);
 		if (ret != 0) {
-			rte_errno = ret;
+			rte_errno = -ret;
 			return i;
 		}
 	}
-- 
2.7.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-25  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1548403828-31870-1-git-send-email-mk@semihalf.com>
2019-01-25  8:10 ` [dpdk-stable] [PATCH 2/5] net/ena: fix dev init for RTE_PROC_SECONDARY Michal Krawczyk
2019-01-25  8:10 ` [dpdk-stable] [PATCH 3/5] net/ena: fix setting rte_errno to negative value Michal Krawczyk

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).