Skip to content

Commit c61fcc0

Browse files
committed
Merge branch 'mana-jumbo-frames'
Haiyang Zhang says: ==================== net: mana: Add support for jumbo frame The set adds support for jumbo frame, with some optimization for the RX path. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents e473ea8 + 80f6215 commit c61fcc0

File tree

4 files changed

+346
-90
lines changed

4 files changed

+346
-90
lines changed

drivers/net/ethernet/microsoft/mana/mana_bpf.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,6 @@ u32 mana_run_xdp(struct net_device *ndev, struct mana_rxq *rxq,
133133
return act;
134134
}
135135

136-
static unsigned int mana_xdp_fraglen(unsigned int len)
137-
{
138-
return SKB_DATA_ALIGN(len) +
139-
SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
140-
}
141-
142136
struct bpf_prog *mana_xdp_get(struct mana_port_context *apc)
143137
{
144138
ASSERT_RTNL();
@@ -179,17 +173,18 @@ static int mana_xdp_set(struct net_device *ndev, struct bpf_prog *prog,
179173
{
180174
struct mana_port_context *apc = netdev_priv(ndev);
181175
struct bpf_prog *old_prog;
182-
int buf_max;
176+
struct gdma_context *gc;
177+
178+
gc = apc->ac->gdma_dev->gdma_context;
183179

184180
old_prog = mana_xdp_get(apc);
185181

186182
if (!old_prog && !prog)
187183
return 0;
188184

189-
buf_max = XDP_PACKET_HEADROOM + mana_xdp_fraglen(ndev->mtu + ETH_HLEN);
190-
if (prog && buf_max > PAGE_SIZE) {
191-
netdev_err(ndev, "XDP: mtu:%u too large, buf_max:%u\n",
192-
ndev->mtu, buf_max);
185+
if (prog && ndev->mtu > MANA_XDP_MTU_MAX) {
186+
netdev_err(ndev, "XDP: mtu:%u too large, mtu_max:%lu\n",
187+
ndev->mtu, MANA_XDP_MTU_MAX);
193188
NL_SET_ERR_MSG_MOD(extack, "XDP: mtu too large");
194189

195190
return -EOPNOTSUPP;
@@ -206,6 +201,11 @@ static int mana_xdp_set(struct net_device *ndev, struct bpf_prog *prog,
206201
if (apc->port_is_up)
207202
mana_chn_setxdp(apc, prog);
208203

204+
if (prog)
205+
ndev->max_mtu = MANA_XDP_MTU_MAX;
206+
else
207+
ndev->max_mtu = gc->adapter_mtu - ETH_HLEN;
208+
209209
return 0;
210210
}
211211

0 commit comments

Comments
 (0)