Hi, Jan,

After some investigation, I found the root cause of the issue: the carrier 
is not
changed to be on if we open virtual NIC in inmate firstly, attached patch 
can
fix this issue, please help to review, by the way where I can upstream this 
patch?
Thanks.

Best Regards,
Jiafei.

在2020年11月18日星期三 UTC+8 下午6:01:51<[email protected]> 写道:

> On 18.11.20 10:50, Peter pan wrote: 
> > Hi, Jan, 
> > 
> > I have one new issue and not sure it is a know issue. 
> > 
> > The issue is: when I ifconfig up ivshmem-net NIC in root cell firstly 
> > and then ifconfig up ivshmem NIC in inmate cell (runing Linux),  I can 
> > ping through between two NICs, but if I ifconfig up NIC in inmate cell 
> > before ifconfig up the NIC in root cell, I can't ping through between 
> > two NICs, and I found NIC in inmate can only receive packet sending from 
> > root cell NIC, but NIC in root cell can't receive any packet and there 
> > is also no irq received for ivshmem NIC. 
> > 
>
> The link states of both virtual NICs are up (ethtool)? Is there any 
> ivshmem-net interrupt received at all on the root side? There should be 
> a few during setup at least. 
>
> Check that the interrupt line on the root side is really free, and also 
> that GICD is properly intercepted by Jailhouse (check mappings). 
>
> Jan 
>
> -- 
> Siemens AG, T RDA IOT 
> Corporate Competence Center Embedded Linux 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/581e32ac-d032-4108-b4fe-21286e6b2085n%40googlegroups.com.
>From 828eecf2c696410a30bfd7c5c7a0d384c4bec7c5 Mon Sep 17 00:00:00 2001
From: Jiafei Pan <[email protected]>
Date: Thu, 19 Nov 2020 15:34:47 +0800
Subject: [PATCH] ivshmem-net: set carrier on if device has been opened

When virtual NIC is opened in inmate firstly, and then
open virtual NIC in root cell, virtual NIC in inmate
can't transmit packets out. The roor cause of this
issue is although state has been changed to be RUN
in process of "open", but carrier need to set to be on
after state of peer is changed to be RUN, otherwise
network stack will not transmit packet to virtual NIC.

Signed-off-by: Jiafei Pan <[email protected]>
---
 drivers/net/ivshmem-net.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ivshmem-net.c b/drivers/net/ivshmem-net.c
index 18d5a15dbec2..8aab21b3febe 100644
--- a/drivers/net/ivshmem-net.c
+++ b/drivers/net/ivshmem-net.c
@@ -623,6 +623,12 @@ static void ivshm_net_state_change(struct work_struct *work)
 			netif_carrier_off(ndev);
 			ivshm_net_do_stop(ndev);
 		}
+		/* In case of it has been already opened, so state is RUN,
+		 * set Carrier on when remote goes to RUN.
+		 */
+		if (peer_state == IVSHM_NET_STATE_RUN)
+			netif_carrier_on(ndev);
+
 		break;
 	}
 
-- 
2.17.1

Reply via email to