Patchwork [net-next-2.6,1/9] vxge: Modify __vxge_hw_device_is_privilaged() to not assume function-0 as privilaged function.

login
register
mail settings
Submitter Sreenivasa Honnur
Date Oct. 5, 2009, 9:06 a.m.
Message ID <Pine.GSO.4.10.10910050503530.2346-100000@guinness>
Download mbox | patch
Permalink /patch/34957/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Sreenivasa Honnur - Oct. 5, 2009, 9:06 a.m.
- vxge driver was assuming function-0 is always the privilaged function. Now that
  restriction has been removed any function can act as a privilaged function.

- This patch modifies the __vxge_hw_device_is_privilaged routine to not assume
  function-0 as the privileged function.

Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
---

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sreenivasa Honnur - Oct. 5, 2009, 9:40 a.m.
I could apply these patches with "patch -p1 patch_file" command.

-----Original Message-----
From: David Miller [mailto:davem@davemloft.net] 
Sent: Monday, October 05, 2009 2:50 PM
To: Sreenivasa Honnur
Cc: netdev@vger.kernel.org; support
Subject: Re: [net-next-2.6 PATCH 1/9] vxge: Modify
__vxge_hw_device_is_privilaged() to not assume function-0 as privilaged
function.

From: Sreenivasa Honnur <Sreenivasa.Honnur@neterion.com>
Date: Mon, 5 Oct 2009 05:06:06 -0400 (EDT)

> - vxge driver was assuming function-0 is always the privilaged
function. Now that
>   restriction has been removed any function can act as a privilaged
function.
> 
> - This patch modifies the __vxge_hw_device_is_privilaged routine to
not assume
>   function-0 as the privileged function.
> 
> Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
> ---
> diff -urpN orig//drivers/net/vxge/vxge-config.c
patch1//drivers/net/vxge/vxge-config.c
> --- orig//drivers/net/vxge/vxge-config.c	2009-09-03
22:39:48.000000000 -0700
> +++ patch1//drivers/net/vxge/vxge-config.c	2009-09-03
23:11:24.000000000 -0700

You can't have the double slash there in your paths, this gets
interpreted as "/drivers/net/vxge/vxge-config.c" by all the patch
applying tools.

Please "-p1" root your patches properly as described in
linux/Documentation/SubmittingPatches

You'll need to resubmit your entire patch set with this fixed up.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sreenivasa Honnur - Oct. 5, 2009, 9:43 a.m.
I could apply these patches with "patch -p1 < patch_file" command.

i.e /usr/src/davem-net-2.6 # patch -p1 < patch_2-0-6-1


-----Original Message-----
From: Sreenivasa Honnur 
Sent: Monday, October 05, 2009 3:10 PM
To: David Miller
Cc: netdev@vger.kernel.org; support
Subject: RE: [net-next-2.6 PATCH 1/9] vxge: Modify
__vxge_hw_device_is_privilaged() to not assume function-0 as privilaged
function.

I could apply these patches with "patch -p1 patch_file" command.

-----Original Message-----
From: David Miller [mailto:davem@davemloft.net]
Sent: Monday, October 05, 2009 2:50 PM
To: Sreenivasa Honnur
Cc: netdev@vger.kernel.org; support
Subject: Re: [net-next-2.6 PATCH 1/9] vxge: Modify
__vxge_hw_device_is_privilaged() to not assume function-0 as privilaged
function.

From: Sreenivasa Honnur <Sreenivasa.Honnur@neterion.com>
Date: Mon, 5 Oct 2009 05:06:06 -0400 (EDT)

> - vxge driver was assuming function-0 is always the privilaged
function. Now that
>   restriction has been removed any function can act as a privilaged
function.
> 
> - This patch modifies the __vxge_hw_device_is_privilaged routine to
not assume
>   function-0 as the privileged function.
> 
> Signed-off-by: Sreenivasa Honnur <sreenivasa.honnur@neterion.com>
> ---
> diff -urpN orig//drivers/net/vxge/vxge-config.c
patch1//drivers/net/vxge/vxge-config.c
> --- orig//drivers/net/vxge/vxge-config.c	2009-09-03
22:39:48.000000000 -0700
> +++ patch1//drivers/net/vxge/vxge-config.c	2009-09-03
23:11:24.000000000 -0700

You can't have the double slash there in your paths, this gets
interpreted as "/drivers/net/vxge/vxge-config.c" by all the patch
applying tools.

Please "-p1" root your patches properly as described in
linux/Documentation/SubmittingPatches

You'll need to resubmit your entire patch set with this fixed up.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Oct. 5, 2009, 9:48 a.m.
From: "Sreenivasa Honnur" <Sreenivasa.Honnur@neterion.com>
Date: Mon, 5 Oct 2009 05:40:18 -0400

> I could apply these patches with "patch -p1 patch_file" command.

davem@sunset:~/src/GIT/net-next-2.6$ git am --signoff x.mbox
Applying: vxge: Modify __vxge_hw_device_is_privilaged() to not assume function-0 as privilaged function.
error: /drivers/net/vxge/vxge-config.c: does not exist in index
error: patch failed: drivers/net/vxge/vxge-config.c:461
error: drivers/net/vxge/vxge-config.c: patch does not apply
error: /drivers/net/vxge/vxge-version.h: does not exist in index
Patch failed at 0001 vxge: Modify __vxge_hw_device_is_privilaged() to not assume function-0 as privilaged function.

GIT is more strict than patch in many ways (not just in respect
to paths).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sreenivasa Honnur - Oct. 5, 2009, 10:07 a.m.
OK, I will re-create and submit them again. 

-----Original Message-----
From: David Miller [mailto:davem@davemloft.net] 
Sent: Monday, October 05, 2009 3:19 PM
To: Sreenivasa Honnur
Cc: netdev@vger.kernel.org; support
Subject: Re: [net-next-2.6 PATCH 1/9] vxge: Modify
__vxge_hw_device_is_privilaged() to not assume function-0 as privilaged
function.

From: "Sreenivasa Honnur" <Sreenivasa.Honnur@neterion.com>
Date: Mon, 5 Oct 2009 05:40:18 -0400

> I could apply these patches with "patch -p1 patch_file" command.

davem@sunset:~/src/GIT/net-next-2.6$ git am --signoff x.mbox
Applying: vxge: Modify __vxge_hw_device_is_privilaged() to not assume
function-0 as privilaged function.
error: /drivers/net/vxge/vxge-config.c: does not exist in index
error: patch failed: drivers/net/vxge/vxge-config.c:461
error: drivers/net/vxge/vxge-config.c: patch does not apply
error: /drivers/net/vxge/vxge-version.h: does not exist in index Patch
failed at 0001 vxge: Modify __vxge_hw_device_is_privilaged() to not
assume function-0 as privilaged function.

GIT is more strict than patch in many ways (not just in respect to
paths).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -urpN orig//drivers/net/vxge/vxge-config.c patch1//drivers/net/vxge/vxge-config.c
--- orig//drivers/net/vxge/vxge-config.c	2009-09-03 22:39:48.000000000 -0700
+++ patch1//drivers/net/vxge/vxge-config.c	2009-09-03 23:11:24.000000000 -0700
@@ -356,10 +356,8 @@  __vxge_hw_device_access_rights_get(u32 h
 
 	switch (host_type) {
 	case VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION:
-		if (func_id == 0) {
-			access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM |
-					VXGE_HW_DEVICE_ACCESS_RIGHT_SRPCIM;
-		}
+		access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM |
+				VXGE_HW_DEVICE_ACCESS_RIGHT_SRPCIM;
 		break;
 	case VXGE_HW_MR_NO_SR_VH0_BASE_FUNCTION:
 		access_rights |= VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM |
@@ -382,6 +380,22 @@  __vxge_hw_device_access_rights_get(u32 h
 	return access_rights;
 }
 /*
+ * __vxge_hw_device_is_privilaged
+ * This routine checks if the device function is privilaged or not
+ */
+
+enum vxge_hw_status
+__vxge_hw_device_is_privilaged(u32 host_type, u32 func_id)
+{
+	if (__vxge_hw_device_access_rights_get(host_type,
+		func_id) &
+		VXGE_HW_DEVICE_ACCESS_RIGHT_MRPCIM)
+		return VXGE_HW_OK;
+	else
+		return VXGE_HW_ERR_PRIVILAGED_OPEARATION;
+}
+
+/*
  * __vxge_hw_device_host_info_get
  * This routine returns the host type assignments
  */
@@ -446,18 +460,6 @@  __vxge_hw_verify_pci_e_info(struct __vxg
 	return VXGE_HW_OK;
 }
 
-enum vxge_hw_status
-__vxge_hw_device_is_privilaged(struct __vxge_hw_device *hldev)
-{
-	if ((hldev->host_type == VXGE_HW_NO_MR_NO_SR_NORMAL_FUNCTION ||
-	hldev->host_type == VXGE_HW_MR_NO_SR_VH0_BASE_FUNCTION ||
-	hldev->host_type == VXGE_HW_NO_MR_SR_VH0_FUNCTION0) &&
-	(hldev->func_id == 0))
-		return VXGE_HW_OK;
-	else
-		return VXGE_HW_ERR_PRIVILAGED_OPEARATION;
-}
-
 /*
  * vxge_hw_wrr_rebalance - Rebalance the RX_WRR and KDFC_WRR calandars.
  * Rebalance the RX_WRR and KDFC_WRR calandars.
@@ -470,7 +472,8 @@  vxge_hw_status vxge_hw_wrr_rebalance(str
 	u32 i, j, how_often = 1;
 	enum vxge_hw_status status = VXGE_HW_OK;
 
-	status = __vxge_hw_device_is_privilaged(hldev);
+	status = __vxge_hw_device_is_privilaged(hldev->host_type,
+			hldev->func_id);
 	if (status != VXGE_HW_OK)
 		goto exit;
 
@@ -668,7 +671,8 @@  enum vxge_hw_status __vxge_hw_device_ini
 {
 	enum vxge_hw_status status = VXGE_HW_OK;
 
-	if (VXGE_HW_OK == __vxge_hw_device_is_privilaged(hldev)) {
+	if (VXGE_HW_OK == __vxge_hw_device_is_privilaged(hldev->host_type,
+				hldev->func_id)) {
 		/* Validate the pci-e link width and speed */
 		status = __vxge_hw_verify_pci_e_info(hldev);
 		if (status != VXGE_HW_OK)
@@ -953,7 +957,8 @@  vxge_hw_mrpcim_stats_access(struct __vxg
 	u64 val64;
 	enum vxge_hw_status status = VXGE_HW_OK;
 
-	status = __vxge_hw_device_is_privilaged(hldev);
+	status = __vxge_hw_device_is_privilaged(hldev->host_type,
+			hldev->func_id);
 	if (status != VXGE_HW_OK)
 		goto exit;
 
@@ -990,7 +995,8 @@  vxge_hw_device_xmac_aggr_stats_get(struc
 
 	val64 = (u64 *)aggr_stats;
 
-	status = __vxge_hw_device_is_privilaged(hldev);
+	status = __vxge_hw_device_is_privilaged(hldev->host_type,
+			hldev->func_id);
 	if (status != VXGE_HW_OK)
 		goto exit;
 
@@ -1023,7 +1029,8 @@  vxge_hw_device_xmac_port_stats_get(struc
 	u32 offset = 0x0;
 	val64 = (u64 *) port_stats;
 
-	status = __vxge_hw_device_is_privilaged(hldev);
+	status = __vxge_hw_device_is_privilaged(hldev->host_type,
+			hldev->func_id);
 	if (status != VXGE_HW_OK)
 		goto exit;
 
@@ -1221,7 +1228,8 @@  enum vxge_hw_status vxge_hw_device_setpa
 		goto exit;
 	}
 
-	status = __vxge_hw_device_is_privilaged(hldev);
+	status = __vxge_hw_device_is_privilaged(hldev->host_type,
+			hldev->func_id);
 	if (status != VXGE_HW_OK)
 		goto exit;