Skip to content

Commit b0ba357

Browse files
chleroydavem330
authored andcommitted
net: fs_enet: make rx_copybreak value configurable
Measurement shows that on a MPC8xx running at 132MHz, the optimal limit is 112: * 114 bytes packets are processed in 147 TB ticks with higher copybreak * 114 bytes packets are processed in 148 TB ticks with lower copybreak * 128 bytes packets are processed in 154 TB ticks with higher copybreak * 128 bytes packets are processed in 148 TB ticks with lower copybreak * 238 bytes packets are processed in 172 TB ticks with higher copybreak * 238 bytes packets are processed in 148 TB ticks with lower copybreak However it might be different on other processors and/or frequencies. So it is useful to make it configurable. Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 070e1f0 commit b0ba357

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,44 @@ static void fs_set_msglevel(struct net_device *dev, u32 value)
830830
fep->msg_enable = value;
831831
}
832832

833+
static int fs_get_tunable(struct net_device *dev,
834+
const struct ethtool_tunable *tuna, void *data)
835+
{
836+
struct fs_enet_private *fep = netdev_priv(dev);
837+
struct fs_platform_info *fpi = fep->fpi;
838+
int ret = 0;
839+
840+
switch (tuna->id) {
841+
case ETHTOOL_RX_COPYBREAK:
842+
*(u32 *)data = fpi->rx_copybreak;
843+
break;
844+
default:
845+
ret = -EINVAL;
846+
break;
847+
}
848+
849+
return ret;
850+
}
851+
852+
static int fs_set_tunable(struct net_device *dev,
853+
const struct ethtool_tunable *tuna, const void *data)
854+
{
855+
struct fs_enet_private *fep = netdev_priv(dev);
856+
struct fs_platform_info *fpi = fep->fpi;
857+
int ret = 0;
858+
859+
switch (tuna->id) {
860+
case ETHTOOL_RX_COPYBREAK:
861+
fpi->rx_copybreak = *(u32 *)data;
862+
break;
863+
default:
864+
ret = -EINVAL;
865+
break;
866+
}
867+
868+
return ret;
869+
}
870+
833871
static const struct ethtool_ops fs_ethtool_ops = {
834872
.get_drvinfo = fs_get_drvinfo,
835873
.get_regs_len = fs_get_regs_len,
@@ -841,6 +879,8 @@ static const struct ethtool_ops fs_ethtool_ops = {
841879
.get_ts_info = ethtool_op_get_ts_info,
842880
.get_link_ksettings = phy_ethtool_get_link_ksettings,
843881
.set_link_ksettings = phy_ethtool_set_link_ksettings,
882+
.get_tunable = fs_get_tunable,
883+
.set_tunable = fs_set_tunable,
844884
};
845885

846886
static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)

0 commit comments

Comments
 (0)