Lines Matching refs:sc
26 static void ioam6_sc_release(struct ioam6_schema *sc) in ioam6_sc_release() argument
28 kfree_rcu(sc, rcu); in ioam6_sc_release()
41 struct ioam6_schema *sc = (struct ioam6_schema *)ptr; in ioam6_free_sc() local
43 if (sc) in ioam6_free_sc()
44 ioam6_sc_release(sc); in ioam6_free_sc()
56 const struct ioam6_schema *sc = obj; in ioam6_sc_cmpfn() local
58 return (sc->id != *(u32 *)arg->key); in ioam6_sc_cmpfn()
163 struct ioam6_schema *sc; in ioam6_genl_delns() local
181 sc = rcu_dereference_protected(ns->schema, in ioam6_genl_delns()
189 if (sc) in ioam6_genl_delns()
190 rcu_assign_pointer(sc->ns, NULL); in ioam6_genl_delns()
206 struct ioam6_schema *sc; in __ioam6_genl_dumpns_element() local
228 sc = rcu_dereference(ns->schema); in __ioam6_genl_dumpns_element()
229 if (sc && nla_put_u32(skb, IOAM6_ATTR_SC_ID, sc->id)) { in __ioam6_genl_dumpns_element()
314 struct ioam6_schema *sc; in ioam6_genl_addsc() local
325 sc = rhashtable_lookup_fast(&nsdata->schemas, &id, rht_sc_params); in ioam6_genl_addsc()
326 if (sc) { in ioam6_genl_addsc()
334 sc = kzalloc(sizeof(*sc) + len_aligned, GFP_KERNEL); in ioam6_genl_addsc()
335 if (!sc) { in ioam6_genl_addsc()
340 sc->id = id; in ioam6_genl_addsc()
341 sc->len = len_aligned; in ioam6_genl_addsc()
342 sc->hdr = cpu_to_be32(sc->id | ((u8)(sc->len / 4) << 24)); in ioam6_genl_addsc()
343 nla_memcpy(sc->data, info->attrs[IOAM6_ATTR_SC_DATA], len); in ioam6_genl_addsc()
345 err = rhashtable_lookup_insert_fast(&nsdata->schemas, &sc->head, in ioam6_genl_addsc()
354 kfree(sc); in ioam6_genl_addsc()
362 struct ioam6_schema *sc; in ioam6_genl_delsc() local
374 sc = rhashtable_lookup_fast(&nsdata->schemas, &id, rht_sc_params); in ioam6_genl_delsc()
375 if (!sc) { in ioam6_genl_delsc()
380 ns = rcu_dereference_protected(sc->ns, lockdep_is_held(&nsdata->lock)); in ioam6_genl_delsc()
382 err = rhashtable_remove_fast(&nsdata->schemas, &sc->head, in ioam6_genl_delsc()
390 ioam6_sc_release(sc); in ioam6_genl_delsc()
397 static int __ioam6_genl_dumpsc_element(struct ioam6_schema *sc, in __ioam6_genl_dumpsc_element() argument
408 if (nla_put_u32(skb, IOAM6_ATTR_SC_ID, sc->id) || in __ioam6_genl_dumpsc_element()
409 nla_put(skb, IOAM6_ATTR_SC_DATA, sc->len, sc->data)) in __ioam6_genl_dumpsc_element()
414 ns = rcu_dereference(sc->ns); in __ioam6_genl_dumpsc_element()
461 struct ioam6_schema *sc; in ioam6_genl_dumpsc() local
468 sc = rhashtable_walk_next(iter); in ioam6_genl_dumpsc()
470 if (IS_ERR(sc)) { in ioam6_genl_dumpsc()
471 if (PTR_ERR(sc) == -EAGAIN) in ioam6_genl_dumpsc()
473 err = PTR_ERR(sc); in ioam6_genl_dumpsc()
475 } else if (!sc) { in ioam6_genl_dumpsc()
479 err = __ioam6_genl_dumpsc_element(sc, in ioam6_genl_dumpsc()
499 struct ioam6_schema *sc, *sc_ref; in ioam6_genl_ns_set_schema() local
522 sc = NULL; in ioam6_genl_ns_set_schema()
525 sc = rhashtable_lookup_fast(&nsdata->schemas, &sc_id, in ioam6_genl_ns_set_schema()
527 if (!sc) { in ioam6_genl_ns_set_schema()
537 rcu_assign_pointer(ns->schema, sc); in ioam6_genl_ns_set_schema()
539 if (sc) { in ioam6_genl_ns_set_schema()
540 ns_ref = rcu_dereference_protected(sc->ns, in ioam6_genl_ns_set_schema()
544 rcu_assign_pointer(sc->ns, ns); in ioam6_genl_ns_set_schema()
633 struct ioam6_schema *sc, in __ioam6_fill_trace_data() argument
835 if (!sc) { in __ioam6_fill_trace_data()
838 *(__be32 *)data = sc->hdr; in __ioam6_fill_trace_data()
841 memcpy(data, sc->data, sc->len); in __ioam6_fill_trace_data()
851 struct ioam6_schema *sc; in ioam6_fill_trace_data() local
863 sc = rcu_dereference(ns->schema); in ioam6_fill_trace_data()
867 if (sc) in ioam6_fill_trace_data()
868 sclen += sc->len / 4; in ioam6_fill_trace_data()
879 __ioam6_fill_trace_data(skb, ns, trace, sc, sclen); in ioam6_fill_trace_data()