netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Samudrala, Sridhar" <sridhar.samudrala@intel.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: intel-wired-lan <intel-wired-lan@lists.osuosl.org>,
	Netdev <netdev@vger.kernel.org>,
	"Duyck, Alexander H" <alexander.h.duyck@intel.com>,
	Anjali Singhai Jain <anjali.singhai@intel.com>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Or Gerlitz <gerlitz.or@gmail.com>, Jiri Pirko <jiri@resnulli.us>
Subject: Re: [Intel-wired-lan] [next-queue v6 PATCH 5/7] i40e: Add TX and RX support over port netdev's in switchdev mode
Date: Fri, 14 Apr 2017 11:26:25 -0700	[thread overview]
Message-ID: <58F11451.9020104@intel.com> (raw)
In-Reply-To: <CAKgT0UfE5LPb1YPEQpE76JFcGg8Ja_RHaUQDch6P4icyCpsbaQ@mail.gmail.com>



On 4/14/2017 9:47 AM, Alexander Duyck wrote:
> On Wed, Mar 29, 2017 at 5:22 PM, Sridhar Samudrala
> <sridhar.samudrala@intel.com> wrote:
>> In switchdev mode, broadcasts from VFs are received by the PF and passed
>> to corresponding port representor netdev.
>> Any frames sent via port netdevs are sent as directed transmits to the
>> corresponding VFs. To enable directed transmit, skb metadata dst is used
>> to pass the port id and the frame is requeued to call the PFs transmit
>> routine. VF id is used as port id for VFs and PF port id is defined as
>> I40_MAIN_VSI_PORT_ID.
>>
>> Small script to demonstrate inter VF and PF to VF pings in switchdev mode.
>> PF: p4p1, VFs: p4p1_0,p4p1_1 VF Port Reps:p4p1-vf0, p4p1-vf1
>> PF Port rep: p4p1-pf
>>
>> # rmmod i40e; modprobe i40e
>> # devlink dev eswitch set pci/0000:05:00.0 mode switchdev
>> # echo 2 > /sys/class/net/p4p1/device/sriov_numvfs
>> # ip link set p4p1 vf 0 mac 00:11:22:33:44:55
>> # ip link set p4p1 vf 1 mac 00:11:22:33:44:56
>> # rmmod i40evf; modprobe i40evf
>>
>> /* Create 2 namespaces and move the VFs to the corresponding ns */
>> # ip netns add ns0
>> # ip link set p4p1_0 netns ns0
>> # ip netns exec ns0 ip addr add 192.168.1.10/24 dev p4p1_0
>> # ip netns exec ns0 ip link set p4p1_0 up
>> # ip netns add ns1
>> # ip link set p4p1_1 netns ns1
>> # ip netns exec ns1 ip addr add 192.168.1.11/24 dev p4p1_1
>> # ip netns exec ns1 ip link set p4p1_1 up
>>
>> /* bring up pf and port netdevs */
>> # ip addr add 192.168.1.1/24 dev p4p1
>> # ip link set p4p1 up
>> # ip link set p4p1-vf0 up
>> # ip link set p4p1-vf1 up
>> # ip link set p4p1-pf up
>>
>> # ip netns exec ns0 ping -c3 192.168.1.11  /* VF0 -> VF1 */
>> # ip netns exec ns1 ping -c3 192.168.1.10  /* VF1 -> VF0 */
>> # ping -c3 192.168.1.10   /* PF -> VF0 */
>> # ping -c3 192.168.1.11   /* PF -> VF1 */
>>
>> /* VF0 -> IP in same subnet - broadcasts will be seen on p4p1-vf0 & p4p1 */
>> # ip netns exec ns0 ping -c1 -W1 192.168.1.200
>> /* VF1 -> IP in same subnet -  broadcasts will be seen on p4p1-vf1 & p4p1*/
>> # ip netns exec ns0 ping -c1 -W1 192.168.1.200
>> /* port rep VF0 -> IP in same subnet - broadcasts will be seen on p4p1_0 */
>> # ping -I p4p1-vf0 -c1 -W1 192.168.1.200
>> /* port rep VF1 -> IP in same subnet  - broadcasts will be seen on p4p1_1 */
>> # ping -I p4p1-vf1 -c1 -W1 192.168.1.200
>>
>> Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
>> ---
>>   drivers/net/ethernet/intel/i40e/i40e.h             |   4 +
>>   drivers/net/ethernet/intel/i40e/i40e_main.c        |  27 +++-
>>   drivers/net/ethernet/intel/i40e/i40e_txrx.c        | 148 ++++++++++++++++++++-
>>   drivers/net/ethernet/intel/i40e/i40e_txrx.h        |   2 +
>>   drivers/net/ethernet/intel/i40e/i40e_type.h        |   3 +
>>   drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |   8 +-
>>   6 files changed, 184 insertions(+), 8 deletions(-)
>>
> <snip>
>
>> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
>> index ebffca0..86d2510 100644
>> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
>> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
>> @@ -1302,20 +1302,64 @@ static bool i40e_alloc_mapped_page(struct i40e_ring *rx_ring,
>>   }
>>
>>   /**
>> + * i40e_handle_lpbk_skb - Update skb->dev of a loopback frame
>> + * @rx_ring: rx ring in play
>> + * @skb: packet to send up
>> + **/
>> +static void i40e_handle_lpbk_skb(struct i40e_ring *rx_ring, struct sk_buff *skb)
>> +{
>> +       struct i40e_q_vector *q_vector = rx_ring->q_vector;
>> +       struct i40e_pf *pf = rx_ring->vsi->back;
>> +       struct sk_buff *nskb;
>> +       struct i40e_vf *vf;
>> +       struct ethhdr *eth;
>> +       int vf_id;
>> +
>> +       if ((skb->pkt_type != PACKET_BROADCAST) &&
>> +           (skb->pkt_type != PACKET_MULTICAST) &&
>> +           (skb->pkt_type != PACKET_OTHERHOST))
>> +               return;
>> +
>> +       eth = (struct ethhdr *)skb_mac_header(skb);
>> +
>> +       /* If a loopback packet is received in switchdev mode, clone the skb
>> +        * and pass it to the corresponding port netdev based on the source MAC.
>> +        */
>> +       for (vf_id = 0; vf_id < pf->num_alloc_vfs; vf_id++) {
>> +               vf = &pf->vf[vf_id];
>> +               if (ether_addr_equal(eth->h_source,
>> +                                    vf->default_lan_addr.addr)) {
>> +                       nskb = skb_clone(skb, GFP_ATOMIC);
>> +                       if (!nskb)
>> +                               break;
>> +                       nskb->offload_fwd_mark = 1;
> So this line is causing build errors when switchdev is not enabled.
> This whole function should probably be wrapped in a check to see if
> switchdev support is enabled or not.
Yes. will fix it in the next revision.

Thanks
Sridhar

  reply	other threads:[~2017-04-14 18:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30  0:22 [next-queue v6 PATCH 0/7] i40e: Add port representor and initial switchdev support Sridhar Samudrala
2017-03-30  0:22 ` [next-queue v6 PATCH 1/7] i40e: Introduce devlink interface Sridhar Samudrala
2017-03-30  0:22 ` [next-queue v6 PATCH 2/7] i40e: Introduce Port Representor netdevs and switchdev mode Sridhar Samudrala
2017-03-30  9:17   ` Or Gerlitz
     [not found]   ` <CAJ3xEMgVeri17KceKhnFUCCFj00yWXKtjwP4r36Pb-CSZiOTng@mail.gmail.com>
     [not found]     ` <58E2974B.30503@intel.com>
2017-04-04 11:58       ` Or Gerlitz
2017-04-04 15:29         ` [Intel-wired-lan] " Alexander Duyck
2017-04-05 13:41           ` Or Gerlitz
2017-03-30  0:22 ` [next-queue v6 PATCH 3/7] i40e: Sync link state between PF/VFs and Port representor netdevs Sridhar Samudrala
2017-03-30  0:22 ` [next-queue v6 PATCH 4/7] net: store port/representator id in metadata_dst Sridhar Samudrala
2017-03-30  0:22 ` [next-queue v6 PATCH 5/7] i40e: Add TX and RX support over port netdev's in switchdev mode Sridhar Samudrala
2017-03-30  9:26   ` Or Gerlitz
2017-04-03 18:52     ` Samudrala, Sridhar
2017-04-14 16:47   ` [Intel-wired-lan] " Alexander Duyck
2017-04-14 18:26     ` Samudrala, Sridhar [this message]
2017-03-30  0:22 ` [next-queue v6 PATCH 6/7] i40e: Add support for exposing switch port statistics via port netdevs Sridhar Samudrala
2017-03-30  0:22 ` [next-queue v6 PATCH 7/7] i40e: Add support to get switch id and port number for " Sridhar Samudrala
2017-03-30 21:45   ` Jakub Kicinski
2017-03-30 22:31     ` Alexander Duyck
2017-03-31  1:16       ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58F11451.9020104@intel.com \
    --to=sridhar.samudrala@intel.com \
    --cc=alexander.duyck@gmail.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=anjali.singhai@intel.com \
    --cc=gerlitz.or@gmail.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).