From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68B0AC10F14 for ; Tue, 23 Apr 2019 09:32:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 357E820811 for ; Tue, 23 Apr 2019 09:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbfDWJcb (ORCPT ); Tue, 23 Apr 2019 05:32:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42094 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbfDWJca (ORCPT ); Tue, 23 Apr 2019 05:32:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4716830ADBB2; Tue, 23 Apr 2019 09:32:30 +0000 (UTC) Received: from localhost (holly.tpb.lab.eng.brq.redhat.com [10.43.134.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8087B60C62; Tue, 23 Apr 2019 09:32:28 +0000 (UTC) Date: Tue, 23 Apr 2019 11:32:13 +0200 From: Miroslav Lichvar To: Hangbin Liu Cc: Richard Cochran , Jiri Benc , netdev@vger.kernel.org, David Miller , Patrick McHardy , stefan.sorensen@spectralink.com Subject: Re: [PATCH net-next] macvlan: pass get_ts_info and SIOC[SG]HWTSTAMP ioctl to real device Message-ID: <20190423093213.GA7246@localhost> References: <20190320022333.3378-1-liuhangbin@gmail.com> <20190417061452.GA18865@dhcp-12-139.nay.redhat.com> <20190417154306.om6rjkxq4hikhsht@localhost> <20190417205958.6508bda2@redhat.com> <20190418033157.irs25halxnemh65y@localhost> <20190418080509.GD5984@localhost> <20190423041817.GE18865@dhcp-12-139.nay.redhat.com> <20190423083141.GA5188@localhost> <20190423091543.GF18865@dhcp-12-139.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190423091543.GF18865@dhcp-12-139.nay.redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 23 Apr 2019 09:32:30 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Apr 23, 2019 at 05:15:43PM +0800, Hangbin Liu wrote: > On Tue, Apr 23, 2019 at 10:31:41AM +0200, Miroslav Lichvar wrote: > > V2_L4_SYNC is already selected, only the following filters could be > > selected on the macvlan interface: > > > > HWTSTAMP_FILTER_PTP_V2_L4_SYNC, > > HWTSTAMP_FILTER_PTP_V2_L4_EVENT, > > HWTSTAMP_FILTER_PTP_V2_SYNC, > > HWTSTAMP_FILTER_PTP_V2_EVENT, > > HWTSTAMP_FILTER_ALL, > > > > I think one way to check this would be to assign each filter a > > (16-bit?) value where the individual bits correspond to the message > > types and the newly selected filter would have to contain all bits of > > the old one. > > Just like I said, how to compare with different types. If those values I described above were in an array called ts_map indexed by the RX filter enum, I think the check could just be: (ts_map[old_filter] & ts_map[new_filter]) == tsmap[old_filter] The individual bits would correspond to: PTP_V1_L4_SYNC PTP_V1_L4_DELAY_REQ PTP_V2_L4_SYNC PTP_V2_L4_DELAY_REQ PTP_V2_L2_SYNC PTP_V2_L2_DELAY_REQ NTP_ALL And the remaining RX filters would be combinations of those. -- Miroslav Lichvar