return -EMSGSIZE;
}
+ /* within MTU? avoid the copy, send original skb */
+ if (skb->len <= mtu) {
+ hdr->flags_seq_tag = MCTP_HDR_FLAG_SOM |
+ MCTP_HDR_FLAG_EOM | tag;
+ return dst->output(dst, skb);
+ }
+
/* keep same headroom as the original skb */
headroom = skb_headroom(skb);
struct mctp_hdr *hdr;
unsigned long flags;
unsigned int netid;
- unsigned int mtu;
mctp_eid_t saddr;
int rc;
u8 tag;
netid = READ_ONCE(dst->dev->net);
if (rc)
- goto out_release;
+ goto err_free;
if (req_tag & MCTP_TAG_OWNER) {
if (req_tag & MCTP_TAG_PREALLOC)
if (IS_ERR(key)) {
rc = PTR_ERR(key);
- goto out_release;
+ goto err_free;
}
mctp_skb_set_flow(skb, key);
/* done with the key in this scope */
hdr->dest = daddr;
hdr->src = saddr;
- mtu = dst->mtu;
-
- if (skb->len + sizeof(struct mctp_hdr) <= mtu) {
- hdr->flags_seq_tag = MCTP_HDR_FLAG_SOM |
- MCTP_HDR_FLAG_EOM | tag;
- rc = dst->output(dst, skb);
- } else {
- rc = mctp_do_fragment_route(dst, skb, mtu, tag);
- }
-
/* route output functions consume the skb, even on error */
- skb = NULL;
+ return mctp_do_fragment_route(dst, skb, dst->mtu, tag);
-out_release:
+err_free:
kfree_skb(skb);
return rc;
}