--- zzzz-none-000/linux-3.10.107/drivers/net/usb/usbnet.c 2017-06-27 09:49:32.000000000 +0000 +++ vr9-7490-729/linux-3.10.107/drivers/net/usb/usbnet.c 2021-11-10 11:53:55.000000000 +0000 @@ -47,6 +47,10 @@ #include #include +#ifdef CONFIG_AVM_PA +#include +#endif + #define DRIVER_VERSION "22-Aug-2005" @@ -337,6 +341,12 @@ if (skb_defer_rx_timestamp(skb)) return; +#if defined(CONFIG_AVM_PA) + if (avm_pa_dev_receive(AVM_PA_DEVINFO(dev->net), skb) == AVM_PA_RX_ACCELERATED) { + return; + } +#endif //defined(CONFIG_AVM_PA) + status = netif_rx (skb); if (status != NET_RX_SUCCESS) netif_dbg(dev, rx_err, dev->net, @@ -1459,6 +1469,60 @@ .name = "wwan", }; +#ifdef CONFIG_AVM_PA +static void pa_dev_transmit(void *arg, struct sk_buff *skb) +{ + int rc; + skb->dev = arg; + rc = dev_queue_xmit(skb); + if((rc & NETDEV_TX_MASK) != NETDEV_TX_OK) { + pr_warn("[%s] pa_dev_transmit(%s) %d", + __func__, + ((struct net_device *)arg)->name, + rc); + } +} +static int setup_avm_pa_eth_dev( struct net_device *dev ) { + /* register avm_pa pid and set hw info */ + struct usbnet *usbdev; + struct avm_pa_pid_cfg *cfg; + struct avm_pa_vpid_cfg *vcfg; + struct avm_pa_pid_hwinfo hwinfo; + int err; + + usbdev = netdev_priv(dev); + pr_err("[%s] dev %s\n", __func__, dev->name); + + cfg = &usbdev->pid_cfg; + memset(cfg, 0, sizeof(*cfg)); + vcfg = &usbdev->vpid_cfg; + memset(vcfg, 0, sizeof(*vcfg)); + + strncpy(cfg->name, dev->name, sizeof(cfg->name)); + cfg->tx_func = &pa_dev_transmit; + cfg->tx_arg = dev; + cfg->default_mtu = 1500; + cfg->framing = avm_pa_framing_dev; + err = avm_pa_dev_pid_register(&dev->avm_pa.devinfo, cfg); + if(err < 0) return err; + + strncpy(vcfg->name, dev->name, sizeof(vcfg->name)); + vcfg->v4_mtu = 1500; + vcfg->v6_mtu = 1500; + err = avm_pa_dev_vpid_register(&dev->avm_pa.devinfo, vcfg); + if (err < 0) goto undo; + + memset(&hwinfo, 0, sizeof(hwinfo)); + err = avm_pa_pid_set_hwinfo( + dev->avm_pa.devinfo.pid_handle, &hwinfo); + +undo: + if (err < 0) + avm_pa_dev_unregister_sync(&dev->avm_pa.devinfo); + return err; +} +#endif + int usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) { @@ -1548,6 +1612,8 @@ if (status < 0) goto out1; +/* --- 20150335 AVM/WK: FIX from 2.6.32: we always want usb0, not eth4 ---*/ +#if 0 // heuristic: "usb%d" for links we know are two-host, // else "eth%d" when there's reasonable doubt. userspace // can rename the link if it knows better. @@ -1555,12 +1621,17 @@ ((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 || (net->dev_addr [0] & 0x02) == 0)) strcpy (net->name, "eth%d"); +#endif + /* WLAN devices should always be named "wlan%d" */ if ((dev->driver_info->flags & FLAG_WLAN) != 0) strcpy(net->name, "wlan%d"); +/* --- 20160922 AVM/WK: also use usb0 for cdc_ncm device --- */ +#if 0 /* WWAN devices should always be named "wwan%d" */ if ((dev->driver_info->flags & FLAG_WWAN) != 0) strcpy(net->name, "wwan%d"); +#endif /* devices that cannot do ARP */ if ((dev->driver_info->flags & FLAG_NOARP) != 0) @@ -1614,6 +1685,10 @@ if (dev->driver_info->flags & FLAG_LINK_INTR) usbnet_link_change(dev, 0, 0); +#ifdef CONFIG_AVM_PA + setup_avm_pa_eth_dev(dev->net); +#endif + return 0; out4: