Lines Matching refs:opts
955 const struct ndp_parser_opts *opts = ncm->parser_opts; in package_for_tx() local
957 const int dgram_idx_len = 2 * 2 * opts->dgram_item_len; in package_for_tx()
971 put_ncm(&ntb_iter, opts->block_length, new_len); in package_for_tx()
972 put_ncm(&ntb_iter, opts->ndp_index, ndp_index); in package_for_tx()
975 new_len = opts->ndp_size + in package_for_tx()
1017 const struct ndp_parser_opts *opts = ncm->parser_opts; in ncm_wrap_ntb() local
1021 const int dgram_idx_len = 2 * 2 * opts->dgram_item_len; in ncm_wrap_ntb()
1052 ncb_len = opts->nth_size; in ncm_wrap_ntb()
1064 put_unaligned_le32(opts->nth_sign, ntb_data); in ncm_wrap_ntb()
1067 put_unaligned_le16(opts->nth_size, ntb_data++); in ncm_wrap_ntb()
1073 ncm->skb_tx_ndp = alloc_skb((int)(opts->ndp_size in ncm_wrap_ntb()
1074 + opts->dpe_size in ncm_wrap_ntb()
1081 ntb_ndp = skb_put(ncm->skb_tx_ndp, opts->ndp_size); in ncm_wrap_ntb()
1105 put_ncm(&ntb_ndp, opts->dgram_item_len, ncb_len); in ncm_wrap_ntb()
1107 put_ncm(&ntb_ndp, opts->dgram_item_len, skb->len); in ncm_wrap_ntb()
1180 const struct ndp_parser_opts *opts = ncm->parser_opts; in ncm_unwrap_ntb() local
1193 if (get_unaligned_le32(tmp) != opts->nth_sign) { in ncm_unwrap_ntb()
1203 if (get_unaligned_le16(tmp++) != opts->nth_size) { in ncm_unwrap_ntb()
1209 block_len = get_ncm(&tmp, opts->block_length); in ncm_unwrap_ntb()
1216 ndp_index = get_ncm(&tmp, opts->ndp_index); in ncm_unwrap_ntb()
1225 (ndp_index < opts->nth_size) || in ncm_unwrap_ntb()
1227 opts->ndp_size))) { in ncm_unwrap_ntb()
1253 if ((ndp_len < opts->ndp_size in ncm_unwrap_ntb()
1254 + 2 * 2 * (opts->dgram_item_len * 2)) || in ncm_unwrap_ntb()
1255 (ndp_len % opts->ndplen_align != 0)) { in ncm_unwrap_ntb()
1260 tmp += opts->reserved1; in ncm_unwrap_ntb()
1262 ndp_index = get_ncm(&tmp, opts->next_ndp_index); in ncm_unwrap_ntb()
1263 tmp += opts->reserved2; in ncm_unwrap_ntb()
1265 ndp_len -= opts->ndp_size; in ncm_unwrap_ntb()
1266 index2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1267 dg_len2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1273 if ((index < opts->nth_size) || in ncm_unwrap_ntb()
1274 (index > block_len - opts->dpe_size)) { in ncm_unwrap_ntb()
1307 index2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1308 dg_len2 = get_ncm(&tmp, opts->dgram_item_len); in ncm_unwrap_ntb()
1311 if (index2 > block_len - opts->dpe_size) { in ncm_unwrap_ntb()
1330 ndp_len -= 2 * (opts->dgram_item_len * 2); in ncm_unwrap_ntb()
1335 } while (ndp_len > 2 * (opts->dgram_item_len * 2)); in ncm_unwrap_ntb()
1607 struct f_ncm_opts *opts = to_f_ncm_opts(item); in ncm_opts_max_segment_size_show() local
1610 mutex_lock(&opts->lock); in ncm_opts_max_segment_size_show()
1611 segment_size = opts->max_segment_size; in ncm_opts_max_segment_size_show()
1612 mutex_unlock(&opts->lock); in ncm_opts_max_segment_size_show()
1620 struct f_ncm_opts *opts = to_f_ncm_opts(item); in ncm_opts_max_segment_size_store() local
1624 mutex_lock(&opts->lock); in ncm_opts_max_segment_size_store()
1625 if (opts->refcnt) { in ncm_opts_max_segment_size_store()
1639 opts->max_segment_size = segment_size; in ncm_opts_max_segment_size_store()
1642 mutex_unlock(&opts->lock); in ncm_opts_max_segment_size_store()
1665 struct f_ncm_opts *opts; in ncm_free_inst() local
1667 opts = container_of(f, struct f_ncm_opts, func_inst); in ncm_free_inst()
1668 if (opts->bound) in ncm_free_inst()
1669 gether_cleanup(netdev_priv(opts->net)); in ncm_free_inst()
1671 free_netdev(opts->net); in ncm_free_inst()
1672 kfree(opts->ncm_interf_group); in ncm_free_inst()
1673 kfree(opts); in ncm_free_inst()
1678 struct f_ncm_opts *opts; in ncm_alloc_inst() local
1683 opts = kzalloc(sizeof(*opts), GFP_KERNEL); in ncm_alloc_inst()
1684 if (!opts) in ncm_alloc_inst()
1686 opts->ncm_os_desc.ext_compat_id = opts->ncm_ext_compat_id; in ncm_alloc_inst()
1688 mutex_init(&opts->lock); in ncm_alloc_inst()
1689 opts->func_inst.free_func_inst = ncm_free_inst; in ncm_alloc_inst()
1690 opts->net = gether_setup_default(); in ncm_alloc_inst()
1691 if (IS_ERR(opts->net)) { in ncm_alloc_inst()
1692 struct net_device *net = opts->net; in ncm_alloc_inst()
1693 kfree(opts); in ncm_alloc_inst()
1696 opts->max_segment_size = ETH_FRAME_LEN; in ncm_alloc_inst()
1697 INIT_LIST_HEAD(&opts->ncm_os_desc.ext_prop); in ncm_alloc_inst()
1699 descs[0] = &opts->ncm_os_desc; in ncm_alloc_inst()
1702 config_group_init_type_name(&opts->func_inst.group, "", &ncm_func_type); in ncm_alloc_inst()
1704 usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs, in ncm_alloc_inst()
1707 ncm_free_inst(&opts->func_inst); in ncm_alloc_inst()
1710 opts->ncm_interf_group = ncm_interf_group; in ncm_alloc_inst()
1712 return &opts->func_inst; in ncm_alloc_inst()
1718 struct f_ncm_opts *opts; in ncm_free() local
1721 opts = container_of(f->fi, struct f_ncm_opts, func_inst); in ncm_free()
1723 mutex_lock(&opts->lock); in ncm_free()
1724 opts->refcnt--; in ncm_free()
1725 mutex_unlock(&opts->lock); in ncm_free()
1754 struct f_ncm_opts *opts; in ncm_alloc() local
1762 opts = container_of(fi, struct f_ncm_opts, func_inst); in ncm_alloc()
1763 mutex_lock(&opts->lock); in ncm_alloc()
1764 opts->refcnt++; in ncm_alloc()
1767 status = gether_get_host_addr_cdc(opts->net, ncm->ethaddr, in ncm_alloc()
1771 mutex_unlock(&opts->lock); in ncm_alloc()
1778 ncm->port.ioport = netdev_priv(opts->net); in ncm_alloc()
1779 mutex_unlock(&opts->lock); in ncm_alloc()