diff options
Diffstat (limited to 'net/dsa/master.c')
-rw-r--r-- | net/dsa/master.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/dsa/master.c b/net/dsa/master.c index c90ee3227dea..42f525bc68e2 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c | |||
@@ -158,8 +158,24 @@ static void dsa_master_ethtool_teardown(struct net_device *dev) | |||
158 | cpu_dp->orig_ethtool_ops = NULL; | 158 | cpu_dp->orig_ethtool_ops = NULL; |
159 | } | 159 | } |
160 | 160 | ||
161 | void dsa_master_set_mtu(struct net_device *dev, struct dsa_port *cpu_dp) | ||
162 | { | ||
163 | unsigned int mtu = ETH_DATA_LEN + cpu_dp->tag_ops->overhead; | ||
164 | int err; | ||
165 | |||
166 | rtnl_lock(); | ||
167 | if (mtu <= dev->max_mtu) { | ||
168 | err = dev_set_mtu(dev, mtu); | ||
169 | if (err) | ||
170 | netdev_dbg(dev, "Unable to set MTU to include for DSA overheads\n"); | ||
171 | } | ||
172 | rtnl_unlock(); | ||
173 | } | ||
174 | |||
161 | int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) | 175 | int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) |
162 | { | 176 | { |
177 | dsa_master_set_mtu(dev, cpu_dp); | ||
178 | |||
163 | /* If we use a tagging format that doesn't have an ethertype | 179 | /* If we use a tagging format that doesn't have an ethertype |
164 | * field, make sure that all packets from this point on get | 180 | * field, make sure that all packets from this point on get |
165 | * sent to the tag format's receive function. | 181 | * sent to the tag format's receive function. |