Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
net/openvswitch/datapath.c
static unsigned int ovs_get_max_headroom(struct datapath *dp) { unsigned int dev_headroom, max_headroom = 0; struct net_device *dev; struct vport *vport; int i; for (i = 0; i < DP_VPORT_HASH_BUCKETS; i++) { hlist_for_each_entry_rcu(vport, &dp->ports[i], dp_hash_node, lockdep...
[ 1, 0 ]
Linux Kernel
net/openvswitch/datapath.c
static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) { struct nlattr **a = info->attrs; struct sk_buff *reply; struct vport *vport; int err; reply = ovs_vport_cmd_alloc_info(); if (!reply) return -ENOMEM; ovs_lock(); vport = lookup_vport(sock_net(skb->sk), info->userhdr, a); ...
[ 1, 0 ]
Linux Kernel
net/openvswitch/datapath.c
static int __net_init ovs_init_net(struct net *net) { struct ovs_net *ovs_net = net_generic(net, ovs_net_id); int err; INIT_LIST_HEAD(&ovs_net->dps); INIT_WORK(&ovs_net->dp_notify_work, ovs_dp_notify_wq); INIT_DELAYED_WORK(&ovs_net->masks_rebalance, ovs_dp_masks_rebalance); err = ovs_ct_init(net); if (...
[ 0, 0 ]
Linux Kernel
net/openvswitch/datapath.c
static void __net_exit ovs_exit_net(struct net *dnet) { struct datapath *dp, *dp_next; struct ovs_net *ovs_net = net_generic(dnet, ovs_net_id); struct vport *vport, *vport_next; struct net *net; LIST_HEAD(head); ovs_lock(); ovs_ct_exit(dnet); list_for_each_entry_safe(dp, dp_next, &ovs_net->dps, list_...
[ 0, 0 ]
Linux Kernel
net/openvswitch/datapath.h
static inline struct vport *ovs_vport_ovsl_rcu(const struct datapath *dp, int port_no) { WARN_ON_ONCE(!rcu_read_lock_held() && !lockdep_ovsl_is_held()); return ovs_lookup_vport(dp, port_no); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/datapath.h
static inline struct datapath *get_dp_rcu(struct net *net, int dp_ifindex) { struct net_device *dev = dev_get_by_index_rcu(net, dp_ifindex); if (dev) { struct vport *vport = ovs_internal_dev_get_vport(dev); if (vport) return vport->dp; } return NULL; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow.c
static bool arphdr_ok(struct sk_buff *skb) { return pskb_may_pull(skb, skb_network_offset(skb) + sizeof(struct arp_eth_header)); }
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow.c
static int check_iphdr(struct sk_buff *skb) { unsigned int nh_ofs = skb_network_offset(skb); unsigned int ip_len; int err; err = check_header(skb, nh_ofs + sizeof(struct iphdr)); if (unlikely(err)) return err; ip_len = ip_hdrlen(skb); if (unlikely(ip_len < sizeof(struct iphdr) || skb->len < nh_ofs ...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow.c
static bool icmphdr_ok(struct sk_buff *skb) { return pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct icmphdr)); }
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow.c
int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key) { int res; res = key_extract(skb, key); if (!res) key->mac_proto &= ~SW_FLOW_KEY_INVALID; return res; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow.h
static inline u8 ovs_key_mac_proto(const struct sw_flow_key *key) { return key->mac_proto & ~SW_FLOW_KEY_INVALID; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow.h
static inline u16 __ovs_mac_header_len(u8 mac_proto) { return mac_proto == MAC_PROTO_ETHERNET ? ETH_HLEN : 0; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow.h
static inline bool ovs_identifier_is_ufid(const struct sw_flow_id *sfid) { return sfid->ufid_len; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
size_t ovs_tun_key_attr_size(void) { return nla_total_size_64bit(8) /* OVS_TUNNEL_KEY_ATTR_ID */ + nla_total_size(16) /* OVS_TUNNEL_KEY_ATTR_IPV[46]_SRC */ + nla_total_size(16) /* OVS_TUNNEL_KEY_ATTR_IPV[46]_DST */ + nla_total_size(1) /* OVS_TUNNEL_KEY_ATTR_TOS */ + nla_...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static size_t ovs_nsh_key_attr_size(void) { return nla_total_size(NSH_BASE_HDR_LEN) /* OVS_NSH_KEY_ATTR_BASE */ /* OVS_NSH_KEY_ATTR_MD1 and OVS_NSH_KEY_ATTR_MD2 are * mutually exclusive, so the bigger one can cover * the small one. */ + nla_total_size(NSH_CTX_HDRS_MAX_...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int genev_tun_opt_from_nlattr(const struct nlattr *a, struct sw_flow_match *match, bool is_mask, bool log) { unsigned long opt_key_offset; if (nla_len(a) > sizeof(match->key->tun_opts)) { OVS_NLERR(log, "Geneve option length err (...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int vxlan_tun_opt_from_nlattr(const struct nlattr *attr, struct sw_flow_match *match, bool is_mask, bool log) { struct nlattr *a; int rem; unsigned long opt_key_offset; struct vxlan_metadata opts; BUILD_BUG_ON(sizeof(opts) > si...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int vxlan_opt_to_nlattr(struct sk_buff *skb, const void *tun_opts, int swkey_tun_opts_len) { const struct vxlan_metadata *opts = tun_opts; struct nlattr *nla; nla = nla_nest_start_noflag(skb, OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS); if (!nla) return -EMSGSIZE; if (nla_put_...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int ip_tun_to_nlattr(struct sk_buff *skb, const struct ip_tunnel_key *output, const void *tun_opts, int swkey_tun_opts_len, unsigned short tun_proto, u8 mode) { struct nlattr *nla; int err; nla = nla_nest_start_noflag(skb...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int parse_vlan_from_nlattrs(struct sw_flow_match *match, u64 *key_attrs, const struct nlattr **a, bool is_mask, bool log) { int err; bool encap_valid = false; err = __parse_vlan_from_nlattrs(match, key_attrs, false, a, is_mask, log); ...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static void mask_set_nlattr(struct nlattr *attr, u8 val) { nlattr_set(attr, val, ovs_key_lens); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
bool ovs_nla_get_ufid(struct sw_flow_id *sfid, const struct nlattr *attr, bool log) { sfid->ufid_len = get_ufid_len(attr, log); if (sfid->ufid_len) memcpy(sfid->ufid, nla_data(attr), sfid->ufid_len); return sfid->ufid_len; }
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
u32 ovs_nla_get_ufid_flags(const struct nlattr *attr) { return attr ? nla_get_u32(attr) : 0; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int ovs_nla_put_vlan(struct sk_buff *skb, const struct vlan_head *vh, bool is_mask) { __be16 eth_type = !is_mask ? vh->tpid : htons(0xffff); if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, eth_type) || nla_put_be16(skb, OVS_KEY_ATTR_VLAN, vh->tci)) return -EMSGSIZE; re...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
int ovs_nla_put_mask(const struct sw_flow *flow, struct sk_buff *skb) { return ovs_nla_put_key(&flow->key, &flow->mask->key, OVS_FLOW_ATTR_MASK, true, skb); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static struct sw_flow_actions *nla_alloc_flow_actions(int size) { struct sw_flow_actions *sfa; WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE); sfa = kmalloc(kmalloc_size_roundup(sizeof(*sfa) + size), GFP_KERNEL); if (!sfa) return ERR_PTR(-ENOMEM); sfa->actions_len = 0; return sfa; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static void ovs_nla_free_clone_action(const struct nlattr *action) { const struct nlattr *a = nla_data(action); int rem = nla_len(action); switch (nla_type(a)) { case OVS_CLONE_ATTR_EXEC: a = nla_next(a, &rem); ovs_nla_free_nested_actions(a, rem); break; } }
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static void ovs_nla_free_sample_action(const struct nlattr *action) { const struct nlattr *a = nla_data(action); int rem = nla_len(action); switch (nla_type(a)) { case OVS_SAMPLE_ATTR_ARG: a = nla_next(a, &rem); ovs_nla_free_nested_actions(a, rem); break; } }
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
void ovs_nla_free_flow_actions(struct sw_flow_actions *sf_acts) { if (!sf_acts) return; ovs_nla_free_nested_actions(sf_acts->actions, sf_acts->actions_len); kfree(sf_acts); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
void ovs_nla_free_flow_actions_rcu(struct sw_flow_actions *sf_acts) { call_rcu(&sf_acts->rcu, __ovs_nla_free_flow_actions); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa, int attr_len, bool log) { struct sw_flow_actions *acts; int new_acts_size; size_t req_size = NLA_ALIGN(attr_len); int next_offset = offsetof(struct sw_flow_actions, actions) + (*sfa)->actions_len;...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
int ovs_nla_add_action(struct sw_flow_actions **sfa, int attrtype, void *data, int len, bool log) { struct nlattr *a; a = __add_action(sfa, attrtype, data, len, log); return PTR_ERR_OR_ZERO(a); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int validate_and_copy_clone(struct net *net, const struct nlattr *attr, const struct sw_flow_key *key, struct sw_flow_actions **sfa, __be16 eth_type, __be16 vlan_tci, u32 m...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int copy_action(const struct nlattr *from, struct sw_flow_actions **sfa, bool log) { int totlen = NLA_ALIGN(from->nla_len); struct nlattr *to; to = reserve_sfa_size(sfa, from->nla_len, log); if (IS_ERR(to)) return PTR_ERR(to); memcpy(to, from, totlen); return 0; }
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
static int masked_set_action_to_set_action_attr(const struct nlattr *a, struct sk_buff *skb) { const struct nlattr *ovs_key = nla_data(a); struct nlattr *nla; size_t key_len = nla_len(ovs_key) / 2; nla = nla_nest_start_noflag(skb, OVS_ACTION_ATTR_SET); if (!nla...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_netlink.c
int ovs_nla_put_actions(const struct nlattr *attr, int len, struct sk_buff *skb) { const struct nlattr *a; int rem, err; nla_for_each_attr(a, attr, len, rem) { int type = nla_type(a); switch (type) { case OVS_ACTION_ATTR_SET: err = set_action_to_attr(a, skb); if ...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
void ovs_flow_mask_key(struct sw_flow_key *dst, const struct sw_flow_key *src, bool full, const struct sw_flow_mask *mask) { int start = full ? 0 : mask->range.start; int len = full ? sizeof *dst : range_n_bytes(&mask->range); const long *m = (const long *)((const u8 *)&mask->key + start); ...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
int ovs_flow_tbl_count(const struct flow_table *table) { return table->count; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
static void __mask_array_destroy(struct mask_array *ma) { free_percpu(ma->masks_usage_stats); kfree(ma); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
static void mask_array_rcu_cb(struct rcu_head *rcu) { struct mask_array *ma = container_of(rcu, struct mask_array, rcu); __mask_array_destroy(ma); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
static struct mask_array *tbl_mask_array_alloc(int size) { struct mask_array *new; size = max(MASK_ARRAY_SIZE_MIN, size); new = kzalloc(sizeof(struct mask_array) + sizeof(struct sw_flow_mask *) * size + sizeof(u64) * size, GFP_KERNEL); if (!new) return NULL; new->mas...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
static int tbl_mask_array_realloc(struct flow_table *tbl, int size) { struct mask_array *old; struct mask_array *new; new = tbl_mask_array_alloc(size); if (!new) return -ENOMEM; old = ovsl_dereference(tbl->mask_array); if (old) { int i; for (i = 0; i < old->max; i++) { if (ovsl_derefer...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
static int tbl_mask_array_add_mask(struct flow_table *tbl, struct sw_flow_mask *new) { struct mask_array *ma = ovsl_dereference(tbl->mask_array); int err, ma_count = READ_ONCE(ma->count); if (ma_count >= ma->max) { err = tbl_mask_array_realloc(tbl, ma->max + MASK_ARRAY_SIZE...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
int ovs_flow_tbl_masks_cache_resize(struct flow_table *table, u32 size) { struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache); struct mask_cache *new; if (size == mc->cache_size) return 0; if ((!is_power_of_2(size) && size != 0) || (size * sizeof(struct mask_cache_entry)) > PCPU_MIN_UNIT...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
void ovs_flow_tbl_destroy(struct flow_table *table) { struct table_instance *ti = rcu_dereference_raw(table->ti); struct table_instance *ufid_ti = rcu_dereference_raw(table->ufid_ti); struct mask_cache *mc = rcu_dereference_raw(table->mask_cache); struct mask_array *ma = rcu_dereference_raw(table->mask_array); ...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
int ovs_flow_tbl_flush(struct flow_table *flow_table) { struct table_instance *old_ti, *new_ti; struct table_instance *old_ufid_ti, *new_ufid_ti; new_ti = table_instance_alloc(TBL_MIN_BUCKETS); if (!new_ti) return -ENOMEM; new_ufid_ti = table_instance_alloc(TBL_MIN_BUCKETS); if (!new_ufid_ti) goto...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
static bool cmp_key(const struct sw_flow_key *key1, const struct sw_flow_key *key2, int key_start, int key_end) { const long *cp1 = (const long *)((const u8 *)key1 + key_start); const long *cp2 = (const long *)((const u8 *)key2 + key_start); int i; for (i = key_start; i...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
static struct sw_flow *masked_flow_lookup(struct table_instance *ti, const struct sw_flow_key *unmasked, const struct sw_flow_mask *mask, u32 *n_mask_hit) { struct sw_flow *flow; struct hli...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
struct sw_flow *ovs_flow_tbl_lookup_stats(struct flow_table *tbl, const struct sw_flow_key *key, u32 skb_hash, u32 *n_mask_hit, u32 *n_cache_hit) { struct mask_cache *mc = rcu_dereference(tbl-...
[ 1, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
struct sw_flow *ovs_flow_tbl_lookup_exact(struct flow_table *tbl, const struct sw_flow_match *match) { struct mask_array *ma = ovsl_dereference(tbl->mask_array); int i; for (i = 0; i < ma->max; i++) { struct table_instance *ti = rcu_dereference_ovsl(tbl->ti); u32...
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
u32 ovs_flow_tbl_masks_cache_size(const struct flow_table *table) { struct mask_cache *mc = rcu_dereference_ovsl(table->mask_cache); return READ_ONCE(mc->cache_size); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
void ovs_flow_tbl_remove(struct flow_table *table, struct sw_flow *flow) { struct table_instance *ti = ovsl_dereference(table->ti); struct table_instance *ufid_ti = ovsl_dereference(table->ufid_ti); BUG_ON(table->count == 0); table_instance_flow_free(table, ti, ufid_ti, flow); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/flow_table.c
int ovs_flow_tbl_insert(struct flow_table *table, struct sw_flow *flow, const struct sw_flow_mask *mask) { int err; err = flow_mask_insert(table, flow, mask); if (err) return err; flow_key_insert(table, flow); if (ovs_identifier_is_ufid(&flow->id)) flow_ufid_insert(table, flow...
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
static u32 meter_hash(struct dp_meter_instance *ti, u32 id) { return id % ti->n_meters; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
static void ovs_meter_free(struct dp_meter *meter) { if (!meter) return; kfree_rcu(meter, rcu); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
static void dp_meter_instance_free(struct dp_meter_instance *ti) { kvfree(ti); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
static void dp_meter_instance_remove(struct dp_meter_instance *ti, struct dp_meter *meter) { u32 hash; hash = meter_hash(ti, meter->id); RCU_INIT_POINTER(ti->dp_meters[hash], NULL); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
static int attach_meter(struct dp_meter_table *tbl, struct dp_meter *meter) { struct dp_meter_instance *ti = rcu_dereference_ovsl(tbl->ti); u32 hash = meter_hash(ti, meter->id); int err; if (unlikely(rcu_dereference_ovsl(ti->dp_meters[hash]))) return -EBUSY; dp_meter_instance_insert(ti, meter); /* Th...
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
static int detach_meter(struct dp_meter_table *tbl, struct dp_meter *meter) { struct dp_meter_instance *ti; ASSERT_OVSL(); if (!meter) return 0; ti = rcu_dereference_ovsl(tbl->ti); dp_meter_instance_remove(ti, meter); tbl->count--; if (ti->n_meters > DP_METER_ARRAY_SIZE_MIN && tbl->count <= ...
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
static int ovs_meter_cmd_features(struct sk_buff *skb, struct genl_info *info) { struct ovs_header *ovs_header = info->userhdr; struct ovs_header *ovs_reply_header; struct nlattr *nla, *band_nla; struct sk_buff *reply; struct datapath *dp; int err = -EMSGSIZE; reply = ovs_meter_cmd_reply_start(info, OVS_...
[ 0, 0 ]
Linux Kernel
net/openvswitch/meter.c
int ovs_meters_init(struct datapath *dp) { struct dp_meter_table *tbl = &dp->meter_tbl; struct dp_meter_instance *ti; unsigned long free_mem_bytes; ti = dp_meter_instance_alloc(DP_METER_ARRAY_SIZE_MIN); if (!ti) return -ENOMEM; free_mem_bytes = nr_free_buffer_pages() * (PAGE_SIZE >> 5); tbl->max_met...
[ 1, 0 ]
Linux Kernel
net/openvswitch/vport-gre.c
static struct vport *gre_tnl_create(const struct vport_parms *parms) { struct net *net = ovs_dp_get_net(parms->dp); struct net_device *dev; struct vport *vport; int err; vport = ovs_vport_alloc(0, &ovs_gre_vport_ops, parms); if (IS_ERR(vport)) return vport; rtnl_lock(); dev = gretap_fb_dev_create...
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-internal_dev.c
static struct internal_dev *internal_dev_priv(struct net_device *netdev) { return netdev_priv(netdev); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-internal_dev.c
static int internal_dev_open(struct net_device *netdev) { netif_start_queue(netdev); return 0; }
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-internal_dev.c
static void do_setup(struct net_device *netdev) { ether_setup(netdev); netdev->max_mtu = ETH_MAX_MTU; netdev->netdev_ops = &internal_dev_netdev_ops; netdev->priv_flags &= ~IFF_TX_SKB_SHARING; netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE | IFF_OPENVSWITCH | IFF_NO_QUEUE; netdev->needs_free_netdev = true; ...
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-internal_dev.c
void ovs_internal_dev_rtnl_link_unregister(void) { ovs_vport_ops_unregister(&ovs_internal_vport_ops); rtnl_link_unregister(&internal_dev_link_ops); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-netdev.c
struct vport *ovs_netdev_link(struct vport *vport, const char *name) { int err; vport->dev = dev_get_by_name(ovs_dp_get_net(vport->dp), name); if (!vport->dev) { err = -ENODEV; goto error_free_vport; } netdev_tracker_alloc(vport->dev, &vport->dev_tracker, GFP_KERNEL); if (vport->dev->flags & IFF_L...
[ 1, 0 ]
Linux Kernel
net/openvswitch/vport-netdev.c
void ovs_netdev_detach_dev(struct vport *vport) { ASSERT_RTNL(); vport->dev->priv_flags &= ~IFF_OVS_DATAPATH; netdev_rx_handler_unregister(vport->dev); netdev_upper_dev_unlink(vport->dev, netdev_master_upper_dev_get(vport->dev)); dev_set_promiscuity(vport->dev, -1); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-netdev.c
static void netdev_destroy(struct vport *vport) { rtnl_lock(); if (netif_is_ovs_port(vport->dev)) ovs_netdev_detach_dev(vport); rtnl_unlock(); call_rcu(&vport->rcu, vport_netdev_free); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-vxlan.c
static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr, struct vxlan_config *conf) { struct nlattr *exts[OVS_VXLAN_EXT_MAX + 1]; int err; if (nla_len(attr) < sizeof(struct nlattr)) return -EINVAL; err = nla_parse_nested_deprecated(exts, OVS_VXLAN_EXT_MAX,...
[ 1, 0 ]
Linux Kernel
net/openvswitch/vport-vxlan.c
static struct vport *vxlan_create(const struct vport_parms *parms) { struct vport *vport; vport = vxlan_tnl_create(parms); if (IS_ERR(vport)) return vport; return ovs_netdev_link(vport, parms->name); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport-vxlan.c
static int __init ovs_vxlan_tnl_init(void) { return ovs_vport_ops_register(&ovs_vxlan_netdev_vport_ops); }
[ 0, 0 ]
Linux Kernel
net/openvswitch/vport.c
int ovs_vport_init(void) { dev_table = kcalloc(VPORT_HASH_BUCKETS, sizeof(struct hlist_head), GFP_KERNEL); if (!dev_table) return -ENOMEM; return 0; }
[ 1, 0 ]
Linux Kernel
net/openvswitch/vport.c
int ovs_vport_set_options(struct vport *vport, struct nlattr *options) { if (!vport->ops->set_options) return -EOPNOTSUPP; return vport->ops->set_options(vport, options); }
[ 1, 0 ]
Linux Kernel
net/openvswitch/vport.c
int ovs_vport_get_upcall_portids(const struct vport *vport, struct sk_buff *skb) { struct vport_portids *ids; ids = rcu_dereference_ovsl(vport->upcall_portids); if (vport->dp->user_features & OVS_DP_F_VPORT_PIDS) return nla_put(skb, OVS_VPORT_ATTR_UPCALL_PID, ids->n_ids * si...
[ 1, 0 ]
Linux Kernel
net/openvswitch/vport.c
void ovs_vport_send(struct vport *vport, struct sk_buff *skb, u8 mac_proto) { int mtu = vport->dev->mtu; switch (vport->dev->type) { case ARPHRD_NONE: if (mac_proto == MAC_PROTO_ETHERNET) { skb_reset_network_header(skb); skb_reset_mac_len(skb); skb->protocol = htons(ETH_P_TEB); } else ...
[ 1, 0 ]
Linux Kernel
net/openvswitch/vport.h
static inline struct vport *vport_from_priv(void *priv) { return (struct vport *)((u8 *)priv - ALIGN(sizeof(struct vport), VPORT_ALIGN)); }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static u16 packet_pick_tx_queue(struct sk_buff *skb) { struct net_device *dev = skb->dev; const struct net_device_ops *ops = dev->netdev_ops; int cpu = raw_smp_processor_id(); u16 queue_index; #ifdef CONFIG_XPS skb->sender_cpu = cpu + 1; #endif skb_record_rx_queue(skb, cpu % dev->real_num_tx_queues); if...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void _prb_refresh_rx_retire_blk_timer(struct tpacket_kbdq_core *pkc) { mod_timer(&pkc->retire_blk_timer, jiffies + pkc->tov_in_jiffies); pkc->last_kactive_blk_num = pkc->kactive_blk_num; }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void *prb_dispatch_next_block(struct tpacket_kbdq_core *pkc, struct packet_sock *po) { struct tpacket_block_desc *pbd; smp_rmb(); pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc); /* 2. If this block is currently in_use then freeze the queue */ if (TP_STATUS_USER & BLOC...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static int prb_curr_blk_in_use(struct tpacket_block_desc *pbd) { return TP_STATUS_USER & BLOCK_STATUS(pbd); }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void prb_fill_rxhash(struct tpacket_kbdq_core *pkc, struct tpacket3_hdr *ppd) { ppd->hv1.tp_rxhash = skb_get_hash(pkc->skb); }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void *__packet_lookup_frame_in_block(struct packet_sock *po, struct sk_buff *skb, unsigned int len) { struct tpacket_kbdq_core *pkc; struct tpacket_block_desc *pbd; char *curr, *end; pkc = GET_PBDQC_FROM_RB(&po->rx_r...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void *packet_current_rx_frame(struct packet_sock *po, struct sk_buff *skb, int status, unsigned int len) { char *curr = NULL; switch (po->tp_version) { case TPACKET_V1: case TPACKET_V2: curr = packet_lookup_frame(po, &po->rx_r...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void *prb_lookup_block(const struct packet_sock *po, const struct packet_ring_buffer *rb, unsigned int idx, int status) { struct tpacket_kbdq_core *pkc = GET_PBDQC_FROM_RB(rb); struct tpacket_block_desc *pbd = GET_PBLOCK_DESC(pkc, idx); if (stat...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static int prb_previous_blk_num(struct packet_ring_buffer *rb) { unsigned int prev; if (rb->prb_bdqc.kactive_blk_num) prev = rb->prb_bdqc.kactive_blk_num - 1; else prev = rb->prb_bdqc.knum_blocks - 1; return prev; }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void packet_inc_pending(struct packet_ring_buffer *rb) { this_cpu_inc(*rb->pending_refcnt); }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static int __packet_rcv_has_room(const struct packet_sock *po, const struct sk_buff *skb) { const struct sock *sk = &po->sk; int ret = ROOM_NONE; if (po->prot_hook.func != tpacket_rcv) { int rcvbuf = READ_ONCE(sk->sk_rcvbuf); int avail = rcvbuf - atomic_read(&sk-...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static unsigned int fanout_demux_hash(struct packet_fanout *f, struct sk_buff *skb, unsigned int num) { return reciprocal_scale(__skb_get_hash_symmetric(skb), num); }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static unsigned int fanout_demux_qm(struct packet_fanout *f, struct sk_buff *skb, unsigned int num) { return skb_get_queue_mapping(skb) % num; }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static unsigned int fanout_demux_bpf(struct packet_fanout *f, struct sk_buff *skb, unsigned int num) { struct bpf_prog *prog; unsigned int ret = 0; rcu_read_lock(); prog = rcu_dereference(f->bpf_prog); if (prog) ret = bpf_prog_run_clear_cb(prog, skb) % num; rcu_rea...
[ 1, 0 ]
Linux Kernel
net/packet/af_packet.c
static void __fanout_link(struct sock *sk, struct packet_sock *po) { struct packet_fanout *f = po->fanout; spin_lock(&f->lock); rcu_assign_pointer(f->arr[f->num_members], sk); smp_wmb(); f->num_members++; if (f->num_members == 1) dev_add_pack(&f->prot_hook); spin_unlock(&f->lock); }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static bool match_fanout_group(struct packet_type *ptype, struct sock *sk) { if (sk->sk_family != PF_PACKET) return false; return ptype->af_packet_priv == pkt_sk(sk)->fanout; }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void fanout_init_data(struct packet_fanout *f) { switch (f->type) { case PACKET_FANOUT_LB: atomic_set(&f->rr_cur, 0); break; case PACKET_FANOUT_CBPF: case PACKET_FANOUT_EBPF: RCU_INIT_POINTER(f->bpf_prog, NULL); break; } }
[ 1, 0 ]
Linux Kernel
net/packet/af_packet.c
static int fanout_set_data(struct packet_sock *po, sockptr_t data, unsigned int len) { switch (po->fanout->type) { case PACKET_FANOUT_CBPF: return fanout_set_data_cbpf(po, data, len); case PACKET_FANOUT_EBPF: return fanout_set_data_ebpf(po, data, len); default: return -EI...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static void fanout_release_data(struct packet_fanout *f) { switch (f->type) { case PACKET_FANOUT_CBPF: case PACKET_FANOUT_EBPF: __fanout_set_data_bpf(f, NULL); } }
[ 1, 0 ]
Linux Kernel
net/packet/af_packet.c
static bool fanout_find_new_id(struct sock *sk, u16 *new_id) { u16 id = fanout_next_id; do { if (__fanout_id_is_free(sk, id)) { *new_id = id; fanout_next_id = id + 1; return true; } id++; } while (id != fanout_next_id); return false; }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static struct packet_fanout *fanout_release(struct sock *sk) { struct packet_sock *po = pkt_sk(sk); struct packet_fanout *f; mutex_lock(&fanout_mutex); f = po->fanout; if (f) { po->fanout = NULL; if (refcount_dec_and_test(&f->sk_ref)) list_del(&f->list); else f = NULL; } mutex_un...
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static bool packet_extra_vlan_len_allowed(const struct net_device *dev, struct sk_buff *skb) { if (unlikely(dev->type != ARPHRD_ETHER)) return false; skb_reset_mac_header(skb); return likely(eth_hdr(skb)->h_proto == htons(ETH_P_8021Q)); }
[ 0, 0 ]
Linux Kernel
net/packet/af_packet.c
static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct sock *sk; struct sockaddr_pkt *spkt; sk = pt->af_packet_priv; /* * Yank back the headers [hope the device set this *...
[ 1, 0 ]