Due to mails here I send a copy of original mail about ax25_info_struct
diff is just 3kB so it is included too.
Only note I have is that I got some time and fixed hdlcdrv (testing now).
Some other drivers still have their own arbitration stuff that should be
removed.

---------- Forwarded message ----------
Date: Mon, 17 Jan 2000 13:39:39 +0100 (CET)
From: Jan Wasserbauer <[EMAIL PROTECTED]>
To: Jens David <[EMAIL PROTECTED]>
Subject: Re: DG2FEF-AX.25 Patch for 2.2.14 available

Hello ..
  Good that someone is taking care about new AX25, curent kernel-AX25 is
.. well .. really not as good as flexnet :)

Attached diff is to kernel 2.2.14-patched
- KISS driver works non-modular too.
- removed unused MKISS_MAJOR fm include/linux/major.h 
- new SIOCAX25GETINFO - ax25_info_struct now includes information about
  VR,VS,VA,WINDOW,PACLEN so programs may get those information through
  ioctl() and do not need to read /proc/net/ax25.

  ioctl() is generally better since information is returned only for one
  requested socket and not for all active ax25 sockets
  and it fixes problem with disabled interrups while reading /proc/..
  which causes problems to interrupt-dependant drivers (BayCom)
  My code includes some backwards compatibility .. I think that should be
  removed as soon as possible.

What needs to be done:
- hdlcdrv.c should be rewritten to take advantage of new AX25 and its
  channel acces methods. I was playing with that thing myself but my time
  isn't unlimited so ..
- I think initial value for persistence should be adjusted. After boot
  it is too low.

Bye .. Jan

diff -ru -x .* -x *.o linux.org/drivers/net/Space.c linux/drivers/net/Space.c
--- linux.org/drivers/net/Space.c       Tue Jan  4 19:12:17 2000
+++ linux/drivers/net/Space.c   Sun Jan 16 16:39:20 2000
@@ -717,15 +717,15 @@
 #define NEXT_DEV (&x25_asy_bootstrap)
 #endif /* X25_ASY */
   
-#if defined(CONFIG_MKISS)
+#if defined(CONFIG_KISS)
        /* To be exact, this node just hooks the initialization
           routines to the device structures.                   */
-extern int mkiss_init_ctrl_dev(struct device *);
-static struct device mkiss_bootstrap = {
-  "mkiss_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, mkiss_init_ctrl_dev, };
+extern int kiss_init_ctrl_dev(struct device *);
+static struct device kiss_bootstrap = {
+  "kiss_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, kiss_init_ctrl_dev, };
 #undef NEXT_DEV
-#define NEXT_DEV (&mkiss_bootstrap)
-#endif /* MKISS */
+#define NEXT_DEV (&kiss_bootstrap)
+#endif /* KISS */
   
 #if defined(CONFIG_YAM)
 extern int yam_init(struct device *);
diff -ru -x .* -x *.o linux.org/include/linux/ax25.h linux/include/linux/ax25.h
--- linux.org/include/linux/ax25.h      Sun Jan 16 18:13:15 2000
+++ linux/include/linux/ax25.h  Sun Jan 16 22:42:50 2000
@@ -31,10 +31,11 @@
 #define SIOCAX25NOUID          (SIOCPROTOPRIVATE+3)
 #define SIOCAX25OPTRT          (SIOCPROTOPRIVATE+7)
 #define SIOCAX25CTLCON         (SIOCPROTOPRIVATE+8)
-#define SIOCAX25GETINFO                (SIOCPROTOPRIVATE+9)
+#define SIOCAX25GETINFOOLD     (SIOCPROTOPRIVATE+9)
 #define SIOCAX25ADDFWD         (SIOCPROTOPRIVATE+10)
 #define SIOCAX25DELFWD         (SIOCPROTOPRIVATE+11)
 #define SIOCAX25DEVCTL          (SIOCPROTOPRIVATE+12)
+#define SIOCAX25GETINFO         (SIOCPROTOPRIVATE+13)
 
 #define AX25_SET_DEV_BITRATE    0
 #define AX25_SET_DEV_MODE       1
@@ -145,6 +146,9 @@
        unsigned int    idle, idletimer;
        unsigned int    state;
        unsigned int    rcv_q, snd_q;
+       unsigned short  vs, vr, va, vs_max;
+       unsigned short  paclen;
+       unsigned char   window;
 };
 
 struct ax25_fwd_struct {
diff -ru -x .* -x *.o linux.org/include/linux/major.h linux/include/linux/major.h
--- linux.org/include/linux/major.h     Tue Jan  4 19:12:25 2000
+++ linux/include/linux/major.h Sun Jan 16 16:44:39 2000
@@ -77,7 +77,6 @@
 #define RISCOM8_NORMAL_MAJOR 48
 #define DAC960_MAJOR   48      /* 48..55 */
 #define RISCOM8_CALLOUT_MAJOR 49
-#define MKISS_MAJOR    55
 #define DSP56K_MAJOR    55   /* DSP56001 processor device */
 
 #define IDE4_MAJOR     56
diff -ru -x .* -x *.o linux.org/net/ax25/af_ax25.c linux/net/ax25/af_ax25.c
--- linux.org/net/ax25/af_ax25.c        Sun Jan 16 18:13:15 2000
+++ linux/net/ax25/af_ax25.c    Sun Jan 16 22:44:20 2000
@@ -1303,7 +1303,8 @@
                                return -EPERM;
                        return ax25_ctl_ioctl(cmd, (void *)arg);
 
-               case SIOCAX25GETINFO: {
+               case SIOCAX25GETINFO:
+               case SIOCAX25GETINFOOLD: {
                        struct ax25_info_struct ax25_info;
                        ax25_info.t1        = sk->protinfo.ax25->t1;
                        ax25_info.t2        = sk->protinfo.ax25->t2;
@@ -1318,8 +1319,23 @@
                        ax25_info.state     = sk->protinfo.ax25->state;
                        ax25_info.rcv_q     = atomic_read(&sk->rmem_alloc);
                        ax25_info.snd_q     = atomic_read(&sk->wmem_alloc);
-                       if (copy_to_user((void *)arg, &ax25_info, sizeof(ax25_info)))
+
+                       if(cmd == SIOCAX25GETINFO)
+                       {
+                               ax25_info.vs    = sk->protinfo.ax25->vs;
+                               ax25_info.vr    = sk->protinfo.ax25->vr;
+                               ax25_info.va    = sk->protinfo.ax25->va;
+                               ax25_info.vs_max= sk->protinfo.ax25->vs_max;
+                               ax25_info.paclen= sk->protinfo.ax25->paclen;
+                               ax25_info.window= sk->protinfo.ax25->window;
+                               if (copy_to_user((void *)arg, &ax25_info, 
+sizeof(ax25_info)))
                                return -EFAULT;
+                       }
+                       else
+                       {
+                               if (copy_to_user((void *)arg, &ax25_info, 52))
+                                       return -EFAULT;
+                       }
                        return 0;
                }
 

Reply via email to