/** * dev_add_offload - register offload handlers * @po: protocol offload declaration * * Add protocol offload handlers to the networking stack. The passed * &proto_offload is linked into kernel lists and may not be freed until * it has been removed from the kernel lists. * * This call does not sleep therefore it can not * guarantee all CPU's that are in middle of receiving packets * will see the new offload handlers (until the next received packet).
*/ void dev_add_offload(struct packet_offload *po)
{ struct packet_offload *elem;
/** * __dev_remove_offload - remove offload handler * @po: packet offload declaration * * Remove a protocol offload handler that was previously added to the * kernel offload handlers by dev_add_offload(). The passed &offload_type * is removed from the kernel lists and can be freed or reused once this * function returns. * * The packet type might still be in use by receivers * and must not be freed until after all the CPU's have gone * through a quiescent state.
*/ staticvoid __dev_remove_offload(struct packet_offload *po)
{ struct list_head *head = &net_hotdata.offload_base; struct packet_offload *po1;
spin_lock(&offload_lock);
list_for_each_entry(po1, head, list) { if (po == po1) {
list_del_rcu(&po->list); goto out;
}
}
pr_warn("dev_remove_offload: %p not found\n", po);
out:
spin_unlock(&offload_lock);
}
/** * dev_remove_offload - remove packet offload handler * @po: packet offload declaration * * Remove a packet offload handler that was previously added to the kernel * offload handlers by dev_add_offload(). The passed &offload_type is * removed from the kernel lists and can be freed or reused once this * function returns. * * This call sleeps to guarantee that no CPU is looking at the packet * type after return.
*/ void dev_remove_offload(struct packet_offload *po)
{
__dev_remove_offload(po);
/* Do not splice page pool based packets w/ non-page pool * packets. This can result in reference count issues as page * pool pages will not decrement the reference count and will * instead be immediately returned to the pool or have frag * count decremented.
*/ if (p->pp_recycle != skb->pp_recycle) return -ETOOMANYREFS;
if (unlikely(p->len + len >= netif_get_gro_max_size(p->dev, p) ||
NAPI_GRO_CB(skb)->flush)) return -E2BIG;
if (unlikely(p->len + len >= GRO_LEGACY_MAX_SIZE)) { if (NAPI_GRO_CB(skb)->proto != IPPROTO_TCP ||
(p->protocol == htons(ETH_P_IPV6) &&
skb_headroom(p) < sizeof(struct hop_jumbo_hdr)) ||
p->encapsulation) return -E2BIG;
}
if (!gro->hash[index].count)
__clear_bit(index, &gro->bitmask);
}
/* * gro->hash[].list contains packets ordered by age. * youngest packets at the head of it. * Complete skbs in reverse order to reduce latencies.
*/ void __gro_flush(struct gro_node *gro, bool flush_old)
{ unsignedlong bitmask = gro->bitmask; unsignedint i, base = ~0U;
while ((i = ffs(bitmask)) != 0) {
bitmask >>= i;
base += i;
__gro_flush_chain(gro, base, flush_old);
}
}
EXPORT_SYMBOL(__gro_flush);
/* in most common scenarios 'slow_gro' is 0 * otherwise we are already on some slower paths * either skip all the infrequent tests altogether or * avoid trying too hard to skip each of them individually
*/ if (!diffs && unlikely(skb->slow_gro | p->slow_gro)) {
diffs |= p->sk != skb->sk;
diffs |= skb_metadata_dst_cmp(p, skb);
diffs |= skb_get_nfct(p) ^ skb_get_nfct(skb);
case GRO_MERGED_FREE: if (NAPI_GRO_CB(skb)->free == NAPI_GRO_FREE_STOLEN_HEAD)
napi_skb_free_stolen_head(skb); else
napi_reuse_skb(napi, skb); break;
case GRO_MERGED: case GRO_CONSUMED: break;
}
return ret;
}
/* Upper GRO stack assumes network header starts at gro_offset=0 * Drivers could call both napi_gro_frags() and napi_gro_receive() * We copy ethernet header into skb->data to have a common layout.
*/ staticstruct sk_buff *napi_frags_skb(struct napi_struct *napi)
{ struct sk_buff *skb = napi->skb; conststruct ethhdr *eth; unsignedint hlen = sizeof(*eth);
/* * This works because the only protocols we care about don't require * special handling. * We'll fix it up properly in napi_frags_finish()
*/
skb->protocol = eth->h_proto;
ret = napi_frags_finish(napi, skb, dev_gro_receive(&napi->gro, skb));
trace_napi_gro_frags_exit(ret);
return ret;
}
EXPORT_SYMBOL(napi_gro_frags);
/* Compute the checksum from gro_offset and return the folded value * after adding in any pseudo checksum.
*/
__sum16 __skb_gro_checksum_complete(struct sk_buff *skb)
{
__wsum wsum;
__sum16 sum;
for (u32 i = 0; i < GRO_HASH_BUCKETS; i++) {
list_for_each_entry_safe(skb, n, &gro->hash[i].list, list)
kfree_skb(skb);
gro->hash[i].count = 0;
}
gro->bitmask = 0;
gro->cached_napi_id = 0;
list_for_each_entry_safe(skb, n, &gro->rx_list, list)
kfree_skb(skb);
gro->rx_count = 0;
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.25Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-05)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.