LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 2/7] cxgb3 - private ioctl cleanup
@ 2007-02-22 11:59 divy
  2007-02-22 12:06 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 7+ messages in thread
From: divy @ 2007-02-22 11:59 UTC (permalink / raw)
  To: jeff; +Cc: netdev, linux-kernel, swise

From: Divy Le Ray <divy@chelsio.com>

Clean up some private ioctls.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
---

 drivers/net/cxgb3/cxgb3_ioctl.h |   21 ++++-------------
 drivers/net/cxgb3/cxgb3_main.c  |   48 +++------------------------------------
 2 files changed, 9 insertions(+), 60 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_ioctl.h b/drivers/net/cxgb3/cxgb3_ioctl.h
index a942818..42d4bf6 100644
--- a/drivers/net/cxgb3/cxgb3_ioctl.h
+++ b/drivers/net/cxgb3/cxgb3_ioctl.h
@@ -36,28 +36,17 @@
  * Ioctl commands specific to this driver.
  */
 enum {
-	CHELSIO_SETREG = 1024,
-	CHELSIO_GETREG,
-	CHELSIO_SETTPI,
-	CHELSIO_GETTPI,
-	CHELSIO_GETMTUTAB,
+	CHELSIO_GETMTUTAB = 1024,
 	CHELSIO_SETMTUTAB,
-	CHELSIO_GETMTU,
-	CHELSIO_SET_PM,
-	CHELSIO_GET_PM,
-	CHELSIO_GET_TCAM,
-	CHELSIO_SET_TCAM,
-	CHELSIO_GET_TCB,
 	CHELSIO_GET_MEM,
 	CHELSIO_LOAD_FW,
-	CHELSIO_GET_PROTO,
-	CHELSIO_SET_PROTO,
 	CHELSIO_SET_TRACE_FILTER,
-	CHELSIO_SET_QSET_PARAMS,
 	CHELSIO_GET_QSET_PARAMS,
-	CHELSIO_SET_QSET_NUM,
+	CHELSIO_SET_QSET_PARAMS,
 	CHELSIO_GET_QSET_NUM,
-	CHELSIO_SET_PKTSCHED,
+	CHELSIO_SET_QSET_NUM,
+	CHELSIO_GET_PM,
+	CHELSIO_SET_PM,
 };
 
 struct ch_reg {
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 59f2b51..7ff834e 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1552,32 +1552,6 @@ static int cxgb_extension_ioctl(struct n
 		return -EFAULT;
 
 	switch (cmd) {
-	case CHELSIO_SETREG:{
-		struct ch_reg edata;
-
-		if (!capable(CAP_NET_ADMIN))
-			return -EPERM;
-		if (copy_from_user(&edata, useraddr, sizeof(edata)))
-			return -EFAULT;
-		if ((edata.addr & 3) != 0
-			|| edata.addr >= adapter->mmio_len)
-			return -EINVAL;
-		writel(edata.val, adapter->regs + edata.addr);
-		break;
-	}
-	case CHELSIO_GETREG:{
-		struct ch_reg edata;
-
-		if (copy_from_user(&edata, useraddr, sizeof(edata)))
-			return -EFAULT;
-		if ((edata.addr & 3) != 0
-			|| edata.addr >= adapter->mmio_len)
-			return -EINVAL;
-		edata.val = readl(adapter->regs + edata.addr);
-		if (copy_to_user(useraddr, &edata, sizeof(edata)))
-			return -EFAULT;
-		break;
-	}
 	case CHELSIO_SET_QSET_PARAMS:{
 		int i;
 		struct qset_params *q;
@@ -1841,10 +1815,10 @@ static int cxgb_extension_ioctl(struct n
 			return -EINVAL;
 
 		/*
-			* Version scheme:
-			* bits 0..9: chip version
-			* bits 10..15: chip revision
-			*/
+		 * Version scheme:
+		 * bits 0..9: chip version
+		 * bits 10..15: chip revision
+		 */
 		t.version = 3 | (adapter->params.rev << 10);
 		if (copy_to_user(useraddr, &t, sizeof(t)))
 			return -EFAULT;
@@ -1893,20 +1867,6 @@ static int cxgb_extension_ioctl(struct n
 						t.trace_rx);
 		break;
 	}
-	case CHELSIO_SET_PKTSCHED:{
-		struct ch_pktsched_params p;
-
-		if (!capable(CAP_NET_ADMIN))
-				return -EPERM;
-		if (!adapter->open_device_map)
-				return -EAGAIN;	/* uP and SGE must be running */
-		if (copy_from_user(&p, useraddr, sizeof(p)))
-				return -EFAULT;
-		send_pktsched_cmd(adapter, p.sched, p.idx, p.min, p.max,
-				  p.binding);
-		break;
-			
-	}
 	default:
 		return -EOPNOTSUPP;
 	}

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

* Re: [PATCH 2/7] cxgb3 - private ioctl cleanup
  2007-02-22 11:59 [PATCH 2/7] cxgb3 - private ioctl cleanup divy
@ 2007-02-22 12:06 ` YOSHIFUJI Hideaki / 吉藤英明
  2007-02-22 12:34   ` Divy Le Ray
  0 siblings, 1 reply; 7+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-02-22 12:06 UTC (permalink / raw)
  To: divy; +Cc: jeff, netdev, linux-kernel, swise, yoshfuji

In article <20070222115925.10001.61276.stgit@localhost.localdomain> (at Thu, 22 Feb 2007 03:59:25 -0800), divy@chelsio.com says:

> From: Divy Le Ray <divy@chelsio.com>
> 
> Clean up some private ioctls.
> 
> Signed-off-by: Divy Le Ray <divy@chelsio.com>
> ---
> 
>  drivers/net/cxgb3/cxgb3_ioctl.h |   21 ++++-------------
>  drivers/net/cxgb3/cxgb3_main.c  |   48 +++------------------------------------
>  2 files changed, 9 insertions(+), 60 deletions(-)
> 
> diff --git a/drivers/net/cxgb3/cxgb3_ioctl.h b/drivers/net/cxgb3/cxgb3_ioctl.h
> index a942818..42d4bf6 100644
> --- a/drivers/net/cxgb3/cxgb3_ioctl.h
> +++ b/drivers/net/cxgb3/cxgb3_ioctl.h
> @@ -36,28 +36,17 @@
>   * Ioctl commands specific to this driver.
>   */
>  enum {
> -	CHELSIO_SETREG = 1024,
> -	CHELSIO_GETREG,
> -	CHELSIO_SETTPI,
> -	CHELSIO_GETTPI,
> -	CHELSIO_GETMTUTAB,
> +	CHELSIO_GETMTUTAB = 1024,
>  	CHELSIO_SETMTUTAB,
> -	CHELSIO_GETMTU,
> -	CHELSIO_SET_PM,
> -	CHELSIO_GET_PM,
> -	CHELSIO_GET_TCAM,
> -	CHELSIO_SET_TCAM,
> -	CHELSIO_GET_TCB,
>  	CHELSIO_GET_MEM,
>  	CHELSIO_LOAD_FW,
> -	CHELSIO_GET_PROTO,
> -	CHELSIO_SET_PROTO,
>  	CHELSIO_SET_TRACE_FILTER,
> -	CHELSIO_SET_QSET_PARAMS,
>  	CHELSIO_GET_QSET_PARAMS,
> -	CHELSIO_SET_QSET_NUM,
> +	CHELSIO_SET_QSET_PARAMS,
>  	CHELSIO_GET_QSET_NUM,
> -	CHELSIO_SET_PKTSCHED,
> +	CHELSIO_SET_QSET_NUM,
> +	CHELSIO_GET_PM,
> +	CHELSIO_SET_PM,
>  };
>  

I disagree. This is very bad.

1. Please do do change the values.
2. Explain why you are going to kill these ioctls.

Regards,

--yoshfuji

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

* Re: [PATCH 2/7] cxgb3 - private ioctl cleanup
  2007-02-22 12:06 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-02-22 12:34   ` Divy Le Ray
  2007-02-22 12:39     ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 7+ messages in thread
From: Divy Le Ray @ 2007-02-22 12:34 UTC (permalink / raw)
  To: yoshfuji; +Cc: divy, jeff, netdev, linux-kernel, swise, yoshfuji

Hi Yoshfuji,
>> From: Divy Le Ray <divy@chelsio.com>
>>
>> Clean up some private ioctls.
>>
>> Signed-off-by: Divy Le Ray <divy@chelsio.com>
>> ---
>>
>>  drivers/net/cxgb3/cxgb3_ioctl.h |   21 ++++-------------
>>  drivers/net/cxgb3/cxgb3_main.c  |   48 +++------------------------------------
>>  2 files changed, 9 insertions(+), 60 deletions(-)
>>
>> diff --git a/drivers/net/cxgb3/cxgb3_ioctl.h b/drivers/net/cxgb3/cxgb3_ioctl.h
>> index a942818..42d4bf6 100644
>> --- a/drivers/net/cxgb3/cxgb3_ioctl.h
>> +++ b/drivers/net/cxgb3/cxgb3_ioctl.h
>> @@ -36,28 +36,17 @@
>>   * Ioctl commands specific to this driver.
>>   */
>>  enum {
>> -	CHELSIO_SETREG = 1024,
>> -	CHELSIO_GETREG,
>> -	CHELSIO_SETTPI,
>> -	CHELSIO_GETTPI,
>> -	CHELSIO_GETMTUTAB,
>> +	CHELSIO_GETMTUTAB = 1024,
>>  	CHELSIO_SETMTUTAB,
>> -	CHELSIO_GETMTU,
>> -	CHELSIO_SET_PM,
>> -	CHELSIO_GET_PM,
>> -	CHELSIO_GET_TCAM,
>> -	CHELSIO_SET_TCAM,
>> -	CHELSIO_GET_TCB,
>>  	CHELSIO_GET_MEM,
>>  	CHELSIO_LOAD_FW,
>> -	CHELSIO_GET_PROTO,
>> -	CHELSIO_SET_PROTO,
>>  	CHELSIO_SET_TRACE_FILTER,
>> -	CHELSIO_SET_QSET_PARAMS,
>>  	CHELSIO_GET_QSET_PARAMS,
>> -	CHELSIO_SET_QSET_NUM,
>> +	CHELSIO_SET_QSET_PARAMS,
>>  	CHELSIO_GET_QSET_NUM,
>> -	CHELSIO_SET_PKTSCHED,
>> +	CHELSIO_SET_QSET_NUM,
>> +	CHELSIO_GET_PM,
>> +	CHELSIO_SET_PM,
>>  };
>>  
>>     
>
> I disagree. This is very bad.
>
> 1. Please do do change the values.
> 2. Explain why you are going to kill these ioctls.
>   
Jeff and Arjan have required that most of these ioctls go.
Please read:
http://marc.theaimsgroup.com/?l=linux-netdev&m=117029584904193&w=2

Cheers,
Divy

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

* Re: [PATCH 2/7] cxgb3 - private ioctl cleanup
  2007-02-22 12:34   ` Divy Le Ray
@ 2007-02-22 12:39     ` YOSHIFUJI Hideaki / 吉藤英明
  2007-02-22 12:50       ` Divy Le Ray
  0 siblings, 1 reply; 7+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-02-22 12:39 UTC (permalink / raw)
  To: divy; +Cc: jeff, netdev, linux-kernel, swise, yoshfuji

In article <45DD8DDA.8060303@chelsio.com> (at Thu, 22 Feb 2007 04:34:34 -0800), Divy Le Ray <divy@chelsio.com> says:


> > 1. Please do do change the values.
> > 2. Explain why you are going to kill these ioctls.
> >   
> Jeff and Arjan have required that most of these ioctls go.
> Please read:
> http://marc.theaimsgroup.com/?l=linux-netdev&m=117029584904193&w=2

Even if you remove them, PLEASE DO NOT CHANGE THE VALUES,
unless you have very, very good reason.

--yoshfuji

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

* Re: [PATCH 2/7] cxgb3 - private ioctl cleanup
  2007-02-22 12:39     ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-02-22 12:50       ` Divy Le Ray
  2007-02-22 14:11         ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 7+ messages in thread
From: Divy Le Ray @ 2007-02-22 12:50 UTC (permalink / raw)
  To: yoshfuji; +Cc: divy, jeff, netdev, linux-kernel, swise, yoshfuji

YOSHIFUJI Hideaki / ^[$B5HF#1QL@^[ wrote:
> In article <45DD8DDA.8060303@chelsio.com> (at Thu, 22 Feb 2007 04:34:34 -0800), Divy Le Ray <divy@chelsio.com> says:
>
>
>   
>>> 1. Please do do change the values.
>>> 2. Explain why you are going to kill these ioctls.
>>>   
>>>       
>> Jeff and Arjan have required that most of these ioctls go.
>> Please read:
>> http://marc.theaimsgroup.com/?l=linux-netdev&m=117029584904193&w=2
>>     
>
> Even if you remove them, PLEASE DO NOT CHANGE THE VALUES,
> unless you have very, very good reason.
>   

The cxgb3 driver has not yet appeared in a stable version of the linux 
kernel.
The odds of breaking an application using these private ioctls are 
pretty slim.
Since some cleanup was required, I chose not to let holes between the 
values.

Cheers,
Divy



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

* Re: [PATCH 2/7] cxgb3 - private ioctl cleanup
  2007-02-22 12:50       ` Divy Le Ray
@ 2007-02-22 14:11         ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 0 replies; 7+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-02-22 14:11 UTC (permalink / raw)
  To: divy; +Cc: jeff, netdev, linux-kernel, swise, yoshfuji

In article <45DD917D.5010807@chelsio.com> (at Thu, 22 Feb 2007 04:50:05 -0800), Divy Le Ray <divy@chelsio.com> says:

> > Even if you remove them, PLEASE DO NOT CHANGE THE VALUES,
> > unless you have very, very good reason.
:
> The cxgb3 driver has not yet appeared in a stable version of the linux 
> kernel.
> The odds of breaking an application using these private ioctls are 
> pretty slim.
> Since some cleanup was required, I chose not to let holes between the 
> values.

Even so, if I were you, I would not have changed them and
I would even try keeping compatibility with old (out-kernel)
drivers.

--yoshfuji

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

* [PATCH 2/7] cxgb3 - private ioctl cleanup
@ 2007-02-25  0:43 divy
  0 siblings, 0 replies; 7+ messages in thread
From: divy @ 2007-02-25  0:43 UTC (permalink / raw)
  To: jeff; +Cc: netdev, linux-kernel, swise

From: Divy Le Ray <divy@chelsio.com>

Clean up some private ioctls.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
---

 drivers/net/cxgb3/cxgb3_ioctl.h |   33 +++++++++------------------
 drivers/net/cxgb3/cxgb3_main.c  |   48 +++------------------------------------
 2 files changed, 15 insertions(+), 66 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_ioctl.h b/drivers/net/cxgb3/cxgb3_ioctl.h
index a942818..0a82fcd 100644
--- a/drivers/net/cxgb3/cxgb3_ioctl.h
+++ b/drivers/net/cxgb3/cxgb3_ioctl.h
@@ -36,28 +36,17 @@
  * Ioctl commands specific to this driver.
  */
 enum {
-	CHELSIO_SETREG = 1024,
-	CHELSIO_GETREG,
-	CHELSIO_SETTPI,
-	CHELSIO_GETTPI,
-	CHELSIO_GETMTUTAB,
-	CHELSIO_SETMTUTAB,
-	CHELSIO_GETMTU,
-	CHELSIO_SET_PM,
-	CHELSIO_GET_PM,
-	CHELSIO_GET_TCAM,
-	CHELSIO_SET_TCAM,
-	CHELSIO_GET_TCB,
-	CHELSIO_GET_MEM,
-	CHELSIO_LOAD_FW,
-	CHELSIO_GET_PROTO,
-	CHELSIO_SET_PROTO,
-	CHELSIO_SET_TRACE_FILTER,
-	CHELSIO_SET_QSET_PARAMS,
-	CHELSIO_GET_QSET_PARAMS,
-	CHELSIO_SET_QSET_NUM,
-	CHELSIO_GET_QSET_NUM,
-	CHELSIO_SET_PKTSCHED,
+	CHELSIO_GETMTUTAB 		= 1029,
+	CHELSIO_SETMTUTAB 		= 1030,
+	CHELSIO_SET_PM 			= 1032,
+	CHELSIO_GET_PM			= 1033,
+	CHELSIO_GET_MEM			= 1038,
+	CHELSIO_LOAD_FW			= 1041,
+	CHELSIO_SET_TRACE_FILTER	= 1044,
+	CHELSIO_SET_QSET_PARAMS		= 1045,
+	CHELSIO_GET_QSET_PARAMS		= 1046,
+	CHELSIO_SET_QSET_NUM		= 1047,
+	CHELSIO_GET_QSET_NUM		= 1048,
 };
 
 struct ch_reg {
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 59f2b51..7ff834e 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1552,32 +1552,6 @@ static int cxgb_extension_ioctl(struct n
 		return -EFAULT;
 
 	switch (cmd) {
-	case CHELSIO_SETREG:{
-		struct ch_reg edata;
-
-		if (!capable(CAP_NET_ADMIN))
-			return -EPERM;
-		if (copy_from_user(&edata, useraddr, sizeof(edata)))
-			return -EFAULT;
-		if ((edata.addr & 3) != 0
-			|| edata.addr >= adapter->mmio_len)
-			return -EINVAL;
-		writel(edata.val, adapter->regs + edata.addr);
-		break;
-	}
-	case CHELSIO_GETREG:{
-		struct ch_reg edata;
-
-		if (copy_from_user(&edata, useraddr, sizeof(edata)))
-			return -EFAULT;
-		if ((edata.addr & 3) != 0
-			|| edata.addr >= adapter->mmio_len)
-			return -EINVAL;
-		edata.val = readl(adapter->regs + edata.addr);
-		if (copy_to_user(useraddr, &edata, sizeof(edata)))
-			return -EFAULT;
-		break;
-	}
 	case CHELSIO_SET_QSET_PARAMS:{
 		int i;
 		struct qset_params *q;
@@ -1841,10 +1815,10 @@ static int cxgb_extension_ioctl(struct n
 			return -EINVAL;
 
 		/*
-			* Version scheme:
-			* bits 0..9: chip version
-			* bits 10..15: chip revision
-			*/
+		 * Version scheme:
+		 * bits 0..9: chip version
+		 * bits 10..15: chip revision
+		 */
 		t.version = 3 | (adapter->params.rev << 10);
 		if (copy_to_user(useraddr, &t, sizeof(t)))
 			return -EFAULT;
@@ -1893,20 +1867,6 @@ static int cxgb_extension_ioctl(struct n
 						t.trace_rx);
 		break;
 	}
-	case CHELSIO_SET_PKTSCHED:{
-		struct ch_pktsched_params p;
-
-		if (!capable(CAP_NET_ADMIN))
-				return -EPERM;
-		if (!adapter->open_device_map)
-				return -EAGAIN;	/* uP and SGE must be running */
-		if (copy_from_user(&p, useraddr, sizeof(p)))
-				return -EFAULT;
-		send_pktsched_cmd(adapter, p.sched, p.idx, p.min, p.max,
-				  p.binding);
-		break;
-			
-	}
 	default:
 		return -EOPNOTSUPP;
 	}

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

end of thread, other threads:[~2007-02-25  0:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-22 11:59 [PATCH 2/7] cxgb3 - private ioctl cleanup divy
2007-02-22 12:06 ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-22 12:34   ` Divy Le Ray
2007-02-22 12:39     ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-22 12:50       ` Divy Le Ray
2007-02-22 14:11         ` YOSHIFUJI Hideaki / 吉藤英明
2007-02-25  0:43 divy

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