本文整理汇总了C++中rcu_read_unlock_bh函数的典型用法代码示例。如果您正苦于以下问题:C++ rcu_read_unlock_bh函数的具体用法?C++ rcu_read_unlock_bh怎么用?C++ rcu_read_unlock_bh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rcu_read_unlock_bh函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vrf_finish_output6
/* modelled after ip6_finish_output2 */
static int vrf_finish_output6(struct net *net, struct sock *sk,
struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
struct net_device *dev = dst->dev;
struct neighbour *neigh;
struct in6_addr *nexthop;
int ret;
skb->protocol = htons(ETH_P_IPV6);
skb->dev = dev;
rcu_read_lock_bh();
nexthop = rt6_nexthop((struct rt6_info *)dst, &ipv6_hdr(skb)->daddr);
neigh = __ipv6_neigh_lookup_noref(dst->dev, nexthop);
if (unlikely(!neigh))
neigh = __neigh_create(&nd_tbl, nexthop, dst->dev, false);
if (!IS_ERR(neigh)) {
ret = dst_neigh_output(dst, neigh, skb);
rcu_read_unlock_bh();
return ret;
}
rcu_read_unlock_bh();
IP6_INC_STATS(dev_net(dst->dev),
ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
kfree_skb(skb);
return -EINVAL;
}
示例2: flush_bytes_array
int flush_bytes_array(void)
{
struct bytes *tmp, *old;
rcu_read_lock_bh();
if (!(rcu_dereference_bh(bytes_to_skip)->array)) {
log_info("Byte array list is empty nothing to flush");
rcu_read_unlock_bh();
return 0;
}
rcu_read_unlock_bh();
tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
if (!tmp) {
log_err("Could not allocate struct bytes.");
return -ENOMEM;
}
old = bytes_to_skip;
*tmp = *bytes_to_skip;
/* Delete. */
tmp->array = NULL;
tmp->count = 0;
rcu_assign_pointer(bytes_to_skip, tmp);
synchronize_rcu_bh();
if (old->array)
kfree(old->array);
kfree(old);
return 0;
}
示例3: display_bytes_array
int display_bytes_array(void)
{
struct bytes tmp;
int i;
rcu_read_lock_bh();
tmp = *rcu_dereference(bytes_to_skip);
if (!tmp.count) {
log_info("Byte array list is empty");
goto end;
}
for (i = 0; i < tmp.count; i++) {
if (i + 1 != tmp.count)
printk("%u, ", tmp.array[i]);
else
printk("%u\n", tmp.array[i]);
}
log_info("Array length: %d", tmp.count);
end:
rcu_read_unlock_bh();
return 0;
}
示例4: filtering_clone_config
/**
* Copies this module's current configuration to "clone".
*
* @param[out] clone a copy of the current config will be placed here. Must be already allocated.
* @return zero on success, nonzero on failure.
*/
int filtering_clone_config(struct filtering_config *clone)
{
rcu_read_lock_bh();
*clone = *rcu_dereference_bh(config);
rcu_read_unlock_bh();
return 0;
}
示例5: vhost_zerocopy_callback
static void vhost_zerocopy_callback(struct ubuf_info *ubuf, bool success)
{
struct vhost_net_ubuf_ref *ubufs = ubuf->ctx;
struct vhost_virtqueue *vq = ubufs->vq;
int cnt;
rcu_read_lock_bh();
/* set len to mark this desc buffers done DMA */
vq->heads[ubuf->desc].len = success ?
VHOST_DMA_DONE_LEN : VHOST_DMA_FAILED_LEN;
cnt = vhost_net_ubuf_put(ubufs);
/*
* Trigger polling thread if guest stopped submitting new buffers:
* in this case, the refcount after decrement will eventually reach 1.
* We also trigger polling periodically after each 16 packets
* (the value 16 here is more or less arbitrary, it's tuned to trigger
* less than 10% of times).
*/
if (cnt <= 1 || !(cnt % 16))
vhost_poll_queue(&vq->poll);
rcu_read_unlock_bh();
}
示例6: vrf_finish_output
/* modelled after ip_finish_output2 */
static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
struct rtable *rt = (struct rtable *)dst;
struct net_device *dev = dst->dev;
unsigned int hh_len = LL_RESERVED_SPACE(dev);
struct neighbour *neigh;
u32 nexthop;
int ret = -EINVAL;
nf_reset(skb);
/* Be paranoid, rather than too clever. */
if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {
struct sk_buff *skb2;
skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
if (!skb2) {
ret = -ENOMEM;
goto err;
}
if (skb->sk)
skb_set_owner_w(skb2, skb->sk);
consume_skb(skb);
skb = skb2;
}
rcu_read_lock_bh();
nexthop = (__force u32)rt_nexthop(rt, ip_hdr(skb)->daddr);
neigh = __ipv4_neigh_lookup_noref(dev, nexthop);
if (unlikely(!neigh))
neigh = __neigh_create(&arp_tbl, &nexthop, dev, false);
if (!IS_ERR(neigh)) {
sock_confirm_neigh(skb, neigh);
ret = neigh_output(neigh, skb);
rcu_read_unlock_bh();
return ret;
}
rcu_read_unlock_bh();
err:
vrf_tx_error(skb->dev, skb);
return ret;
}
示例7: drop_external_connections
/**
* Use this function to safely obtain the configuration value which dictates whether IPv4 nodes
* should be allowed to initiate conversations with IPv6 nodes.
*
* @return whether IPv4 nodes should be allowed to initiate conversations with IPv6 nodes.
*/
static bool drop_external_connections(void)
{
bool result;
rcu_read_lock_bh();
result = rcu_dereference_bh(config)->drop_external_tcp;
rcu_read_unlock_bh();
return result;
}
示例8: filter_icmpv6_info
/**
* Use this function to safely obtain the configuration value which dictates whether Jool should
* drop all informational ICMP packets that are traveling from IPv6 to IPv4.
*
* @return whether Jool should drop all ICMPv6 info packets.
*/
static bool filter_icmpv6_info(void)
{
bool result;
rcu_read_lock_bh();
result = rcu_dereference_bh(config)->drop_icmp6_info;
rcu_read_unlock_bh();
return result;
}
示例9: address_dependent_filtering
/**
* Use this function to safely obtain the configuration value which dictates whether Jool should
* be applying "address-dependent filtering" (Look that up in the RFC).
*
* @return whether Jool should apply "address-dependent filtering".
*/
static bool address_dependent_filtering(void)
{
bool result;
rcu_read_lock_bh();
result = rcu_dereference_bh(config)->drop_by_addr;
rcu_read_unlock_bh();
return result;
}
示例10: rcu_read_lock_bh
struct llc_sap *llc_sap_find(unsigned char sap_value)
{
struct llc_sap *sap;
rcu_read_lock_bh();
sap = __llc_sap_find(sap_value);
if (sap)
llc_sap_hold(sap);
rcu_read_unlock_bh();
return sap;
}
示例11: inet6_sk
struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label)
{
struct ipv6_fl_socklist *sfl;
struct ipv6_pinfo *np = inet6_sk(sk);
label &= IPV6_FLOWLABEL_MASK;
rcu_read_lock_bh();
for_each_sk_fl_rcu(np, sfl) {
struct ip6_flowlabel *fl = sfl->fl;
if (fl->label == label) {
fl->lastuse = jiffies;
atomic_inc(&fl->users);
rcu_read_unlock_bh();
return fl;
}
}
rcu_read_unlock_bh();
return NULL;
}
示例12: rcu_read_lock_bh
static struct ip6_flowlabel *fl_lookup(struct net *net, __be32 label)
{
struct ip6_flowlabel *fl;
rcu_read_lock_bh();
fl = __fl_lookup(net, label);
if (fl && !atomic_inc_not_zero(&fl->users))
fl = NULL;
rcu_read_unlock_bh();
return fl;
}
示例13: instance_lookup_get
static struct nfulnl_instance *
instance_lookup_get(struct nfnl_log_net *log, u_int16_t group_num)
{
struct nfulnl_instance *inst;
rcu_read_lock_bh();
inst = __instance_lookup(log, group_num);
if (inst && !refcount_inc_not_zero(&inst->use))
inst = NULL;
rcu_read_unlock_bh();
return inst;
}
示例14: ipv6_flowlabel_opt_get
int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq,
int flags)
{
struct ipv6_pinfo *np = inet6_sk(sk);
struct ipv6_fl_socklist *sfl;
if (flags & IPV6_FL_F_REMOTE) {
freq->flr_label = np->rcv_flowinfo & IPV6_FLOWLABEL_MASK;
return 0;
}
if (np->repflow) {
freq->flr_label = np->flow_label;
return 0;
}
rcu_read_lock_bh();
for_each_sk_fl_rcu(np, sfl) {
if (sfl->fl->label == (np->flow_label & IPV6_FLOWLABEL_MASK)) {
spin_lock_bh(&ip6_fl_lock);
freq->flr_label = sfl->fl->label;
freq->flr_dst = sfl->fl->dst;
freq->flr_share = sfl->fl->share;
freq->flr_expires = (sfl->fl->expires - jiffies) / HZ;
freq->flr_linger = sfl->fl->linger / HZ;
spin_unlock_bh(&ip6_fl_lock);
rcu_read_unlock_bh();
return 0;
}
}
rcu_read_unlock_bh();
return -ENOENT;
}
示例15: skb_compare
bool skb_compare(struct sk_buff *expected, struct sk_buff *actual)
{
struct bytes *skip_byte;
unsigned char *expected_ptr, *actual_ptr;
unsigned int i, min_len, skip_count;
int errors = 0;
if (expected->len != actual->len) {
print_error_table_hdr(errors);
log_info(" Length\t%d\t %d", expected->len, actual->len);
errors++;
}
expected_ptr = skb_network_header(expected);
actual_ptr = skb_network_header(actual);
min_len = (expected->len < actual->len) ? expected->len : actual->len;
rcu_read_lock_bh();
skip_byte = rcu_dereference_bh(bytes_to_skip);
skip_count = 0;
for (i = 0; i < min_len; i++) {
if (skip_count < skip_byte->count && skip_byte->array[skip_count] == i) {
skip_count++;
continue;
}
if (expected_ptr[i] != actual_ptr[i]) {
print_error_table_hdr(errors);
log_info(" byte %u\t0x%x\t 0x%x", i,
expected_ptr[i], actual_ptr[i]);
errors++;
if (errors >= 8)
break;
}
}
rcu_read_unlock_bh();
return !errors;
}