From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 372FB45721; Fri, 2 Aug 2024 22:26:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A43A427C3; Fri, 2 Aug 2024 22:26:28 +0200 (CEST) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mails.dpdk.org (Postfix) with ESMTP id 2D411427B6 for ; Fri, 2 Aug 2024 22:26:27 +0200 (CEST) Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-75a6c290528so5944774a12.1 for ; Fri, 02 Aug 2024 13:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1722630386; x=1723235186; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TvB8scLPTFXqIJOzbC5S2axj9cgGt8EDtojUrA2c1NM=; b=ffSMBikAMzZGdx5dvke1V3bjfkZeudy6wIJdt7Ad3/HkWuBan2nliS8Sf7maZ8/6MH 27QDASOc0z+4jat+p0MAXctFiAAriP7XvpmsUDDdquprTtWxGXteRsUT3jLaxwpUZkpA hF20U1SVXDUq9JF6NzXM5y+mEIm/PA1TAbzLI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722630386; x=1723235186; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TvB8scLPTFXqIJOzbC5S2axj9cgGt8EDtojUrA2c1NM=; b=JRyl/GtAW3ZnfPzmwz8Pj4JYI8LhLVskAaIJRBvX9pQpILJ5Z8ns7Zgs5zs9HtPbDk Mwt6QBXno8mM/PNL6vb+sWaC/98WmdvdFBbtRl4JzE2mgafRyveYFO1escdrAgEq3zMR sgVDGhpijbledljie5X0OVDkn53SwKqtgST2qTOgWqISRZ52OKa/3Ot+t5Bg2xAC8Yyt NfS4SDOP+YoB6GKBc5xB0NI7t1LSQ+s/UMGo8+oHZEcDT66wWUhYaJ7Hj0a+xUlxa4sd +CmsoJNOAcxhtbbARA+cIctEOu3+sgckffgpEsUM0rSTqsok+FNXCaj40uzct+33brNY iq8g== X-Forwarded-Encrypted: i=1; AJvYcCVG3h8yL11oHH2lqyGtxzQjrM1ediEOANTOaChDEXp53x8uHVkSGcitpPV8POoyUdxrk+1xQ2nGcYfDT4A= X-Gm-Message-State: AOJu0YyXsjbLgR7gANDV1nxYcBby8puGTKH72fZt2JFo073umoeiHYdw mLK8Cs2//V3y6jthDeIy0zvZHYEMGiu4FsvS1qEr9ZeJzBWwBAQRkR0ec59EJhkUv8SjcURhnjC +nLOXn9RIrzje8bWHiS5jeL36V2DUq0Oo+xiWHA== X-Google-Smtp-Source: AGHT+IEDfBqLZCqjDqPYFKnt1+yBJutfGNzU5AdsbC/2GmoN/9+m0PJa8BChOLv/MkOxQ9Hwx4NOVdZOjt96YzHMMjY= X-Received: by 2002:a17:90a:1547:b0:2c9:5c67:dd9e with SMTP id 98e67ed59e1d1-2cff9461605mr5413633a91.19.1722630386174; Fri, 02 Aug 2024 13:26:26 -0700 (PDT) MIME-Version: 1.0 References: <20240726163915.19277-2-npratte@iol.unh.edu> <20240726164514.24775-1-npratte@iol.unh.edu> In-Reply-To: <20240726164514.24775-1-npratte@iol.unh.edu> From: Jeremy Spewock Date: Fri, 2 Aug 2024 16:26:15 -0400 Message-ID: Subject: Re: [PATCH v4 1/2] dts: add methods for setting mac and multicast addresses To: Nicholas Pratte Cc: probb@iol.unh.edu, dmarx@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Oops, I just reviewed an older version without realizing this one existed, haha. Although, seeing the full diff again I saw a few documentation nit-picks that I put below. On Fri, Jul 26, 2024 at 12:45=E2=80=AFPM Nicholas Pratte wrote: > > New methods have been added to TestPMDShell in order to produce the mac > filter's individual test cases: > - set_mac_addr > - set_multicast_mac_addr > > set_mac_addr and set_multicast_addr were created for the mac filter test > suite, enabling users to both add or remove mac and multicast > addresses based on a boolean 'add or remove' parameter. The success or > failure of each call can be verified if a user deems it necessary. > > Bugzilla ID: 1454 > Signed-off-by: Nicholas Pratte > --- > dts/framework/remote_session/testpmd_shell.py | 59 +++++++++++++++++++ > 1 file changed, 59 insertions(+) > > diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framewor= k/remote_session/testpmd_shell.py > index 8e5a1c084a..64ffb23439 100644 > --- a/dts/framework/remote_session/testpmd_shell.py > +++ b/dts/framework/remote_session/testpmd_shell.py > @@ -765,6 +765,65 @@ def show_port_info(self, port_id: int) -> TestPmdPor= t: > > return TestPmdPort.parse(output) > > + def set_mac_addr(self, port_id: int, mac_address: str, add: bool, ve= rify: bool =3D True) -> None: > + """Add or remove a mac address on a given port's Allowlist. > + > + Args: > + port_id: The port ID the mac address is set on. > + mac_address: The mac address to be added or removed to the s= pecified port. This might be more clear if it said the mac address to be "added to or removed from" since the "removed to" doesn't exactly fit. > + add: If :data:`True`, add the specified mac address. If :dat= a:`False`, remove specified > + mac address. > + verify: If :data:'True', assert that the 'mac_addr' operatio= n was successful. If > + :data:'False', run the command and skip this assertion. > + > + Raises: > + InteractiveCommandExecutionError: If the set mac address ope= ration fails. > + """ > + mac_cmd =3D "add" if add else "remove" > + output =3D self.send_command(f"mac_addr {mac_cmd} {port_id} {mac= _address}") > + if "Bad arguments" in output: > + self._logger.debug("Invalid argument provided to mac_addr") > + raise InteractiveCommandExecutionError("Invalid argument pro= vided") > + > + if verify: > + if "mac_addr_cmd error:" in output: > + self._logger.debug(f"Failed to {mac_cmd} {mac_address} o= n port {port_id}") > + raise InteractiveCommandExecutionError( > + f"Failed to {mac_cmd} {mac_address} on port {port_id= } \n{output}" > + ) > + > + def set_multicast_mac_addr( > + self, port_id: int, multi_addr: str, add: bool, verify: bool =3D= True > + ) -> None: > + """Add or remove multicast mac address to a specified port's fil= ter. Same thing here as above, but it might be a little trickier here. Maybe this could be something like allow or disallow to make it more homogeneous? I'm not quite sure. > + > + Args: > + port_id: The port ID the multicast address is set on. > + multi_addr: The multicast address to be added to the filter. Since this method also has an `add` parameter, it would probably be helpful to specify that this also can be either added to or removed from the filter. > + add: If :data:'True', add the specified multicast address to= the port filter. > + If :data:'False', remove the specified multicast address= from the port filter. > + verify: If :data:'True', assert that the 'mcast_addr' operat= ions was successful. > + If :data:'False', execute the 'mcast_addr' operation and= skip the assertion. > + > + Raises: > + InteractiveCommandExecutionError: If either the 'add' or 're= move' operations fails. > + """ > + mcast_cmd =3D "add" if add else "remove" > + output =3D self.send_command(f"mcast_addr {mcast_cmd} {port_id} = {multi_addr}") > + if "Bad arguments" in output: > + self._logger.debug("Invalid arguments provided to mcast_addr= ") > + raise InteractiveCommandExecutionError("Invalid argument pro= vided") > + > + if verify: > + if ( > + "Invalid multicast_addr" in output > + or f'multicast address {"already" if add else "not"} fil= tered by port' in output > + ): > + self._logger.debug(f"Failed to {mcast_cmd} {multi_addr} = on port {port_id}") > + raise InteractiveCommandExecutionError( > + f"Failed to {mcast_cmd} {multi_addr} on port {port_i= d} \n{output}" > + ) > + > def show_port_stats_all(self) -> list[TestPmdPortStats]: > """Returns the statistics of all the ports. > > -- > 2.44.0 >