Re: softraid cleanup

2010-09-30 Thread Marco Peereboom
hrmpf, not supposed to happen panic.  Thanks!

Back to the drawing board.

On Wed, Sep 29, 2010 at 11:58:51PM -0400, Dan Harnett wrote:
 On Thu, Sep 30, 2010 at 03:35:33AM +0200, Tobias Ulmer wrote:
  I got this after a while:
  
  panic: softraid0: sr_crypto_finish_io
 
 I see the same panic in the latest amd64 snapshot.
 
 panic: softraid0: sr_crypto_finish_io
 Stopped atDebugger+0x5:   leave
 ddb{0} trace
 Debugger() at Debugger+0x5
 panic() at panic+0xe4
 sr_crypto_finish_io() at sr_crypto_finish_io+0xc7
 sr_crypto_intr() at sr_crypto_intr+0x15d
 sd_buf_done() at sd_buf_done+0x76
 ahci_port_intr() at ahci_port_intr+0x183
 ahci_intr() at ahci_intr+0x5c
 Xintr_ioapic_level10() at Xintr_ioapic_level10+0xec
 --- interrupt ---
 Bad frame pointer: 0x800025c16df8
 end trace frame: 0x800025c16df8, count: -8
 spllower+0x35:
 ddb{0}



rtsocket filtering

2010-09-30 Thread Claudio Jeker
Currently all routing messages are sent to the clients no matter if they
need to see the message or not. One such example are messages from other
routing tables that are sent to userland even though the process has no
interest in these messages. This diff implememnts a filter that limits
the messages to the rtable/rdomain a process belongs to. For special
cases (route(8) and bgpd(8)) a socket option can be used to change the
filter to a different table (or all in case of RTABLE_ANY).

This makes stuff like route -T 1 exec route -n show -inet show rtable 1.
netstat(8) will need a similar change and RTM_IFINFO should be rdomain
aware but those are independent changes.
-- 
:wq Claudio

Index: sbin/route/route.c
===
RCS file: /cvs/src/sbin/route/route.c,v
retrieving revision 1.150
diff -u -p -r1.150 route.c
--- sbin/route/route.c  21 Sep 2010 10:58:23 -  1.150
+++ sbin/route/route.c  30 Sep 2010 09:53:53 -
@@ -68,7 +68,7 @@ union sockunion so_dst, so_gate, so_mask
 typedef union sockunion *sup;
 pid_t  pid;
 intrtm_addrs, s;
-intforcehost, forcenet, Fflag, nflag, af, qflag, tflag;
+intforcehost, forcenet, Fflag, nflag, af, qflag, tflag, Tflag;
 intiflag, verbose, aflen = sizeof(struct sockaddr_in);
 intlocking, lockrest, debugonly;
 u_long mpls_flags = MPLS_OP_LOCAL;
@@ -134,6 +134,7 @@ main(int argc, char **argv)
if (argc  2)
usage(NULL);
 
+   tableid = getrtable();
while ((ch = getopt(argc, argv, dnqtT:v)) != -1)
switch (ch) {
case 'n':
@@ -150,6 +151,7 @@ main(int argc, char **argv)
break;
case 'T':
gettable(optarg);
+   Tflag = 1;
break;
case 'd':
debugonly = 1;
@@ -180,6 +182,10 @@ main(int argc, char **argv)
s = socket(PF_ROUTE, SOCK_RAW, 0);
if (s == -1)
err(1, socket);
+   /* force socket onto table user requested */
+   if (Tflag  setsockopt(s, AF_ROUTE, ROUTE_TABLEFILTER,
+   tableid, sizeof(tableid)) == -1)
+   err(1, setsockopt(ROUTE_TABLEFILTER));
break;
}
switch (kw) {
@@ -688,7 +694,7 @@ show(int argc, char *argv[])
usage(*argv);
}
 
-   p_rttables(af, tableid);
+   p_rttables(af, tableid, Tflag);
 }
 
 void
@@ -1046,7 +1052,10 @@ monitor(int argc, char *argv[])
 
if (setsockopt(s, AF_ROUTE, ROUTE_MSGFILTER, filter,
sizeof(filter)) == -1)
-   err(1, setsockopt);
+   err(1, setsockopt(ROUTE_MSGFILTER));
+   if (Tflag  setsockopt(s, AF_ROUTE, ROUTE_TABLEFILTER, tableid,
+   sizeof(tableid)) == -1)
+   err(1, setsockopt(ROUTE_TABLEFILTER));
 
verbose = 1;
if (debugonly) {
@@ -1617,11 +1626,25 @@ getlabel(char *name)
 void
 gettable(const char *s)
 {
-   const char  *errstr;
+   const char  *errstr;
+   struct rt_tableinfo  info;
+   int  mib[6];
+   size_t   len;
 
tableid = strtonum(s, 0, RT_TABLEID_MAX, errstr);
if (errstr)
errx(1, invalid table id: %s, errstr);
+
+   mib[0] = CTL_NET;
+   mib[1] = AF_ROUTE;
+   mib[2] = 0;
+   mib[3] = 0;
+   mib[4] = NET_RT_TABLE;
+   mib[5] = tableid;
+
+   len = sizeof(info);
+   if (sysctl(mib, 6, info, len, NULL, 0) == -1)
+   err(1, routing table %i, tableid);
 }
 
 int
Index: sbin/route/show.c
===
RCS file: /cvs/src/sbin/route/show.c,v
retrieving revision 1.88
diff -u -p -r1.88 show.c
--- sbin/route/show.c   21 Sep 2010 10:58:23 -  1.88
+++ sbin/route/show.c   30 Sep 2010 08:55:02 -
@@ -123,13 +123,13 @@ void   index_pfk(struct sadb_msg *, void 
  * Print routing tables.
  */
 void
-p_rttables(int af, u_int tableid)
+p_rttables(int af, u_int tableid, int hastable)
 {
struct rt_msghdr *rtm;
struct sadb_msg *msg;
char *buf = NULL, *next, *lim = NULL;
size_t needed;
-   int mib[7];
+   int mib[7], mcnt;
struct sockaddr *sa;
 
mib[0] = CTL_NET;
@@ -138,14 +138,18 @@ p_rttables(int af, u_int tableid)
mib[3] = af;
mib[4] = NET_RT_DUMP;
mib[5] = 0;
-   mib[6] = tableid;
+   if (hastable) {
+   mib[6] = tableid;
+   mcnt = 7;
+   } else
+   mcnt = 6;
 
-   if (sysctl(mib, 7, NULL, needed, NULL, 0)  0)
+   if (sysctl(mib, mcnt, NULL, needed, NULL, 0)  0)
err(1, route-sysctl-estimate);
if (needed  0) {
if ((buf = malloc(needed)) == 0)
err(1, NULL);
-  

update pms driver

2010-09-30 Thread Alexandr Shadchin
I'll try to start over, I'll make a small diff. They will be easier for you
to check and I did not mix everything in one pile.

Removed unnecessary code, as the same thing does pms_change_state() when 
the device enters a state of PMS_STATE_ENABLED

-- 
Alexandr Shadchin


Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.6
diff -u -p -r1.6 pms.c
--- pms.c   29 Sep 2010 19:39:18 -  1.6
+++ pms.c   30 Sep 2010 07:40:39 -
@@ -173,9 +173,6 @@ pmsattach(parent, self, aux)
}
 #endif
 
-   sc-inputstate = 0;
-   sc-oldbuttons = 0;
-
pckbc_set_inputhandler(sc-sc_kbctag, sc-sc_kbcslot,
   pmsinput, sc, sc-sc_dev.dv_xname);



Computadoras Armadas a medida - Intel y AMD

2010-09-30 Thread ARMYTECH Hardware
[IMAGE][IMAGE][IMAGE][IMAGE][IMAGE][IMAGE][IMAGE][IMAGE]En caso de no
querer recibir mas este correo por favor presione AQUI .



Re: update pms driver

2010-09-30 Thread Alexandr Shadchin
On Thu, Sep 30, 2010 at 08:04:44PM -0400, Kenneth R Westerback wrote:
 
 This is a bit too small. :-). I've copied mikeb@ in to ensure we
 are not losing too much in translation.
 
 The primary focus right now has to be to fix the regressions Ian@
 and no doubt others are experiencing. If we can't fix those regressions
 we will have to revert your diffs and figure out what was wrong
 before putting them back into the tree. The philosophy here is to
 commit early but un-commit quickly if something regresses. Especially
 when Theo is completely buried in something and will neither respond
 to queries about other stuff or suffer any lengthy periods of
 breakage that would distract him.
 
 We also face a bit of a deadline as the person who understands this
 code and these devices the most (miod@) will shortly vanish for a
 couple of months of moving. There would be reluctance to make big
 changes in those months. Code cleanup and formatting, etc. would
 be ideal for that time period.
 
 But first, the regressions. Do you have enough information from
 ian@ to suggest a test plan or code to tweak?
 
  Ken

OK. This diff resolves Ian problem, Ian has already checked it out.

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.6
diff -u -p -r1.6 pms.c
--- pms.c   29 Sep 2010 19:39:18 -  1.6
+++ pms.c   30 Sep 2010 19:47:12 -
@@ -49,6 +49,7 @@ struct pms_softc {/* driver status inf
 #define PMS_STATE_ENABLED  1
 #define PMS_STATE_SUSPENDED2
 
+   int poll;
int intelli;
int inputstate;
u_int buttons, oldbuttons;  /* mouse button status */
@@ -72,7 +73,9 @@ int   pms_ioctl(void *, u_long, caddr_t, i
 intpms_enable(void *);
 void   pms_disable(void *);
 
-intpms_setintellimode(pckbc_tag_t, pckbc_slot_t);
+intpms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
+
+intpms_setintellimode(struct pms_softc *sc);
 
 const struct wsmouse_accessops pms_accessops = {
pms_enable,
@@ -81,7 +84,19 @@ const struct wsmouse_accessops pms_acces
 };
 
 int
-pms_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot)
+pms_cmd(struct pms_softc *sc, u_char *cmd, int len, u_char *resp, int resplen)
+{
+   if (sc-poll) {
+   return pckbc_poll_cmd(sc-sc_kbctag, sc-sc_kbcslot,
+   cmd, len, resplen, resp, 1);
+   } else {
+   return pckbc_enqueue_cmd(sc-sc_kbctag, sc-sc_kbcslot,
+   cmd, len, resplen, 1, resp);
+   }
+}
+
+int
+pms_setintellimode(struct pms_softc *sc)
 {
u_char cmd[2], resp[1];
int i, res;
@@ -90,13 +105,13 @@ pms_setintellimode(pckbc_tag_t tag, pckb
cmd[0] = PMS_SET_SAMPLE;
for (i = 0; i  3; i++) {
cmd[1] = rates[i];
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
+   res = pms_cmd(sc, cmd, 2, NULL, 0);
if (res)
return (0);
}
 
cmd[0] = PMS_SEND_DEV_ID;
-   res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 1, resp);
+   res = pms_cmd(sc, cmd, 1, resp, 1);
if (res || resp[0] != 3)
return (0);
 
@@ -191,11 +206,8 @@ pmsattach(parent, self, aux)
sc-sc_wsmousedev = config_found(self, a, wsmousedevprint);
 
/* no interrupts until enabled */
-   cmd[0] = PMS_DEV_DISABLE;
-   res = pckbc_poll_cmd(pa-pa_tag, pa-pa_slot, cmd, 1, 0, NULL, 0);
-   if (res)
-   printf(pmsattach: disable error\n);
-   pckbc_slot_enable(sc-sc_kbctag, sc-sc_kbcslot, 0);
+   sc-poll = 1;
+   pms_change_state(sc, PMS_STATE_DISABLED);
 }
 
 int
@@ -219,7 +231,7 @@ pmsactivate(struct device *self, int act
 int
 pms_change_state(struct pms_softc *sc, int newstate)
 {
-   u_char cmd[1];
+   u_char cmd[1], resp[2];
int res;
 
switch (newstate) {
@@ -231,12 +243,13 @@ pms_change_state(struct pms_softc *sc, i
 
pckbc_slot_enable(sc-sc_kbctag, sc-sc_kbcslot, 1);
 
-   pckbc_flush(sc-sc_kbctag, sc-sc_kbcslot);
-   sc-intelli = pms_setintellimode(sc-sc_kbctag, sc-sc_kbcslot);
+   cmd[0] = PMS_RESET;
+   res = pms_cmd(sc, cmd, 1, resp, 2);
+
+   sc-intelli = pms_setintellimode(sc);
 
cmd[0] = PMS_DEV_ENABLE;
-   res = pckbc_enqueue_cmd(sc-sc_kbctag, sc-sc_kbcslot,
-   cmd, 1, 0, 1, 0);
+   res = pms_cmd(sc, cmd, 1, NULL, 0);
if (res)
printf(pms_enable: command error\n);
 #if 0
@@ -265,18 +278,19 @@ pms_change_state(struct pms_softc *sc, i
}
 #endif
sc-sc_state = newstate;
+   sc-poll = 0;
break;
case PMS_STATE_DISABLED:
 
/* FALLTHROUGH */
case PMS_STATE_SUSPENDED:
cmd[0] = 

Re: update pms driver

2010-09-30 Thread Kenneth R Westerback
On Fri, Oct 01, 2010 at 04:27:05PM +0600, Alexandr Shadchin wrote:
 On Thu, Sep 30, 2010 at 08:04:44PM -0400, Kenneth R Westerback wrote:
  
  This is a bit too small. :-). I've copied mikeb@ in to ensure we
  are not losing too much in translation.
  
  The primary focus right now has to be to fix the regressions Ian@
  and no doubt others are experiencing. If we can't fix those regressions
  we will have to revert your diffs and figure out what was wrong
  before putting them back into the tree. The philosophy here is to
  commit early but un-commit quickly if something regresses. Especially
  when Theo is completely buried in something and will neither respond
  to queries about other stuff or suffer any lengthy periods of
  breakage that would distract him.
  
  We also face a bit of a deadline as the person who understands this
  code and these devices the most (miod@) will shortly vanish for a
  couple of months of moving. There would be reluctance to make big
  changes in those months. Code cleanup and formatting, etc. would
  be ideal for that time period.
  
  But first, the regressions. Do you have enough information from
  ian@ to suggest a test plan or code to tweak?
  
   Ken
 
 OK. This diff resolves Ian problem, Ian has already checked it out.

And it keeps my eeePC 1000HE working. Excellent!!

Anyone else have problems left after this diff? If not, then let's get it
in and go forward from here.

 Ken

 
 -- 
 Alexandr Shadchin
 
 Index: pms.c
 ===
 RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
 retrieving revision 1.6
 diff -u -p -r1.6 pms.c
 --- pms.c 29 Sep 2010 19:39:18 -  1.6
 +++ pms.c 30 Sep 2010 19:47:12 -
 @@ -49,6 +49,7 @@ struct pms_softc {  /* driver status inf
  #define PMS_STATE_ENABLED1
  #define PMS_STATE_SUSPENDED  2
  
 + int poll;
   int intelli;
   int inputstate;
   u_int buttons, oldbuttons;  /* mouse button status */
 @@ -72,7 +73,9 @@ int pms_ioctl(void *, u_long, caddr_t, i
  int  pms_enable(void *);
  void pms_disable(void *);
  
 -int  pms_setintellimode(pckbc_tag_t, pckbc_slot_t);
 +int  pms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
 +
 +int  pms_setintellimode(struct pms_softc *sc);
  
  const struct wsmouse_accessops pms_accessops = {
   pms_enable,
 @@ -81,7 +84,19 @@ const struct wsmouse_accessops pms_acces
  };
  
  int
 -pms_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot)
 +pms_cmd(struct pms_softc *sc, u_char *cmd, int len, u_char *resp, int 
 resplen)
 +{
 + if (sc-poll) {
 + return pckbc_poll_cmd(sc-sc_kbctag, sc-sc_kbcslot,
 + cmd, len, resplen, resp, 1);
 + } else {
 + return pckbc_enqueue_cmd(sc-sc_kbctag, sc-sc_kbcslot,
 + cmd, len, resplen, 1, resp);
 + }
 +}
 +
 +int
 +pms_setintellimode(struct pms_softc *sc)
  {
   u_char cmd[2], resp[1];
   int i, res;
 @@ -90,13 +105,13 @@ pms_setintellimode(pckbc_tag_t tag, pckb
   cmd[0] = PMS_SET_SAMPLE;
   for (i = 0; i  3; i++) {
   cmd[1] = rates[i];
 - res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
 + res = pms_cmd(sc, cmd, 2, NULL, 0);
   if (res)
   return (0);
   }
  
   cmd[0] = PMS_SEND_DEV_ID;
 - res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 1, resp);
 + res = pms_cmd(sc, cmd, 1, resp, 1);
   if (res || resp[0] != 3)
   return (0);
  
 @@ -191,11 +206,8 @@ pmsattach(parent, self, aux)
   sc-sc_wsmousedev = config_found(self, a, wsmousedevprint);
  
   /* no interrupts until enabled */
 - cmd[0] = PMS_DEV_DISABLE;
 - res = pckbc_poll_cmd(pa-pa_tag, pa-pa_slot, cmd, 1, 0, NULL, 0);
 - if (res)
 - printf(pmsattach: disable error\n);
 - pckbc_slot_enable(sc-sc_kbctag, sc-sc_kbcslot, 0);
 + sc-poll = 1;
 + pms_change_state(sc, PMS_STATE_DISABLED);
  }
  
  int
 @@ -219,7 +231,7 @@ pmsactivate(struct device *self, int act
  int
  pms_change_state(struct pms_softc *sc, int newstate)
  {
 - u_char cmd[1];
 + u_char cmd[1], resp[2];
   int res;
  
   switch (newstate) {
 @@ -231,12 +243,13 @@ pms_change_state(struct pms_softc *sc, i
  
   pckbc_slot_enable(sc-sc_kbctag, sc-sc_kbcslot, 1);
  
 - pckbc_flush(sc-sc_kbctag, sc-sc_kbcslot);
 - sc-intelli = pms_setintellimode(sc-sc_kbctag, sc-sc_kbcslot);
 + cmd[0] = PMS_RESET;
 + res = pms_cmd(sc, cmd, 1, resp, 2);
 +
 + sc-intelli = pms_setintellimode(sc);
  
   cmd[0] = PMS_DEV_ENABLE;
 - res = pckbc_enqueue_cmd(sc-sc_kbctag, sc-sc_kbcslot,
 - cmd, 1, 0, 1, 0);
 + res = pms_cmd(sc, cmd, 1, NULL, 0);
   if (res)
   printf(pms_enable: command error\n);
  #if 0
 @@ -265,18 +278,19 @@ pms_change_state(struct pms_softc *sc, i