Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1923573rwb; Fri, 19 Aug 2022 11:46:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR47jjEHWIHGn+WwwVQ13TY+xg4+ZNGKKGQAsRn90k0aeETxi5PY50PwHfHnDXBMBsrTsVLJ X-Received: by 2002:a17:907:724f:b0:731:9ec:10fc with SMTP id ds15-20020a170907724f00b0073109ec10fcmr5763264ejc.427.1660934799190; Fri, 19 Aug 2022 11:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660934799; cv=none; d=google.com; s=arc-20160816; b=Y924Z9fIGQk/LT50+ODTUfupHe5vE0Vb4lyEsQx3nmBa0KhnA4noB5dt5kjTgUt+T3 +uw3HfJJGCaEeqM7IOf78Cw3cW270aNc0mt41zkLUFGZgXy/AqU7CzPekgsOQ/D0JKx+ lbMGKU3ytslmj+j0/ddWGeMSqOJGTXrP4bqReZujfWm6IRO/HETpOrhHFYFRZHdcnoVK Xe5OB86CzFH3B3eBQvJQKeuA76+qOSpEwQoe8GHHX4gSEOchcWGCuhP+xY9XgF+CNWA1 40Dl0vXy1lgN/PdI4MlLiJBQd1z2SIAa9nFgVdvsdjmw4SJB19RqdqMZ67npVVdvQWQa 1Kew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=1M77VSUpHBdJuUWHFqZxpANGXLDy3KTKNScQlSKbJdw=; b=IGQ01APf/6xJjKNPUSu6MAkDlbt4fbyrGJhDaqClUvwHDsYSkrNbYn8FDnR5GJofDY rVQI8diasung9SBV7T6bWi1/bF7PiuVEnmf3lotrWo2uM7Xlwjw3Zcu0+jd2FSu+Bshd vF3/MfRNa+EVhgiws2bM3TAdWWNbU1gAcVO+//Pc2hQ3eOLZcV+eRbSDSIyiDFi+6G9O UDXolY8u8PgYp8MHoFdnaqYLlk1oZfpyRaquvTVhMZT+Xp14Sj0hMT8pBwPLNZAdLFoC 0sFYUKUlZI24+reSc+tWsf6Doq9SegJMhvaGY0HLR+xx2va2MyajP/Big1MgtTnfeWmH +ofQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=aI7IOaWM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a056402254b00b0043c06c2cfdesi4214671edb.571.2022.08.19.11.46.13; Fri, 19 Aug 2022 11:46:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=aI7IOaWM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351811AbiHSRqH (ORCPT + 99 others); Fri, 19 Aug 2022 13:46:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354895AbiHSRpo (ORCPT ); Fri, 19 Aug 2022 13:45:44 -0400 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD03B105213 for ; Fri, 19 Aug 2022 10:09:53 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id p128so5409005oif.9 for ; Fri, 19 Aug 2022 10:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc; bh=1M77VSUpHBdJuUWHFqZxpANGXLDy3KTKNScQlSKbJdw=; b=aI7IOaWMzXerBLtn/yA++X6Xa61OTxWBkbbMvNVBzqCiLV2LwKGTB9/nO1m4WU97Vd 7LfrRux4dkuqSm90eKKFUUnElWo7YRaIR4BG9CO0NXs/mJig8JFSHdz2vRD2KZ0PmiBz UFD0GzM3at1fWBunNVITUdVzxU1NPJ5FLAAMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc; bh=1M77VSUpHBdJuUWHFqZxpANGXLDy3KTKNScQlSKbJdw=; b=WVkisHZgxtzj5pRHwvEaaJst2qfS82FVnqzGLP7B6wFcsfUzqrwRG0BkHvNh5n5Jek GODio/ju8cyIIccipPLFR2qHbwh4oGiwyWmje5/U85yE5W2sp3xCec8RTZb/a74Y668+ Sbqvxnm4oS+UZfhD8ugQt2awAkJg1mhp6KbR86kswbSK2AsDDO37h6WKGS8YFsnxXRgl mz4BPGdz6lsqC98+mHWiotVfx1Gw9anCql9bAsvjs4zlC4EWttNzHdGKlu9skljYzXtv LZ4xWMt939w51PMQuXOsUuZTgrY30EiRaUCKqse357q1p2FjLYoxbl8vF0gUNXYTOqgq i/SQ== X-Gm-Message-State: ACgBeo3PnynBoqUEn6tC/t+TarEl8yLFsoy/9f2SGkjq3e1VvyZ9ETUz UIMZCLu+Dj8ln3VDMGM9mb7XttbEbKdk+w== X-Received: by 2002:a05:6808:488:b0:344:d066:5177 with SMTP id z8-20020a056808048800b00344d0665177mr3744941oid.210.1660928993062; Fri, 19 Aug 2022 10:09:53 -0700 (PDT) Received: from [192.168.1.128] ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id x19-20020a4a6213000000b004320b0cc5acsm1036958ooc.48.2022.08.19.10.09.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Aug 2022 10:09:52 -0700 (PDT) Subject: Re: [PATCH] usbip: add USBIP_URB_* URB transfer flags To: Greg KH Cc: valentina.manea.m@gmail.com, shuah@kernel.org, mailhol.vincent@wanadoo.fr, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Hongren Zenithal Zheng , Alan Stern , Shuah Khan References: <20220816215711.55025-1-skhan@linuxfoundation.org> From: Shuah Khan Message-ID: Date: Fri, 19 Aug 2022 11:09:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/19/22 2:29 AM, Greg KH wrote: > > Overall, nice work, thanks for adding this, minor comments below: > > On Tue, Aug 16, 2022 at 03:57:11PM -0600, Shuah Khan wrote: >> USBIP driver packs URB transfer flags in PDUs that are exchanged > > What is a "PDU"? Protocol Data Unit - I will expand or reword to drop it. [snip] >> +-----------+--------+---------------------------------------------------+ >> | 0x14 | 4 | transfer_flags: possible values depend on the | >> | | | URB transfer_flags (refer to URB doc in | > > You can drop the second "URB" here, as it's an USBIP document being > referred to, right? This refers to USB URB document. I can rephrase it to USBIP_URB transfer flags as it is the API now. >> >> + /* Unpack the pdu to an urb (map USBIP_URB_* to URB_* flags) */ > > No need to mention the mapping everywhere in these comments as the > function handles that. > These comments were primarily added for making sure right mapping is done. Will remove them. >> + } >> + pr_debug("%s: flag = %u map_flags = %u\n", __func__, >> + flags, map_flags); > > When using pr_debug (or dev_dbg()), you already have access to the > __func__ in the output automatically, so there's never a need to add it > again, it would just show up twice. > Good point. > Also, this should be dev_dbg(), as it's a driver, and you have access to > the device being handled (well, it needs to be passed to the > function...) > I am going to delete these - debug message isn't really needed. >> + >> + return map_flags; >> +} >> + >> +static unsigned int usbip_to_urb(unsigned int flags) >> +{ >> + unsigned int map_flags = 0; >> + int loop; >> + >> + for (loop = 0; loop < NUM_USBIP_FLAGS; loop++) { >> + if (flags & flag_map[loop].usbip_flag) >> + map_flags |= flag_map[loop].urb_flag; >> + } >> + pr_debug("%s: flag = %u map_flags = %u\n", __func__, >> + flags, map_flags); > > Same debug comment as above. Same as above. I will just delete the message. > >> + * As a result of coying the transfer flags, they now have become part > > "coying"? :) Thanks for catching this :) > >> + * of the API. Any changes to kernel flags now impact the USBIP user-space. >> + * In addition, it will be compatibility problem between server and client. >> + * These defines aren't directly referenced and it is an obscure usage >> + * hidden away in the packets. > > No need to mention the history here, just say "here are the flags for > the transfer types" > Will do. > >> + * >> + * Add code to translate the values between the numbers used in userspace >> + * and the numbers used in the kernel. This will help with any future >> + * changes to kernel flags breaking the API. > > There's no code being added in this uapi file, so you might want to > reword all of this. Possibly by removing most of it, as the history > here might not be necessary to document. > Will do. thanks for the review. Will send v2. thanks, -- Shuah