Re: [Openipmi-developer] [PATCH] IPMI: Support registering for a command per-channel

2006-06-29 Thread [EMAIL PROTECTED]
On Wed, Jun 28, 2006 at 08:06:03PM -0500, Corey Minyard wrote:
> This patch looks good to me.  I added the following as a header.
> Is this ok?  The "Signed-off-by" line is pretty important in patches.
> 
> Thanks,
> 
> -Corey
> --
> 
> This patch adds the ability to register for a command per-channel in
> the IPMI driver.
> 
> If your BMC supports multiple channels, incoming messages can be
> differentiated by the channel on which they arrived. In this case it's
> useful to have the ability to register to receive commands on a
> specific channel instead the current behaviour of all channels.
> 
> Signed-off-by: David Barksdale <[EMAIL PROTECTED]>
> 

Affirmative!

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] IPMI: Support registering for a command per-channel

2006-06-28 Thread Corey Minyard
This patch looks good to me.  I added the following as a header.
Is this ok?  The "Signed-off-by" line is pretty important in patches.

Thanks,

-Corey
--

This patch adds the ability to register for a command per-channel in
the IPMI driver.

If your BMC supports multiple channels, incoming messages can be
differentiated by the channel on which they arrived. In this case it's
useful to have the ability to register to receive commands on a
specific channel instead the current behaviour of all channels.

Signed-off-by: David Barksdale <[EMAIL PROTECTED]>


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] IPMI: Support registering for a command per-channel

2006-06-28 Thread [EMAIL PROTECTED]
On Mon, Jun 26, 2006 at 09:37:36AM -0500, Corey Minyard wrote:
> [EMAIL PROTECTED] wrote:
> > From: David Barksdale <[EMAIL PROTECTED]>
> >
> > This patch adds the ability to register for a command per-channel.
> >
> > If your BMC supports multiple channels, incoming messages can be
> > differentiated by the channel on which they arrived. In this case it's
> > useful to have the ability to register to receive commands on a
> > specific channel instead the current behaviour of all channels.
> Sorry for the long delay on this.  I like the patch in general, there
> are a few things I'd like to fix in it, though:
> 
> * Instead of naming the IOCTLs xxx_CMD2, could you name
>   them xxx_CMD_CHANNEL, or something that conveys a
>   little more meaning?
Done.
> 
> * The command unregister function needs to use a different
>   matching function now that you have to allow non-exact
>   matches for the channels.  You still need an exact match
>   for unregistering.
It behaves more reasonably now that the channels are specified as
bitmasks. It will unregister all channels you specify and only report an
error if it couldn't find anything to unregister.
> 
> * Someone mentioned using a bitmask for the channels
>   you are registering.  I think that's a good idea.  IPMI
>   only allows 16 channels max, so an unsigned int should
>   be plenty.  Add a define for all channels and for setting
>   a specific channel.
Done.
> 
> Thanks,
> 
> -Corey

Please consider this updated patch. Thanks.

--
This patch is to be used in place of the last one.

diff -rup linux-2.6.17.1.orig/drivers/char/ipmi/ipmi_devintf.c 
linux-2.6.17.1/drivers/char/ipmi/ipmi_devintf.c
--- linux-2.6.17.1.orig/drivers/char/ipmi/ipmi_devintf.c2006-06-20 
04:31:55.0 -0500
+++ linux-2.6.17.1/drivers/char/ipmi/ipmi_devintf.c 2006-06-28 
12:05:07.0 -0500
@@ -379,7 +379,8 @@ static int ipmi_ioctl(struct inode  *ino
break;
}
 
-   rv = ipmi_register_for_cmd(priv->user, val.netfn, val.cmd);
+   rv = ipmi_register_for_cmd(priv->user, val.netfn, val.cmd,
+   IPMI_CHAN_ALL);
break;
}
 
@@ -392,7 +393,36 @@ static int ipmi_ioctl(struct inode  *ino
break;
}
 
-   rv = ipmi_unregister_for_cmd(priv->user, val.netfn, val.cmd);
+   rv = ipmi_unregister_for_cmd(priv->user, val.netfn, val.cmd,
+   IPMI_CHAN_ALL);
+   break;
+   }
+
+   case IPMICTL_REGISTER_FOR_CMD_CHANS:
+   {
+   struct ipmi_cmdspec_chans val;
+
+   if (copy_from_user(&val, arg, sizeof(val))) {
+   rv = -EFAULT;
+   break;
+   }
+
+   rv = ipmi_register_for_cmd(priv->user, val.netfn, val.cmd,
+   val.chans);
+   break;
+   }
+
+   case IPMICTL_UNREGISTER_FOR_CMD_CHANS:
+   {
+   struct ipmi_cmdspec_chans val;
+
+   if (copy_from_user(&val, arg, sizeof(val))) {
+   rv = -EFAULT;
+   break;
+   }
+
+   rv = ipmi_unregister_for_cmd(priv->user, val.netfn, val.cmd,
+   val.chans);
break;
}
 
diff -rup linux-2.6.17.1.orig/drivers/char/ipmi/ipmi_msghandler.c 
linux-2.6.17.1/drivers/char/ipmi/ipmi_msghandler.c
--- linux-2.6.17.1.orig/drivers/char/ipmi/ipmi_msghandler.c 2006-06-20 
04:31:55.0 -0500
+++ linux-2.6.17.1/drivers/char/ipmi/ipmi_msghandler.c  2006-06-28 
13:31:24.0 -0500
@@ -98,6 +98,7 @@ struct cmd_rcvr
ipmi_user_t   user;
unsigned char netfn;
unsigned char cmd;
+   unsigned int  chans;
 
/*
 * This is used to form a linked lised during mass deletion.
@@ -958,24 +959,41 @@ int ipmi_set_gets_events(ipmi_user_t use
 
 static struct cmd_rcvr *find_cmd_rcvr(ipmi_smi_tintf,
  unsigned char netfn,
- unsigned char cmd)
+ unsigned char cmd,
+ unsigned char chan)
 {
struct cmd_rcvr *rcvr;
 
list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) {
-   if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd))
+   if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)
+   && (rcvr->chans & (1 << chan)))
return rcvr;
}
return NULL;
 }
 
+static int is_cmd_rcvr_exclusive(ipmi_smi_tintf,
+unsigned char netfn,
+unsigned char cmd,
+unsigned int  chans)
+{
+   struct cmd_rcvr *rcvr;
+
+   list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) {
+   if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)
+

Re: [Openipmi-developer] [PATCH] IPMI: Support registering for a command per-channel

2006-06-26 Thread Corey Minyard
[EMAIL PROTECTED] wrote:
> From: David Barksdale <[EMAIL PROTECTED]>
>
> This patch adds the ability to register for a command per-channel.
>
> If your BMC supports multiple channels, incoming messages can be
> differentiated by the channel on which they arrived. In this case it's
> useful to have the ability to register to receive commands on a
> specific channel instead the current behaviour of all channels.
>
>   
Sorry for the long delay on this.  I like the patch in general, there
are a few things I'd like to fix in it, though:

* Instead of naming the IOCTLs xxx_CMD2, could you name
  them xxx_CMD_CHANNEL, or something that conveys a
  little more meaning?

* The command unregister function needs to use a different
  matching function now that you have to allow non-exact
  matches for the channels.  You still need an exact match
  for unregistering.

* Someone mentioned using a bitmask for the channels
  you are registering.  I think that's a good idea.  IPMI
  only allows 16 channels max, so an unsigned int should
  be plenty.  Add a define for all channels and for setting
  a specific channel.

Thanks,

-Corey

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] IPMI: Support registering for a command per-channel

2006-06-23 Thread Philip Pokorny
>
>
>From: David Barksdale <[EMAIL PROTECTED]>
>
>This patch adds the ability to register for a command per-channel.
>
>If your BMC supports multiple channels, incoming messages can be
>differentiated by the channel on which they arrived. In this case it's
>useful to have the ability to register to receive commands on a
>specific channel instead the current behaviour of all channels.
>  
>

Given that there are only 15 channels, would it make sense to use a bit 
field/bit mask instead of an unsigned char so that a set of channels 
could be selected rather than limiting to a single channel or any channel?

This would involve some additional macro constants for "ALL_CHANNELS" 
perhaps specific channels. That would eliminate the magic constant 255 
and perhaps make things more readable.

:v)

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


[Openipmi-developer] [PATCH] IPMI: Support registering for a command per-channel

2006-06-23 Thread [EMAIL PROTECTED]
From: David Barksdale <[EMAIL PROTECTED]>

This patch adds the ability to register for a command per-channel.

If your BMC supports multiple channels, incoming messages can be
differentiated by the channel on which they arrived. In this case it's
useful to have the ability to register to receive commands on a
specific channel instead the current behaviour of all channels.

Signed-off-by: David Barksdale <[EMAIL PROTECTED]>

---

--- drivers/char/ipmi/ipmi_devintf.c2006-06-14 15:40:12.0 -0500
+++ drivers/char/ipmi/ipmi_devintf.c.keep   2006-06-14 15:42:51.0 
-0500
@@ -379,7 +379,7 @@
break;
}
 
-   rv = ipmi_register_for_cmd(priv->user, val.netfn, val.cmd);
+   rv = ipmi_register_for_cmd(priv->user, val.netfn, val.cmd, 255);
break;
}
 
@@ -392,7 +392,36 @@
break;
}
 
-   rv = ipmi_unregister_for_cmd(priv->user, val.netfn, val.cmd);
+   rv = ipmi_unregister_for_cmd(priv->user, val.netfn, val.cmd,
+   255);
+   break;
+   }
+
+   case IPMICTL_REGISTER_FOR_CMD2:
+   {
+   struct ipmi_cmdspec2 val;
+
+   if (copy_from_user(&val, arg, sizeof(val))) {
+   rv = -EFAULT;
+   break;
+   }
+
+   rv = ipmi_register_for_cmd(priv->user, val.netfn, val.cmd,
+   val.chan);
+   break;
+   }
+
+   case IPMICTL_UNREGISTER_FOR_CMD2:
+   {
+   struct ipmi_cmdspec2 val;
+
+   if (copy_from_user(&val, arg, sizeof(val))) {
+   rv = -EFAULT;
+   break;
+   }
+
+   rv = ipmi_unregister_for_cmd(priv->user, val.netfn, val.cmd,
+   val.chan);
break;
}
 
--- drivers/char/ipmi/ipmi_msghandler.c 2006-06-14 15:40:20.0 -0500
+++ drivers/char/ipmi/ipmi_msghandler.c.keep2006-06-14 17:00:27.0 
-0500
@@ -96,6 +96,7 @@
ipmi_user_t   user;
unsigned char netfn;
unsigned char cmd;
+   unsigned char chan;
 
/*
 * This is used to form a linked lised during mass deletion.
@@ -921,12 +922,15 @@
 
 static struct cmd_rcvr *find_cmd_rcvr(ipmi_smi_tintf,
  unsigned char netfn,
- unsigned char cmd)
+ unsigned char cmd,
+ unsigned char chan)
 {
struct cmd_rcvr *rcvr;
 
list_for_each_entry_rcu(rcvr, &intf->cmd_rcvrs, link) {
-   if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd))
+   if ((rcvr->netfn == netfn) && (rcvr->cmd == cmd)
+   && ((chan == 255) || (rcvr->chan == 255)
+   || (rcvr->chan == chan)))
return rcvr;
}
return NULL;
@@ -934,7 +938,8 @@
 
 int ipmi_register_for_cmd(ipmi_user_t   user,
  unsigned char netfn,
- unsigned char cmd)
+ unsigned char cmd,
+ unsigned char chan)
 {
ipmi_smi_t  intf = user->intf;
struct cmd_rcvr *rcvr;
@@ -947,11 +952,12 @@
return -ENOMEM;
rcvr->cmd = cmd;
rcvr->netfn = netfn;
+   rcvr->chan = chan;
rcvr->user = user;
 
down(&intf->cmd_rcvrs_lock);
-   /* Make sure the command/netfn is not already registered. */
-   entry = find_cmd_rcvr(intf, netfn, cmd);
+   /* Make sure the command/netfn/chan is not already registered. */
+   entry = find_cmd_rcvr(intf, netfn, cmd, chan);
if (entry) {
rv = -EBUSY;
goto out_unlock;
@@ -969,14 +975,15 @@
 
 int ipmi_unregister_for_cmd(ipmi_user_t   user,
unsigned char netfn,
-   unsigned char cmd)
+   unsigned char cmd,
+   unsigned char chan)
 {
ipmi_smi_t  intf = user->intf;
struct cmd_rcvr *rcvr;
 
down(&intf->cmd_rcvrs_lock);
-   /* Make sure the command/netfn is not already registered. */
-   rcvr = find_cmd_rcvr(intf, netfn, cmd);
+   /* Make sure the command/netfn/chan is already registered. */
+   rcvr = find_cmd_rcvr(intf, netfn, cmd, chan);
if ((rcvr) && (rcvr->user == user)) {
list_del_rcu(&rcvr->link);
up(&intf->cmd_rcvrs_lock);
@@ -2036,6 +2043,7 @@
int  rv = 0;
unsigned charnetfn;
unsigned charcmd;
+   unsigned charchan;
ipmi_user_t  user = NULL;
struct ipmi_ipmb_addr*ipmb_addr;
struct ipmi_recv_msg *recv_msg;
@@ -2056,9 +2064,10 @@
 
netf