lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1407348973-2433-5-git-send-email-zoltan.kiss@citrix.com>
Date:	Wed, 6 Aug 2014 19:16:13 +0100
From:	Zoltan Kiss <zoltan.kiss@...rix.com>
To:	Wei Liu <wei.liu2@...rix.com>,
	Ian Campbell <Ian.Campbell@...rix.com>
CC:	Zoltan Kiss <zoltan.kiss@...rix.com>,
	David Vrabel <david.vrabel@...rix.com>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<xen-devel@...ts.xenproject.org>
Subject: [PATCH] xen-netback: Change disable flag from bool to a bit

Signed-off-by: Zoltan Kiss <zoltan.kiss@...rix.com>
Signed-off-by: David Vrabel <david.vrabel@...rix.com>
Cc: netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Cc: xen-devel@...ts.xenproject.org 

diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 5cb139a..f126920 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -106,7 +106,11 @@ enum vif_state_bit_shift {
 	/* This bit signals to the RX thread that queuing was stopped
 	 * (in start_xmit), and either the timer fired or an RX interrupt came
 	 */
-	VIF_STATUS_RX_PURGE_EVENT
+	VIF_STATUS_RX_PURGE_EVENT,
+	/* Is this interface disabled? True when backend discovers
+	 * frontend is rogue.
+	 */
+	VIF_STATUS_DISABLED
 };
 
 struct xenvif {
@@ -114,10 +118,6 @@ struct xenvif {
 	domid_t          domid;
 	unsigned int     handle;
 
-	/* Is this interface disabled? True when backend discovers
-	 * frontend is rogue.
-	 */
-	bool disabled;
 	unsigned long status;
 
 	/* Use NAPI for guest TX */
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index e396d86..92e397c 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -70,7 +70,7 @@ static int xenvif_poll(struct napi_struct *napi, int budget)
 	 * We also turn off NAPI if the receive queue is stalled and the carrier
 	 * is turned off.
 	 */
-	if (unlikely(vif->disabled ||
+	if (unlikely(test_bit(VIF_STATUS_DISABLED, &vif->status) ||
 		     !netif_carrier_ok(vif->dev))) {
 		napi_complete(napi);
 		return 0;
@@ -352,8 +352,6 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	vif->ip_csum = 1;
 	vif->dev = dev;
 
-	vif->disabled = false;
-
 	vif->credit_bytes = vif->remaining_credit = ~0UL;
 	vif->credit_usec  = 0UL;
 	init_timer(&vif->credit_timeout);
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 0737597..8b75b41 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -787,7 +787,7 @@ static void xenvif_tx_err(struct xenvif *vif,
 static void xenvif_fatal_tx_err(struct xenvif *vif)
 {
 	netdev_err(vif->dev, "fatal error; disabling device\n");
-	vif->disabled = true;
+	set_bit(VIF_STATUS_DISABLED, &vif->status);
 	xenvif_kick_thread(vif);
 }
 
@@ -1936,7 +1936,7 @@ int xenvif_kthread_guest_rx(void *data)
 	while (!kthread_should_stop()) {
 		wait_event_interruptible(vif->wq,
 					 rx_work_todo(vif) ||
-					 vif->disabled ||
+					 test_bit(VIF_STATUS_DISABLED, &vif->status) ||
 					 test_bit(VIF_STATUS_RX_PURGE_EVENT, &vif->status) ||
 					 kthread_should_stop());
 
@@ -1946,7 +1946,7 @@ int xenvif_kthread_guest_rx(void *data)
 		 * but we cannot disable the interface in softirq
 		 * context so we defer it here.
 		 */
-		if (unlikely(vif->disabled))
+		if (unlikely(test_and_clear_bit(VIF_STATUS_DISABLED, &vif->status)))
 			xenvif_carrier_off(vif);
 		else if (unlikely(test_and_clear_bit(VIF_STATUS_RX_PURGE_EVENT,
 						     &vif->status))) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ