Commit 3a0c7d2d authored by Brice Goglin's avatar Brice Goglin Committed by David S. Miller

myri10ge: allow LRO to be enabled via ethtool

Allow myri10ge LRO to be enabled/disabled via ethtool
(and by the stack for packet forwarding).
Signed-off-by: default avatarBrice Goglin <brice@myri.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ab35cd4b
...@@ -1300,7 +1300,7 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, struct myri10ge_rx_buf *rx, ...@@ -1300,7 +1300,7 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, struct myri10ge_rx_buf *rx,
remainder -= MYRI10GE_ALLOC_SIZE; remainder -= MYRI10GE_ALLOC_SIZE;
} }
if (mgp->csum_flag && myri10ge_lro) { if (dev->features & NETIF_F_LRO) {
rx_frags[0].page_offset += MXGEFW_PAD; rx_frags[0].page_offset += MXGEFW_PAD;
rx_frags[0].size -= MXGEFW_PAD; rx_frags[0].size -= MXGEFW_PAD;
len -= MXGEFW_PAD; len -= MXGEFW_PAD;
...@@ -1716,12 +1716,17 @@ static u32 myri10ge_get_rx_csum(struct net_device *netdev) ...@@ -1716,12 +1716,17 @@ static u32 myri10ge_get_rx_csum(struct net_device *netdev)
static int myri10ge_set_rx_csum(struct net_device *netdev, u32 csum_enabled) static int myri10ge_set_rx_csum(struct net_device *netdev, u32 csum_enabled)
{ {
struct myri10ge_priv *mgp = netdev_priv(netdev); struct myri10ge_priv *mgp = netdev_priv(netdev);
int err = 0;
if (csum_enabled) if (csum_enabled)
mgp->csum_flag = MXGEFW_FLAGS_CKSUM; mgp->csum_flag = MXGEFW_FLAGS_CKSUM;
else else {
u32 flags = ethtool_op_get_flags(netdev);
err = ethtool_op_set_flags(netdev, (flags & ~ETH_FLAG_LRO));
mgp->csum_flag = 0; mgp->csum_flag = 0;
return 0;
}
return err;
} }
static int myri10ge_set_tso(struct net_device *netdev, u32 tso_enabled) static int myri10ge_set_tso(struct net_device *netdev, u32 tso_enabled)
...@@ -1904,7 +1909,9 @@ static const struct ethtool_ops myri10ge_ethtool_ops = { ...@@ -1904,7 +1909,9 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
.get_sset_count = myri10ge_get_sset_count, .get_sset_count = myri10ge_get_sset_count,
.get_ethtool_stats = myri10ge_get_ethtool_stats, .get_ethtool_stats = myri10ge_get_ethtool_stats,
.set_msglevel = myri10ge_set_msglevel, .set_msglevel = myri10ge_set_msglevel,
.get_msglevel = myri10ge_get_msglevel .get_msglevel = myri10ge_get_msglevel,
.get_flags = ethtool_op_get_flags,
.set_flags = ethtool_op_set_flags
}; };
static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss) static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss)
...@@ -3910,6 +3917,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3910,6 +3917,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (dac_enabled) if (dac_enabled)
netdev->features |= NETIF_F_HIGHDMA; netdev->features |= NETIF_F_HIGHDMA;
if (myri10ge_lro)
netdev->features |= NETIF_F_LRO;
/* make sure we can get an irq, and that MSI can be /* make sure we can get an irq, and that MSI can be
* setup (if available). Also ensure netdev->irq * setup (if available). Also ensure netdev->irq
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment