Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4115205ybg; Tue, 29 Oct 2019 02:20:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqW0RDlcfQq/CJMaHlkEyjSPc01PJ1/bxJQr1B3kG89/kxgLby2GSmrDiu+FxCPfHbmGoT X-Received: by 2002:a17:907:429e:: with SMTP id ny22mr2064460ejb.174.1572340835465; Tue, 29 Oct 2019 02:20:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572340835; cv=none; d=google.com; s=arc-20160816; b=nDp9KTKyILBEf0OJk0pqGZfhmbQ7INQ2xvlNW8HUqs9bBX+Y8G/UWBVR/G0em8Z4Tw aSKBOAI6nG+qGmX2esaX3B1vpmGdONhTQjSssJBrhEW3v1JVIMqNav1P31K1GAX/9YoF 3bM7XNe6WSV2d676bwZmJi2pbFAHqDOXzg3+11XFvaK2biYuQ6WUX4UWlhw9mBrxZtq/ 62ai1g9DTRE6zvlc66zIoobqRO0CoKIUKGAEzVbaWDcRMHTbHJZZy/rrjrlhjfqtx/iS 9M9fBoulQ/nim80ERz3QV4mB31hXC3rCAnjsqfo9EAELh1+wB1OZ1PpR4IhpSyCJOokA jFhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to; bh=4OgKdkLabpGcUUqGW4d6Dp1LWGo51kqAhOW3hQYECkU=; b=zzUPHRx156rombz5N2tuzhHRgMXJlVyqGfX0bt/90emlXT+3vp8G+FaWwd3kfaq+ql ahq7DYu4SfXBiyPV9+F+DlE3bdfXp5T4m2sK4Zkoegaa0EcCnQONTdfn+nVF5YKqVzO1 BXkodvaTHlFNlDEatdZtNiCjYGFPHp7esicvV7VvNak7ycjlvf5j8zU7KM2hsXrnqVch YrSt7EyShQD3W7qFkp2I7Ym790A7wDxsLA6GH4Okk9dfCih4aJaqrtOHQOao+LlYBUuW KAOvPwYQeE+qovGuesdnshbaiPIKKbP3eYTDumKnEnpsbW1XOiAlkcPnvZySSecgN9nQ +Qpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b28si9415179edc.400.2019.10.29.02.20.11; Tue, 29 Oct 2019 02:20:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727868AbfJ2BK7 (ORCPT + 99 others); Mon, 28 Oct 2019 21:10:59 -0400 Received: from smtp.infotech.no ([82.134.31.41]:47528 "EHLO smtp.infotech.no" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbfJ2BK6 (ORCPT ); Mon, 28 Oct 2019 21:10:58 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id 83444204197; Tue, 29 Oct 2019 02:10:55 +0100 (CET) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Src4PM4I7rHq; Tue, 29 Oct 2019 02:10:48 +0100 (CET) Received: from [192.168.48.23] (host-23-251-188-50.dyn.295.ca [23.251.188.50]) by smtp.infotech.no (Postfix) with ESMTPA id 62310204163; Tue, 29 Oct 2019 02:10:47 +0100 (CET) Reply-To: dgilbert@interlog.com Subject: Re: [PATCH 0/9] Consolidate {get,put}_unaligned_[bl]e24() definitions To: Bart Van Assche , Peter Zijlstra Cc: Ingo Molnar , Thomas Gleixner , Christoph Hellwig , "Martin K . Petersen" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org References: <20191028200700.213753-1-bvanassche@acm.org> From: Douglas Gilbert Message-ID: <21a9443a-b52c-d028-d0a5-2bbc0b4c281a@interlog.com> Date: Mon, 28 Oct 2019 21:10:44 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191028200700.213753-1-bvanassche@acm.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-10-28 4:06 p.m., Bart Van Assche wrote: > Hi Peter, > > This patch series moves the existing {get,put}_unaligned_[bl]e24() definitions > into include/linux/unaligned/generic.h. This patch series also introduces a function > for sign-extending 24-bit into 32-bit integers and introduces users for all new > functions and macros. Please consider this patch series for kernel version v5.5. And while you are at it, the sg3_utils user space copy of include/linux/unaligned/*.h (called sg_unaligned.h) has bindings for 48 bit operations. Checking my sg3_utils code, in VPD page 0x83 (mandatory device identification page) the EUI-64 based 16-byte designator has a 6 byte field (the "vendor specific extension identifier"). Also the SET TIMESTAMP and REPORT TIMESTAMP commands have a 6 byte timestamp field. There are also some attribute pages associated with the READ ATTRIBUTE command that have 6 byte fields. A recent trend with the pages returned by the SCSI LOG SENSE command is to have (big endian) fields whose length (in bytes) is encoded in the response. I have this function for those: /* Returns 0 if 'num_bytes' is less than or equal to 0 or greater than * 8 (i.e. sizeof(uint64_t)). Else returns result in uint64_t which is * an 8 byte unsigned integer. */ static inline uint64_t sg_get_unaligned_be(int num_bytes, const void *p) And I can see NVMe code in smartmontools using that one: nvmeprint.cpp: jrns["eui64"]["ext_id"] = sg_get_unaligned_be(5, id_ns.eui64 + 3); Doug Gilbert > Thanks, > > Bart. > > Bart Van Assche (9): > linux/unaligned/byteshift.h: Remove superfluous casts > c6x: Include instead of duplicating it > treewide: Consolidate {get,put}_unaligned_[bl]e24() definitions > drivers/iio: Sign extend without triggering implementation-defined > behavior > scsi/st: Use get_unaligned_signed_be24() > scsi/trace: Use get_unaligned_be*() > arm/ecard: Use get_unaligned_le{16,24}() > IB/qib: Sign extend without triggering implementation-defined behavior > ASoC/fsl_spdif: Use put_unaligned_be24() instead of open-coding it > > arch/arm/mach-rpc/ecard.c | 18 +-- > arch/c6x/include/asm/unaligned.h | 65 +-------- > .../iio/common/st_sensors/st_sensors_core.c | 7 +- > drivers/infiniband/hw/qib/qib_rc.c | 2 +- > drivers/nvme/host/rdma.c | 8 -- > drivers/nvme/target/rdma.c | 6 - > drivers/scsi/scsi_trace.c | 128 ++++++------------ > drivers/scsi/st.c | 4 +- > drivers/usb/gadget/function/f_mass_storage.c | 1 + > drivers/usb/gadget/function/storage_common.h | 5 - > include/linux/unaligned/be_byteshift.h | 6 +- > include/linux/unaligned/generic.h | 44 ++++++ > include/linux/unaligned/le_byteshift.h | 6 +- > include/target/target_core_backend.h | 6 - > sound/soc/fsl/fsl_spdif.c | 5 +- > 15 files changed, 103 insertions(+), 208 deletions(-) >