[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH net-next 8/8] xen-netback: add support for toeplitz hashing



On Wed, Oct 21, 2015 at 11:36:25AM +0100, Paul Durrant wrote:
> This patch adds all the necessary infrastructure to allow a frontend to
> specify toeplitz hashing of network packets on its receive side. (See
> netif.h for details of the xenbus protocol).
> 
> The toeplitz hash algorithm itself was based on pseudo-code provided by
> Microsoft at:
> 
> https://msdn.microsoft.com/en-us/library/windows/hardware/ff570725.aspx
> 
> Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
[...]
>  
> diff --git a/drivers/net/xen-netback/interface.c 
> b/drivers/net/xen-netback/interface.c
> index 0c7da7b..38eee4f 100644
> --- a/drivers/net/xen-netback/interface.c
> +++ b/drivers/net/xen-netback/interface.c
> @@ -142,17 +142,122 @@ void xenvif_wake_queue(struct xenvif_queue *queue)
>       netif_tx_wake_queue(netdev_get_tx_queue(dev, id));
>  }
>  

I skipped the hash implementation because I don't think I know enough to
tell if it is correct or not, and protocol negotiation because I think
that's going to change in next version.

> +
> +
> +static void xen_net_read_toeplitz_key(struct xenvif *vif,
> +                                   const char *node)
> +{
> +     struct xenbus_device *dev = xenvif_to_xenbus_device(vif);
> +     char *str, *token;
> +     u8 key[40];

This should use the macro.

> +     unsigned int n, i;
> +
> +     str = xenbus_read(XBT_NIL, node, "key", NULL);
> +     if (IS_ERR(str))
> +             goto fail1;
> +
> +     memset(key, 0, sizeof(key));
> +
> +     n = 0;
> +     while ((token = strsep(&str, ",")) != NULL) {
> +             int rc;
> +
> +             if (n >= ARRAY_SIZE(vif->hash_params.toeplitz.key)) {
> +                     pr_err("%s: key too big\n",
> +                            dev->nodename);
> +                     goto fail2;
> +             }
> +
> +             rc = kstrtou8(token, 0, &key[n]);
> +             if (rc < 0) {
> +                     pr_err("%s: invalid key value (%s at index %u)\n",
> +                            dev->nodename, token, n);
> +                     goto fail2;
> +             }
> +
> +             n++;
> +     }
> +
> +     for (i = 0; i < ARRAY_SIZE(vif->hash_params.toeplitz.key); i++)
> +             vif->hash_params.toeplitz.key[i] = key[i];
> +
> +     kfree(str);
> +     return;
> +
> +fail2:
> +     kfree(str);
> +fail1:
> +     vif->hash_params.toeplitz.types = 0;
> +}
> +
[...]
> +
> +static void xen_hash_changed(struct xenbus_watch *watch,
> +                          const char **vec, unsigned int len)
> +{
> +     struct xenvif *vif = container_of(watch, struct xenvif, hash_watch);
> +
> +     xen_net_read_hash(vif);

I think the same question for previous patch applies here, too.

Is there any concern of correctness and security implication that you
just change the hash without stopping the vif?

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.