s2io: add dynamic LRO disable support
Subsystems (2)
PATCH 1/2 s2io: add dynamic LRO disable support
This patch adds dynamic LRO diable support for s2io net driver.
I don't have s2io card, so only did compiling test. Anyone who wants to test this is more than welcome.
This is based on Neil's initial work.
---
drivers/net/s2io.c +31 -0
@@ -6684,6 +6684,35 @@ static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data)return 0 ; } +static int s2io_ethtool_set_flags (struct net_device *dev,u32 data) +{ +struct s2io_nic *sp =netdev_priv (dev); +int rc =0 ; +int changed =0 ; + +if (data Ð_FLAG_LRO ) { +if (lro_enable) { +if (!(dev->features &NETIF_F_LRO )) { + dev->features |=NETIF_F_LRO ; + changed =1 ; + } + }else + rc = -EINVAL ; + }else if (dev->features &NETIF_F_LRO ) { + dev->features &= ~NETIF_F_LRO ; + changed =1 ; + } + +if (changed &&netif_running (dev)) { +s2io_stop_all_tx_queue (sp); +s2io_card_down (sp); + sp->lro = dev->features &NETIF_F_LRO ; + rc =s2io_card_up (sp); +s2io_start_all_tx_queue (sp); + } + +return rc; +}static const struct ethtool_ops netdev_ethtool_ops = { .get_settings = s2io_ethtool_gset,
@@ -6701,6 +6730,8 @@ static const struct ethtool_ops netdev_ethtool_ops = { .get_rx_csum = s2io_ethtool_get_rx_csum, .set_rx_csum = s2io_ethtool_set_rx_csum, .set_tx_csum = s2io_ethtool_op_set_tx_csum, + .set_flags = s2io_ethtool_set_flags, + .get_flags = ethtool_op_get_flags, .set_sg = ethtool_op_set_sg, .get_tso = s2io_ethtool_op_get_tso, .set_tso = s2io_ethtool_op_set_tso,
PATCH 2/2 mlx4: add dynamic LRO disable support
This patch adds dynamic LRO diable support for mlx4 net driver. It also fixes a bug of mlx4, which checks NETIF_F_LRO flag in rx path without rtnl lock.
I don't have mlx4 card, so only did compiling test. Anyone who wants to test this is more than welcome.
This is based on Neil's initial work too.
---
drivers/net/mlx4/en_ethtool.c +34 -1
@@ -387,6 +387,39 @@ static void mlx4_en_get_ringparam(struct net_device *dev, param->tx_pending = mdev->profile.prof[priv->port].tx_ring_size; } +static int mlx4_ethtool_op_set_flags (struct net_device *dev,u32 data) +{ +struct mlx4_en_priv *priv =netdev_priv (dev); +struct mlx4_en_dev *mdev = priv->mdev; +int rc =0 ; +int changed =0 ; +static int old_num_lro; + +if (data Ð_FLAG_LRO ) { +if (!(dev->features &NETIF_F_LRO )) { + dev->features |=NETIF_F_LRO ; + changed =1 ; + mdev->profile.num_lro = old_num_lro; + } + }else if (dev->features &NETIF_F_LRO ) { + dev->features &= ~NETIF_F_LRO ; + changed =1 ; + old_num_lro = mdev->profile.num_lro; + mdev->profile.num_lro =0 ; + } + +if (changed &&netif_running (dev)) { +mutex_lock (&mdev->state_lock); +mlx4_en_stop_port (dev); + rc =mlx4_en_start_port (dev); +if (rc) +en_err (priv,"Failed to restart port\n" ); +mutex_unlock (&mdev->state_lock); + } + +return rc; +} +const struct ethtool_ops mlx4_en_ethtool_ops = { .get_drvinfo = mlx4_en_get_drvinfo, .get_settings = mlx4_en_get_settings,
@@ -415,7 +448,7 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { .get_ringparam = mlx4_en_get_ringparam, .set_ringparam = mlx4_en_set_ringparam, .get_flags = ethtool_op_get_flags, - .set_flags = ethtool_op_set_flags, + .set_flags = mlx4_ethtool_op_set_flags, };
drivers/net/mlx4/en_rx.c +1 -1
@@ -609,7 +609,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud* - without IP options * - not an IP fragment */ if (mlx4_en_can_lro (cqe->status) && - dev->features &NETIF_F_LRO ) { + priv->mdev->profile.num_lro) { nr = mlx4_en_complete_rx_desc( priv, rx_desc,
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 3 lines · Amerigo Wang
This patch adds dynamic LRO diable support for mlx4 net driver. It also fixes a bug of mlx4, which checks
NETIF_F_LROflag in rx path without rtnl lock.
[...]
Is that flag test actually unsafe - and if so, how is testing num_lro any better? Perhaps access to net_device::features should be wrapped with ACCESS_ONCE() to ensure that reads and writes are atomic.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 10 lines · Ben Hutchings
Quoted 3 lines · Amerigo Wang
This patch adds dynamic LRO diable support for mlx4 net driver. It also fixes a bug of mlx4, which checks
NETIF_F_LROflag in rx path without rtnl lock.[...]
Is that flag test actually unsafe - and if so, how is testing
num_lroany better? Perhaps access tonet_device::featuresshould be wrapped withACCESS_ONCE()to ensure that reads and writes are atomic.
At least, I don't find there is any race with 'num_lro', thus no lock is needed.
Thanks.
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 7 lines · Cong Wang
Quoted 6 lines · Ben Hutchings
Quoted 3 lines · Amerigo Wang
This patch adds dynamic LRO diable support for mlx4 net driver. It also fixes a bug of mlx4, which checks
NETIF_F_LROflag in rx path without rtnl lock.[...]
Quoted 7 lines
Quoted 4 lines
Is that flag test actually unsafe - and if so, how is testing
num_lroany better? Perhaps access tonet_device::featuresshould be wrapped withACCESS_ONCE()to ensure that reads and writes are atomic.At least, I don't find there is any race with '
num_lro', thus no lock is needed.
In both cases there is a race condition but it is harmless so long as the read and the write are atomic. There is a general assumption in networking code that this is the case for int and long. Personally I would prefer to see this made explicit using ACCESS_ONCE(), but I don't see any specific problem in mlx4 (not that I'm familiar with this driver either).
Now that I look at the patch again, I see you're using a static (i.e. global) variable to 'back up' the non-zero (enabled) value of num_lro. This is introducing a bug! The correct value is apparently set in mlx4_en_get_profile(); you would need to replicate that.
Ben.
Signature · 3 lines
Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 16 lines · Ben Hutchings
Quoted 7 lines · Cong Wang
Quoted 6 lines · Ben Hutchings
Quoted 3 lines · Amerigo Wang
This patch adds dynamic LRO diable support for mlx4 net driver. It also fixes a bug of mlx4, which checks
NETIF_F_LROflag in rx path without rtnl lock.[...]
Quoted 7 lines
Quoted 4 lines
Is that flag test actually unsafe - and if so, how is testing
num_lroany better? Perhaps access tonet_device::featuresshould be wrapped withACCESS_ONCE()to ensure that reads and writes are atomic.At least, I don't find there is any race with '
num_lro', thus no lock is needed.
Quoted 6 lines
In both cases there is a race condition but it is harmless so long as the read and the write are atomic. There is a general assumption in networking code that this is the case for int and long. Personally I would prefer to see this made explicit using
ACCESS_ONCE(), but I don't see any specific problem in mlx4 (not that I'm familiar with this driver either).
Hmm, right, it seems mlx4_en_add() is async too.
I will pick your suggestion.
Quoted 6 lines
Now that I look at the patch again, I see you're using a static (i.e. global) variable to 'back up' the non-zero (enabled) value of
num_lro. This is introducing a bug! The correct value is apparently set inmlx4_en_get_profile(); you would need to replicate that.
Oh, probably, but unfortunately 'num_lro' is static so only visible in en_main.c.
Thanks!
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 8 lines · On Mon, 07 Jun 2010 16:51:49 +0800 Cong Wang <[email protected]> wrote:
Quoted 5 lines
Now that I look at the patch again, I see you're using a static (i.e. global) variable to 'back up' the non-zero (enabled) value of
num_lro. This is introducing a bug! The correct value is apparently set inmlx4_en_get_profile(); you would need to replicate that.Oh, probably, but unfortunately '
num_lro' is static so only visible inen_main.c.
So just remove "static" and make it global :-)
Stanislaw
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 9 lines · Stanislaw Gruszka
Quoted 6 lines · On Mon, 07 Jun 2010 16:51:49 +0800 Cong Wang<[email protected]> wrote:
Quoted 5 lines
Now that I look at the patch again, I see you're using a static (i.e. global) variable to 'back up' the non-zero (enabled) value of
num_lro. This is introducing a bug! The correct value is apparently set inmlx4_en_get_profile(); you would need to replicate that.
Quoted 5 lines
Quoted 2 lines
Oh, probably, but unfortunately '
num_lro' is static so only visible inen_main.c.So just remove "static" and make it global :-)
Not that easy, it is defined with a macro which is also used by other parameters. :-/
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
In reply to Ben HutchingsQuoted 16 lines · Ben Hutchings
Quoted 7 lines · Cong Wang
Quoted 6 lines · Ben Hutchings
Quoted 3 lines · Amerigo Wang
This patch adds dynamic LRO diable support for mlx4 net driver. It also fixes a bug of mlx4, which checks
NETIF_F_LROflag in rx path without rtnl lock.[...]
Quoted 7 lines
Quoted 4 lines
Is that flag test actually unsafe - and if so, how is testing
num_lroany better? Perhaps access tonet_device::featuresshould be wrapped withACCESS_ONCE()to ensure that reads and writes are atomic.At least, I don't find there is any race with '
num_lro', thus no lock is needed.
Quoted 6 lines
In both cases there is a race condition but it is harmless so long as the read and the write are atomic. There is a general assumption in networking code that this is the case for int and long. Personally I would prefer to see this made explicit using
ACCESS_ONCE(), but I don't see any specific problem in mlx4 (not that I'm familiar with this driver either).
I read this email again.
I think you misunderstood the race condition here. Even read and write are atomic here, the race still exists. One can just set NETIF_F_LRO asynchronously right before mlx4 check this flag in mlx4_en_process_rx_cq() which doesn't take rtnl_lock.
Also, I don't think ACCESS_ONCE() can make things atomic here.
Am I missing something?
Thanks.
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Hi Amerigo
Sorry for being silent in this thread before.
Quoted 15 lines · Cong Wang
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Is that flag test actually unsafe - and if so, how is testing
num_lroany better? Perhaps access tonet_device::featuresshould be wrapped withACCESS_ONCE()to ensure that reads and writes are atomic.At least, I don't find there is any race with '
num_lro', thus no lock is needed.Quoted 6 lines
In both cases there is a race condition but it is harmless so long as the read and the write are atomic. There is a general assumption in networking code that this is the case for int and long. Personally I would prefer to see this made explicit using
ACCESS_ONCE(), but I don't see any specific problem in mlx4 (not that I'm familiar with this driver either).
Quoted 6 lines
I read this email again.
I think you misunderstood the race condition here. Even read and write are atomic here, the race still exists. One can just set
NETIF_F_LROasynchronously right before mlx4 check this flag inmlx4_en_process_rx_cq()which doesn't takertnl_lock.
If so, it's better to stop device before modify LRO settings. I suggest something like that in mlx4_ethtool_op_set_flags:
if (!!(data & ETH_FLAG_LRO) != !!(dev->features & NETIF_F_LRO)) {
/* Need to toggle LRO */
if (netdev_running(dev)) {
mutex_lock(&mdev->state_lock);
mlx4_en_stop_port(dev);
rc = mlx4_en_start_port(dev);
if (rc)
en_err(priv, "Failed to restart port\n");
}
dev->features ^= NETIF_F_LRO;
if (netdev_running(dev))
mutex_unlock(&mdev->state_lock);
}Stanislaw
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 27 lines · Stanislaw Gruszka
Hi Amerigo
Sorry for being silent in this thread before.
Quoted 15 lines · Cong Wang
Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Is that flag test actually unsafe - and if so, how is testing
num_lroany better? Perhaps access tonet_device::featuresshould be wrapped withACCESS_ONCE()to ensure that reads and writes are atomic.At least, I don't find there is any race with '
num_lro', thus no lock is needed.Quoted 6 lines
In both cases there is a race condition but it is harmless so long as the read and the write are atomic. There is a general assumption in networking code that this is the case for int and long. Personally I would prefer to see this made explicit using
ACCESS_ONCE(), but I don't see any specific problem in mlx4 (not that I'm familiar with this driver either).Quoted 6 lines
I read this email again.
I think you misunderstood the race condition here. Even read and write are atomic here, the race still exists. One can just set
NETIF_F_LROasynchronously right before mlx4 check this flag inmlx4_en_process_rx_cq()which doesn't takertnl_lock.
Quoted 4 lines
If so, it's better to stop device before modify LRO settings. I suggest something like that in
mlx4_ethtool_op_set_flags:if (!!(data&
ETH_FLAG_LRO) != !!(dev->features&NETIF_F_LRO)) {
What does this line mean? This is to ignore all other flags, right?
Quoted 7 lines
/* Need to toggle LRO */
if (netdev_running(dev)) {
mutex_lock(&mdev->state_lock);
mlx4_en_stop_port(dev);
rc = mlx4_en_start_port(dev);
if (rc)Quoted 9 lines
en_err(priv, "Failed to restart port\n");
}
dev->features ^= NETIF_F_LRO;
if (netdev_running(dev))
mutex_unlock(&mdev->state_lock);
}I don't think mdev->state_lock is used to protect dev->feature. rtnl_lock is. I think switching to mlx4_ethtool_op_set_flags() from the default one has already solved this.
Thanks!
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 6 lines · On Tue, 15 Jun 2010 16:53:27 +0800 Cong Wang <[email protected]> wrote:
Quoted 4 lines
If so, it's better to stop device before modify LRO settings. I suggest something like that in
mlx4_ethtool_op_set_flags:if (!!(data&
ETH_FLAG_LRO) != !!(dev->features&NETIF_F_LRO)) {What does this line mean? This is to ignore all other flags, right?
Yes, plus check if we are really changing current settings.
Quoted 12 lines
Quoted 12 lines
/* Need to toggle LRO */ if (netdev_running(dev)) { mutex_lock(&mdev->state_lock); mlx4_en_stop_port(dev); rc = mlx4_en_start_port(dev); if (rc) en_err(priv, "Failed to restart port\n"); } dev->features ^= NETIF_F_LRO;
Quoted 8 lines
Quoted 4 lines
if (netdev_running(dev)) mutex_unlock(&mdev->state_lock); }I don't think
mdev->state_lockis used to protectdev->feature.rtnl_lockis. I think switching tomlx4_ethtool_op_set_flags()from the default one has already solved this.
Ahh, you have right, may intention was use it to stop and start port. Code rather should look like below:
if (netdev_running(dev)) {
mutex_lock(&mdev->state_lock);
mlx4_en_stop_port(dev);
}
dev->features ^= NETIF_F_LRO;
if (netdev_running(dev)) {
rc = mlx4_en_start_port(dev);
mutex_unlock(&mdev->state_lock);
if (rc)
en_err(priv, "Failed to restart port\n");
}Stanislaw
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 36 lines · Stanislaw Gruszka
Quoted 6 lines · On Tue, 15 Jun 2010 16:53:27 +0800 Cong Wang<[email protected]> wrote:
Quoted 4 lines
If so, it's better to stop device before modify LRO settings. I suggest something like that in
mlx4_ethtool_op_set_flags:if (!!(data&
ETH_FLAG_LRO) != !!(dev->features&NETIF_F_LRO)) {What does this line mean? This is to ignore all other flags, right?
Yes, plus check if we are really changing current settings.
Quoted 12 lines
Quoted 12 lines
/* Need to toggle LRO */ if (netdev_running(dev)) { mutex_lock(&mdev->state_lock); mlx4_en_stop_port(dev); rc = mlx4_en_start_port(dev); if (rc) en_err(priv, "Failed to restart port\n"); } dev->features ^= NETIF_F_LRO;Quoted 8 lines
Quoted 4 lines
if (netdev_running(dev)) mutex_unlock(&mdev->state_lock); }I don't think
mdev->state_lockis used to protectdev->feature.rtnl_lockis. I think switching tomlx4_ethtool_op_set_flags()from the default one has already solved this.Ahh, you have right, may intention was use it to stop and start port. Code rather should look like below:
Quoted 14 lines
if (netdev_running(dev)) {
mutex_lock(&mdev->state_lock);
mlx4_en_stop_port(dev);
}
dev->features ^= NETIF_F_LRO;
if (netdev_running(dev)) {
rc = mlx4_en_start_port(dev);
mutex_unlock(&mdev->state_lock);
if (rc)
en_err(priv, "Failed to restart port\n");
}Hmm, you mean ->features should be changed after port is stopped? Why?
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 22 lines · Cong Wang
Quoted 7 lines
Quoted 3 lines
I don't think
mdev->state_lockis used to protectdev->feature.rtnl_lockis. I think switching tomlx4_ethtool_op_set_flags()from the default one has already solved this.Ahh, you have right, may intention was use it to stop and start port. Code rather should look like below:
Quoted 14 lines
if (netdev_running(dev)) { mutex_lock(&mdev->state_lock); mlx4_en_stop_port(dev); } dev->features ^= NETIF_F_LRO; if (netdev_running(dev)) { rc = mlx4_en_start_port(dev); mutex_unlock(&mdev->state_lock); if (rc) en_err(priv, "Failed to restart port\n"); }
Quoted 1 line
Hmm, you mean ->features should be changed after port is stopped?
Actually not ->features variable, but NETIF_F_LRO bit, as only this bit is used in rx path.
Quoted 1 line
Why?
For reasons you talked before in this thread :) to do not change LRO in the middle of receiving packages.
Stanislaw
Re: [Patch 2/2] mlx4: add dynamic LRO disable support
Quoted 23 lines · Stanislaw Gruszka
Quoted 22 lines · Cong Wang
Quoted 21 lines
Quoted 3 lines
I don't think
mdev->state_lockis used to protectdev->feature.rtnl_lockis. I think switching tomlx4_ethtool_op_set_flags()from the default one has already solved this.Ahh, you have right, may intention was use it to stop and start port. Code rather should look like below:
if (netdev_running(dev)) { mutex_lock(&mdev->state_lock); mlx4_en_stop_port(dev); } dev->features ^= NETIF_F_LRO; if (netdev_running(dev)) { rc = mlx4_en_start_port(dev); mutex_unlock(&mdev->state_lock); if (rc) en_err(priv, "Failed to restart port\n"); }
Quoted 5 lines
Quoted 1 line
Hmm, you mean ->features should be changed after port is stopped?
Actually not ->features variable, but
NETIF_F_LRObit, as only this bit is used in rx path.
Yeah, this is what I meant.
Quoted 5 lines
Quoted 1 line
Why?
For reasons you talked before in this thread :) to do not change LRO in the middle of receiving packages.
Ohh... I missed this, seems reasonable, will fix this in the next update.
Thanks.
[adding Ram Vepa to CC]
Quoted 68 lines · On Wed, 2 Jun 2010 23:38:59 -0400 Amerigo Wang wrote:
This patch adds dynamic LRO diable support for s2io net driver.
I don't have s2io card, so only did compiling test. Anyone who wants to test this is more than welcome.
This is based on Neil's initial work.
Signed-off-by WANG Cong <[email protected]>Signed-off-by Neil Horman <[email protected]>Acked-by Neil Horman <[email protected]>Reviewed-by Stanislaw Gruszka <[email protected]>---
drivers/net/s2io.c +31
-1@@ -6684,6 +6684,35 @@ static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) return 0; } +static int s2io_ethtool_set_flags (struct net_device *dev,u32 data) +{ +struct s2io_nic *sp =netdev_priv (dev); +int rc =0 ; +int changed =0 ; + +if (data Ð_FLAG_LRO ) { +if (lro_enable) { +if (!(dev->features &NETIF_F_LRO )) { + dev->features |=NETIF_F_LRO ; + changed =1 ; + } + }else + rc = -EINVAL ; + }else if (dev->features &NETIF_F_LRO ) { + dev->features &= ~NETIF_F_LRO ; + changed =1 ; + } + +if (changed &&netif_running (dev)) { +s2io_stop_all_tx_queue (sp); +s2io_card_down (sp); + sp->lro = dev->features &NETIF_F_LRO ; + rc =s2io_card_up (sp); +s2io_start_all_tx_queue (sp); + } + +return rc; +}static const struct ethtool_ops netdev_ethtool_ops = { .get_settings = s2io_ethtool_gset,@@ -6701,6 +6730,8 @@ static const struct ethtool_ops netdev_ethtool_ops = { .get_rx_csum = s2io_ethtool_get_rx_csum, .set_rx_csum = s2io_ethtool_set_rx_csum, .set_tx_csum = s2io_ethtool_op_set_tx_csum, + .set_flags = s2io_ethtool_set_flags, + .get_flags = ethtool_op_get_flags, .set_sg = ethtool_op_set_sg, .get_tso = s2io_ethtool_op_get_tso, .set_tso = s2io_ethtool_op_set_tso, --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines
drivers/net/s2io.c +14
-0+static int s2io_ethtool_set_flags (struct net_device *dev,u32 data) +{ +struct s2io_nic *sp =netdev_priv (dev); +int rc =0 ; +int changed =0 ; + +if (data Ð_FLAG_LRO ) { +if (lro_enable) { +if (!(dev->features &NETIF_F_LRO )) { + dev->features |=NETIF_F_LRO ; + changed =1 ; + } + }else + rc = -EINVAL ;
drivers/net/s2io.c static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) · line 6710
Quoted 10 lines
drivers/net/s2io.c +10
-0+ }else if (dev->features &NETIF_F_LRO ) { + dev->features &= ~NETIF_F_LRO ; + changed =1 ; + } + +if (changed &&netif_running (dev)) { +s2io_stop_all_tx_queue (sp); +s2io_card_down (sp); + sp->lro = dev->features &NETIF_F_LRO ; + rc =s2io_card_up (sp);
In s2io_card_up, update ring->lro too as it is used in the fast path -
struct ring_info *ring = &mac_control->rings[i];
ring->mtu = dev->mtu;
+ ring->lro = sp->lro;
drivers/net/s2io.c static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) · line 6711
Quoted 1 line
drivers/net/s2io.c +1
-0+s2io_start_all_tx_queue (sp);
The following line in init_shared_mem() is redundant and can be removed.
- ring->lro = lro_enable;
Thanks,
Ram
Quoted 29 lines · Ramkrishna Vepa
Quoted 14 lines
drivers/net/s2io.c +14
-0+static int s2io_ethtool_set_flags (struct net_device *dev,u32 data) +{ +struct s2io_nic *sp =netdev_priv (dev); +int rc =0 ; +int changed =0 ; + +if (dataÐ_FLAG_LRO ) { +if (lro_enable) { +if (!(dev->features&NETIF_F_LRO )) { + dev->features |=NETIF_F_LRO ; + changed =1 ; + } + }else + rc = -EINVAL ;drivers/net/s2io.c static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) · line 6710
Quoted 10 lines
drivers/net/s2io.c +10
-0+ }else if (dev->features&NETIF_F_LRO ) { + dev->features&= ~NETIF_F_LRO ; + changed =1 ; + } + +if (changed&&netif_running (dev)) { +s2io_stop_all_tx_queue (sp); +s2io_card_down (sp); + sp->lro = dev->features&NETIF_F_LRO ; + rc =s2io_card_up (sp);In
s2io_card_up, updatering->lrotoo as it is used in the fast path -struct ring_info *ring =&mac_control->rings[i];ring->mtu = dev->mtu;
Review
Quoted 1 line
(quoted diff) +1
-0+ ring->lro = sp->lro;
Yeah, I missed this important part.
Review
Quoted 5 lines
drivers/net/s2io.c static int s2io_ethtool_op_set_tso(struct net_device *dev, u32 data) · line 6711
Quoted 1 line
drivers/net/s2io.c +1
-0+s2io_start_all_tx_queue (sp);The following line in
init_shared_mem()is redundant and can be removed.(quoted diff) +0
-1- ring->lro = lro_enable;
Okay.
I will send an updated version soon.
Thanks a lot!