Hi,

        I've realised that my USB dongle choke on frames of 2048 bytes
(maximum size of IrDA). This would happen for example if you do PPP
over IrComm over a USB dongle. Reducing the frame size by a few dozen
bytes fixed the problem.
        The attached patch add a new sysctl that you can tweak to
workaround this hardware bug.

        Happy hacking...

        Jean
diff -u -p linux/net/irda/irsysctl.d4.c linux/net/irda/irsysctl.c
--- linux/net/irda/irsysctl.d4.c        Tue Jan 15 15:17:51 2002
+++ linux/net/irda/irsysctl.c   Tue Jan 15 15:23:20 2002
@@ -35,17 +35,19 @@
 #define NET_IRDA 412 /* Random number */
 enum { DISCOVERY=1, DEVNAME, DEBUG, FAST_POLL, DISCOVERY_SLOTS,
        DISCOVERY_TIMEOUT, SLOT_TIMEOUT, MAX_BAUD_RATE, MIN_TX_TURN_TIME,
-       MAX_NOREPLY_TIME, WARN_NOREPLY_TIME, LAP_KEEPALIVE_TIME };
+       MAX_TX_DATA_SIZE, MAX_NOREPLY_TIME, WARN_NOREPLY_TIME,
+       LAP_KEEPALIVE_TIME };
 
 extern int  sysctl_discovery;
 extern int  sysctl_discovery_slots;
 extern int  sysctl_discovery_timeout;
-extern int  sysctl_slot_timeout;       /* Candidate */
+extern int  sysctl_slot_timeout;
 extern int  sysctl_fast_poll_increase;
 int         sysctl_compression = 0;
 extern char sysctl_devname[];
 extern int  sysctl_max_baud_rate;
 extern int  sysctl_min_tx_turn_time;
+extern int  sysctl_max_tx_data_size;
 extern int  sysctl_max_noreply_time;
 extern int  sysctl_warn_noreply_time;
 extern int  sysctl_lap_keepalive_time;
@@ -65,6 +67,8 @@ static int max_max_baud_rate = 16000000;
 static int min_max_baud_rate = 2400;
 static int max_min_tx_turn_time = 10000;       /* See qos.c - IrLAP spec */
 static int min_min_tx_turn_time = 0;
+static int max_max_tx_data_size = 2048;                /* See qos.c - IrLAP spec */
+static int min_max_tx_data_size = 64;
 static int max_max_noreply_time = 40;          /* See qos.c - IrLAP spec */
 static int min_max_noreply_time = 3;
 static int max_warn_noreply_time = 3;          /* 3s == standard */
@@ -118,6 +122,9 @@ static ctl_table irda_table[] = {
        { MIN_TX_TURN_TIME, "min_tx_turn_time", &sysctl_min_tx_turn_time,
          sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
          NULL, &min_min_tx_turn_time, &max_min_tx_turn_time },
+       { MAX_TX_DATA_SIZE, "max_tx_data_size", &sysctl_max_tx_data_size,
+         sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
+         NULL, &min_max_tx_data_size, &max_max_tx_data_size },
        { MAX_NOREPLY_TIME, "max_noreply_time", &sysctl_max_noreply_time,
          sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec,
          NULL, &min_max_noreply_time, &max_max_noreply_time },
diff -u -p linux/net/irda/qos.d4.c linux/net/irda/qos.c
--- linux/net/irda/qos.d4.c     Tue Jan 15 15:17:43 2002
+++ linux/net/irda/qos.c        Tue Jan 15 15:31:05 2002
@@ -61,6 +61,12 @@ int sysctl_max_noreply_time = 12;
  * except if it's 0 (0 is likely a bug in the other stack).
  */
 unsigned sysctl_min_tx_turn_time = 10;
+/*
+ * Maximum data size to be used in transmission.
+ * Some transmitter (USB dongles) are not spec compliant and need to be
+ * "adjusted" - Jean II
+ */
+unsigned sysctl_max_tx_data_size = 2048;
 
 static int irlap_param_baud_rate(void *instance, irda_param_t *param, int get);
 static int irlap_param_link_disconnect(void *instance, irda_param_t *parm, 
@@ -355,10 +361,10 @@ void irlap_adjust_qos_settings(struct qo
        while ((qos->data_size.value > line_capacity) && (index > 0)) {
                qos->data_size.value = data_sizes[index--];
                IRDA_DEBUG(2, __FUNCTION__ 
-                          "(), redusing data size to %d\n",
+                          "(), reducing data size to %d\n",
                           qos->data_size.value);
        }
-#else /* Use method descibed in section 6.6.11 of IrLAP */
+#else /* Use method described in section 6.6.11 of IrLAP */
        while (irlap_requested_line_capacity(qos) > line_capacity) {
                ASSERT(index != 0, return;);
 
@@ -366,18 +372,24 @@ void irlap_adjust_qos_settings(struct qo
                if (qos->window_size.value > 1) {
                        qos->window_size.value--;
                        IRDA_DEBUG(2, __FUNCTION__ 
-                                  "(), redusing window size to %d\n",
+                                  "(), reducing window size to %d\n",
                                   qos->window_size.value);
                } else if (index > 1) {
                        qos->data_size.value = data_sizes[index--];
                        IRDA_DEBUG(2, __FUNCTION__ 
-                                  "(), redusing data size to %d\n",
+                                  "(), reducing data size to %d\n",
                                   qos->data_size.value);
                } else {
                        WARNING(__FUNCTION__ "(), nothing more we can do!\n");
                }
        }
 #endif /* CONFIG_IRDA_DYNAMIC_WINDOW */
+       /*
+        * Fix tx data size according to user limits - Jean II
+        */
+       if (qos->data_size.value > sysctl_max_tx_data_size)
+               /* Allow non discrete adjustement to avoid loosing capacity */
+               qos->data_size.value = sysctl_max_tx_data_size;
 }
 
 /*

Reply via email to