lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 06 Aug 2021 16:30:42 -0600
From:   subashab@...eaurora.org
To:     Aleksander Morgado <aleksander@...ksander.es>,
        Bjørn Mork <bjorn@...k.no>
Cc:     Daniele Palmas <dnlplm@...il.com>,
        Network Development <netdev@...r.kernel.org>,
        Sean Tranchetti <stranche@...eaurora.org>
Subject: Re: RMNET QMAP data aggregation with size greater than 16384

> That default fixed size you're suggesting for the rx_urb_size, isn't
> it supposed to have the same logical meaning as RMNET_MAX_PACKET_SIZE
> at the end?

RMNET_MAX_PACKET_SIZE is the maximum size for uplink. I probably should 
have
named it more clearly. We would need a different value for downlink.

>> Yes, I think it would be good to make the driver DTRT automatically.
>> Coding driver specific quirks into ModemManager might work, but it 
>> feels
>> wrong to work around a Linux driver bug. We don't have to do that.  We
>> can fix the driver.
>> Why can't we break the rx_urb_size dependency on MTU automatically 
>> when
>> pass_through or qmi_wwan internal muxing is enabled? Preferably with
>> some fixed default size which would Just Work for everyone.
>> 
> 

Would something like this work-

diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index 6a2e4f8..c49827e 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -75,6 +75,8 @@ struct qmimux_priv {
         u8 mux_id;
  };

+#define MAP_DL_URB_SIZE (32768)
+
  static int qmimux_open(struct net_device *dev)
  {
         struct qmimux_priv *priv = netdev_priv(dev);
@@ -303,6 +305,33 @@ static void qmimux_unregister_device(struct 
net_device *dev,
         dev_put(real_dev);
  }

+static int qmi_wwan_change_mtu(struct net_device *net, int new_mtu)
+{
+       struct usbnet *dev = netdev_priv(net);
+       struct qmi_wwan_state *info = (void *)&dev->data;
+       int old_rx_urb_size = dev->rx_urb_size;
+
+       /* mux and pass through modes use a fixed rx_urb_size and the 
value
+        * is independent of mtu
+        */
+       if (info->flags & (QMI_WWAN_FLAG_MUX | 
QMI_WWAN_FLAG_PASS_THROUGH)) {
+               if (old_rx_urb_size == MAP_DL_URB_SIZE)
+                       return 0;
+
+               if (old_rx_urb_size < MAP_DL_URB_SIZE) {
+                       usbnet_pause_rx(dev);
+                       usbnet_unlink_rx_urbs(dev);
+                       usbnet_resume_rx(dev);
+                       usbnet_update_max_qlen(dev);
+               }
+
+               return 0;
+       }
+
+       /* rawip mode uses existing logic of setting rx_urb_size based 
on mtu */
+       return usbnet_change_mtu(net, new_mtu);
+}
+
  static void qmi_wwan_netdev_setup(struct net_device *net)
  {
         struct usbnet *dev = netdev_priv(net);
@@ -326,7 +355,7 @@ static void qmi_wwan_netdev_setup(struct net_device 
*net)
         }

         /* recalculate buffers after changing hard_header_len */
-       usbnet_change_mtu(net, net->mtu);
+       qmi_wwan_change_mtu(net, net->mtu);
  }

  static ssize_t raw_ip_show(struct device *d, struct device_attribute 
*attr, char *buf)
@@ -433,6 +462,7 @@ static ssize_t add_mux_store(struct device *d,  
struct device_attribute *attr, c
         if (!ret) {
                 info->flags |= QMI_WWAN_FLAG_MUX;
                 ret = len;
+               qmi_wwan_change_mtu(dev->net, dev->net->mtu);
         }
  err:
         rtnl_unlock();
@@ -514,6 +544,8 @@ static ssize_t pass_through_store(struct device *d,
         else
                 info->flags &= ~QMI_WWAN_FLAG_PASS_THROUGH;

+       qmi_wwan_change_mtu(dev->net, dev->net->mtu);
+
         return len;
  }

@@ -643,7 +675,7 @@ static const struct net_device_ops 
qmi_wwan_netdev_ops = {
         .ndo_stop               = usbnet_stop,
         .ndo_start_xmit         = usbnet_start_xmit,
         .ndo_tx_timeout         = usbnet_tx_timeout,
-       .ndo_change_mtu         = usbnet_change_mtu,
+       .ndo_change_mtu         = qmi_wwan_change_mtu,
         .ndo_get_stats64        = dev_get_tstats64,
         .ndo_set_mac_address    = qmi_wwan_mac_addr,
         .ndo_validate_addr      = eth_validate_addr,

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ