@@ -182,8 +182,11 @@
/* Number of Tx descriptor registers. */
#define NUM_TX_DESC 4
-/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).*/
-#define MAX_ETH_FRAME_SIZE 1536
+/* max supported ethernet frame size -- must be at least (dev->mtu+14+4).
+ * Whilst the 8139 datasheets suggest that "4k" frames can be received,
+ * this figure has been derived impirically using 8139B and 8139D hardware.
+ */
+#define MAX_ETH_FRAME_SIZE 1736
/* Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4). */
#define TX_BUF_SIZE MAX_ETH_FRAME_SIZE
@@ -639,6 +642,7 @@
static int rtl8139_set_mac_address(struct net_device *dev, void *p);
static int rtl8139_poll(struct napi_struct *napi, int budget);
static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance);
+static int rtl8139_change_mtu (struct net_device *dev, int new_mtu);
static int rtl8139_close (struct net_device *dev);
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static struct net_device_stats *rtl8139_get_stats (struct net_device *dev);
@@ -912,7 +916,7 @@
.ndo_open = rtl8139_open,
.ndo_stop = rtl8139_close,
.ndo_get_stats = rtl8139_get_stats,
- .ndo_change_mtu = eth_change_mtu,
+ .ndo_change_mtu = rtl8139_change_mtu,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = rtl8139_set_mac_address,
.ndo_start_xmit = rtl8139_start_xmit,
@@ -924,6 +928,14 @@
#endif
};
+static int rtl8139_change_mtu(struct net_device *dev, int new_mtu)
+{
+ if (new_mtu < 68 || new_mtu > (MAX_ETH_FRAME_SIZE - 36))
+ return -EINVAL;
+ dev->mtu = new_mtu;
+ return 0;
+}
+
static int __devinit rtl8139_init_one (struct pci_dev *pdev,
const struct pci_device_id *ent)
{