/* Random bits of netdevice that don't need to be exposed */ #define FLOW_LIMIT_HISTORY (1 << 7) /* must be ^2 and !overflow buckets */ struct sd_flow_limit { struct rcu_head rcu; unsignedint count;
u8 log_buckets; unsignedint history_head;
u16 history[FLOW_LIMIT_HISTORY];
u8 buckets[];
};
/* sysctls not referred to from outside net/core/ */ externint netdev_unregister_timeout_secs; externint weight_p; externint dev_weight_rx_bias; externint dev_weight_tx_bias;
int netdev_get_name(struct net *net, char *name, int ifindex); int netif_change_name(struct net_device *dev, constchar *newname); int dev_change_name(struct net_device *dev, constchar *newname);
int netdev_name_node_alt_create(struct net_device *dev, constchar *name); int netdev_name_node_alt_destroy(struct net_device *dev, constchar *name);
int dev_validate_mtu(struct net_device *dev, int mtu, struct netlink_ext_ack *extack); int netif_set_mtu_ext(struct net_device *dev, int new_mtu, struct netlink_ext_ack *extack);
int dev_get_phys_port_id(struct net_device *dev, struct netdev_phys_item_id *ppid); int dev_get_phys_port_name(struct net_device *dev, char *name, size_t len);
int netif_change_proto_down(struct net_device *dev, bool proto_down); int dev_change_proto_down(struct net_device *dev, bool proto_down); void netdev_change_proto_down_reason_locked(struct net_device *dev, unsignedlong mask, u32 value);
typedefint (*bpf_op_t)(struct net_device *dev, struct netdev_bpf *bpf); int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, int fd, int expected_fd, u32 flags);
int netif_change_tx_queue_len(struct net_device *dev, unsignedlong new_len); int dev_change_tx_queue_len(struct net_device *dev, unsignedlong new_len); void netif_set_group(struct net_device *dev, int new_group); void dev_set_group(struct net_device *dev, int new_group); int netif_change_carrier(struct net_device *dev, bool new_carrier); int dev_change_carrier(struct net_device *dev, bool new_carrier);
if (!netdev_need_ops_lock(dev))
netdev_lock(dev);
dev->up = value; if (!netdev_need_ops_lock(dev))
netdev_unlock(dev);
}
staticinlinevoid netif_set_gso_max_size(struct net_device *dev, unsignedint size)
{ /* dev->gso_max_size is read locklessly from sk_setup_caps() */
WRITE_ONCE(dev->gso_max_size, size); if (size <= GSO_LEGACY_MAX_SIZE)
WRITE_ONCE(dev->gso_ipv4_max_size, size);
}
staticinlinevoid netif_set_gso_max_segs(struct net_device *dev, unsignedint segs)
{ /* dev->gso_max_segs is read locklessly from sk_setup_caps() */
WRITE_ONCE(dev->gso_max_segs, segs);
}
staticinlinevoid netif_set_gro_max_size(struct net_device *dev, unsignedint size)
{ /* This pairs with the READ_ONCE() in skb_gro_receive() */
WRITE_ONCE(dev->gro_max_size, size); if (size <= GRO_LEGACY_MAX_SIZE)
WRITE_ONCE(dev->gro_ipv4_max_size, size);
}
staticinlinevoid netif_set_gso_ipv4_max_size(struct net_device *dev, unsignedint size)
{ /* dev->gso_ipv4_max_size is read locklessly from sk_setup_caps() */
WRITE_ONCE(dev->gso_ipv4_max_size, size);
}
staticinlinevoid netif_set_gro_ipv4_max_size(struct net_device *dev, unsignedint size)
{ /* This pairs with the READ_ONCE() in skb_gro_receive() */
WRITE_ONCE(dev->gro_ipv4_max_size, size);
}
/** * napi_get_defer_hard_irqs - get the NAPI's defer_hard_irqs * @n: napi struct to get the defer_hard_irqs field from * * Return: the per-NAPI value of the defar_hard_irqs field.
*/ staticinline u32 napi_get_defer_hard_irqs(conststruct napi_struct *n)
{ return READ_ONCE(n->defer_hard_irqs);
}
/** * napi_set_defer_hard_irqs - set the defer_hard_irqs for a napi * @n: napi_struct to set the defer_hard_irqs field * @defer: the value the field should be set to
*/ staticinlinevoid napi_set_defer_hard_irqs(struct napi_struct *n, u32 defer)
{
WRITE_ONCE(n->defer_hard_irqs, defer);
}
/** * netdev_set_defer_hard_irqs - set defer_hard_irqs for all NAPIs of a netdev * @netdev: the net_device for which all NAPIs will have defer_hard_irqs set * @defer: the defer_hard_irqs value to set
*/ staticinlinevoid netdev_set_defer_hard_irqs(struct net_device *netdev,
u32 defer)
{ unsignedint count = max(netdev->num_rx_queues,
netdev->num_tx_queues); struct napi_struct *napi; int i;
for (i = 0; i < count; i++)
netdev->napi_config[i].defer_hard_irqs = defer;
}
/** * napi_get_gro_flush_timeout - get the gro_flush_timeout * @n: napi struct to get the gro_flush_timeout from * * Return: the per-NAPI value of the gro_flush_timeout field.
*/ staticinlineunsignedlong
napi_get_gro_flush_timeout(conststruct napi_struct *n)
{ return READ_ONCE(n->gro_flush_timeout);
}
/** * napi_set_gro_flush_timeout - set the gro_flush_timeout for a napi * @n: napi struct to set the gro_flush_timeout * @timeout: timeout value to set * * napi_set_gro_flush_timeout sets the per-NAPI gro_flush_timeout
*/ staticinlinevoid napi_set_gro_flush_timeout(struct napi_struct *n, unsignedlong timeout)
{
WRITE_ONCE(n->gro_flush_timeout, timeout);
}
/** * netdev_set_gro_flush_timeout - set gro_flush_timeout of a netdev's NAPIs * @netdev: the net_device for which all NAPIs will have gro_flush_timeout set * @timeout: the timeout value to set
*/ staticinlinevoid netdev_set_gro_flush_timeout(struct net_device *netdev, unsignedlong timeout)
{ unsignedint count = max(netdev->num_rx_queues,
netdev->num_tx_queues); struct napi_struct *napi; int i;
for (i = 0; i < count; i++)
netdev->napi_config[i].gro_flush_timeout = timeout;
}
/** * napi_get_irq_suspend_timeout - get the irq_suspend_timeout * @n: napi struct to get the irq_suspend_timeout from * * Return: the per-NAPI value of the irq_suspend_timeout field.
*/ staticinlineunsignedlong
napi_get_irq_suspend_timeout(conststruct napi_struct *n)
{ return READ_ONCE(n->irq_suspend_timeout);
}
/** * napi_set_irq_suspend_timeout - set the irq_suspend_timeout for a napi * @n: napi struct to set the irq_suspend_timeout * @timeout: timeout value to set * * napi_set_irq_suspend_timeout sets the per-NAPI irq_suspend_timeout
*/ staticinlinevoid napi_set_irq_suspend_timeout(struct napi_struct *n, unsignedlong timeout)
{
WRITE_ONCE(n->irq_suspend_timeout, timeout);
}
/* Best effort check that NAPI is not idle (can't be scheduled to run) */ staticinlinevoid napi_assert_will_not_race(conststruct napi_struct *napi)
{ /* uninitialized instance, can't race */ if (!napi->poll_list.next) return;
/* SCHED bit is set on disabled instances */
WARN_ON(!test_bit(NAPI_STATE_SCHED, &napi->state));
WARN_ON(READ_ONCE(napi->list_owner) != -1);
}
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.