Lines Matching refs:opts
900 const struct ndp_parser_opts *opts = ncm->parser_opts; in package_for_tx() local
902 const int dgram_idx_len = 2 * 2 * opts->dgram_item_len; in package_for_tx()
916 put_ncm(&ntb_iter, opts->block_length, new_len); in package_for_tx()
917 put_ncm(&ntb_iter, opts->ndp_index, ndp_index); in package_for_tx()
920 new_len = opts->ndp_size + in package_for_tx()
963 const struct ndp_parser_opts *opts = ncm->parser_opts; in ncm_wrap_ntb() local
967 const int dgram_idx_len = 2 * 2 * opts->dgram_item_len; in ncm_wrap_ntb()
1002 ncb_len = opts->nth_size; in ncm_wrap_ntb()
1014 put_unaligned_le32(opts->nth_sign, ntb_data); in ncm_wrap_ntb()
1017 put_unaligned_le16(opts->nth_size, ntb_data++); in ncm_wrap_ntb()
1023 ncm->skb_tx_ndp = alloc_skb((int)(opts->ndp_size in ncm_wrap_ntb()
1024 + opts->dpe_size in ncm_wrap_ntb()
1030 opts->ndp_size); in ncm_wrap_ntb()
1056 put_ncm(&ntb_ndp, opts->dgram_item_len, ncb_len); in ncm_wrap_ntb()
1058 put_ncm(&ntb_ndp, opts->dgram_item_len, skb->len); in ncm_wrap_ntb()
1141 const struct ndp_parser_opts *opts = ncm->parser_opts; in ncm_unwrap_ntb() local
1146 if (get_unaligned_le32(tmp) != opts->nth_sign) { in ncm_unwrap_ntb()
1156 if (get_unaligned_le16(tmp++) != opts->nth_size) { in ncm_unwrap_ntb()
1163 if (get_ncm(&tmp, opts->block_length) > max_size) { in ncm_unwrap_ntb()
1168 ndp_index = get_ncm(&tmp, opts->ndp_index); in ncm_unwrap_ntb()
1174 (ndp_index < opts->nth_size)) { in ncm_unwrap_ntb()
1196 if ((ndp_len < opts->ndp_size in ncm_unwrap_ntb()
1197 + 2 * 2 * (opts->dgram_item_len * 2)) in ncm_unwrap_ntb()
1198 || (ndp_len % opts->ndplen_align != 0)) { in ncm_unwrap_ntb()
1203 tmp += opts->reserved1; in ncm_unwrap_ntb()
1205 ndp_index = get_ncm(&tmp, opts->next_ndp_index); in ncm_unwrap_ntb()
1206 tmp += opts->reserved2; in ncm_unwrap_ntb()
1208 ndp_len -= opts->ndp_size; in ncm_unwrap_ntb()
1209 index2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1210 dg_len2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1237 index2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1238 dg_len2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1253 ndp_len -= 2 * (opts->dgram_item_len * 2); in ncm_unwrap_ntb()
1259 } while (ndp_len > 2 * (opts->dgram_item_len * 2)); in ncm_unwrap_ntb()
1522 struct f_ncm_opts *opts; in ncm_free_inst() local
1524 opts = container_of(f, struct f_ncm_opts, func_inst); in ncm_free_inst()
1525 if (opts->bound) in ncm_free_inst()
1526 gether_cleanup(netdev_priv(opts->net)); in ncm_free_inst()
1528 free_netdev(opts->net); in ncm_free_inst()
1529 kfree(opts); in ncm_free_inst()
1534 struct f_ncm_opts *opts; in ncm_alloc_inst() local
1536 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in ncm_alloc_inst()
1537 if (!opts) in ncm_alloc_inst()
1539 mutex_init(&opts->lock); in ncm_alloc_inst()
1540 opts->func_inst.free_func_inst = ncm_free_inst; in ncm_alloc_inst()
1541 opts->net = gether_setup_default(); in ncm_alloc_inst()
1542 if (IS_ERR(opts->net)) { in ncm_alloc_inst()
1543 struct net_device *net = opts->net; in ncm_alloc_inst()
1544 kfree(opts); in ncm_alloc_inst()
1548 config_group_init_type_name(&opts->func_inst.group, "", &ncm_func_type); in ncm_alloc_inst()
1550 return &opts->func_inst; in ncm_alloc_inst()
1556 struct f_ncm_opts *opts; in ncm_free() local
1559 opts = container_of(f->fi, struct f_ncm_opts, func_inst); in ncm_free()
1561 mutex_lock(&opts->lock); in ncm_free()
1562 opts->refcnt--; in ncm_free()
1563 mutex_unlock(&opts->lock); in ncm_free()
1585 struct f_ncm_opts *opts; in ncm_alloc() local
1593 opts = container_of(fi, struct f_ncm_opts, func_inst); in ncm_alloc()
1594 mutex_lock(&opts->lock); in ncm_alloc()
1595 opts->refcnt++; in ncm_alloc()
1598 status = gether_get_host_addr_cdc(opts->net, ncm->ethaddr, in ncm_alloc()
1602 mutex_unlock(&opts->lock); in ncm_alloc()
1609 ncm->port.ioport = netdev_priv(opts->net); in ncm_alloc()
1610 mutex_unlock(&opts->lock); in ncm_alloc()