xen-netback: add control protocol implementation
My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver. A previous patch added the necessary boilerplate for mapping the control ring from the frontend, should it be created. This patch adds implementations for each of the defined protocol messages. Signed-off-by: Paul Durrant <paul.durrant@citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4e15ee2cb4
commit
40d8abdee8
5 changed files with 502 additions and 3 deletions
|
@ -89,6 +89,11 @@ module_param(fatal_skb_slots, uint, 0444);
|
|||
*/
|
||||
#define XEN_NETBACK_TX_COPY_LEN 128
|
||||
|
||||
/* This is the maximum number of flows in the hash cache. */
|
||||
#define XENVIF_HASH_CACHE_SIZE_DEFAULT 64
|
||||
unsigned int xenvif_hash_cache_size = XENVIF_HASH_CACHE_SIZE_DEFAULT;
|
||||
module_param_named(hash_cache_size, xenvif_hash_cache_size, uint, 0644);
|
||||
MODULE_PARM_DESC(hash_cache_size, "Number of flows in the hash cache");
|
||||
|
||||
static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
|
||||
u8 status);
|
||||
|
@ -2192,8 +2197,48 @@ static void push_ctrl_response(struct xenvif *vif)
|
|||
static void process_ctrl_request(struct xenvif *vif,
|
||||
const struct xen_netif_ctrl_request *req)
|
||||
{
|
||||
make_ctrl_response(vif, req, XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED,
|
||||
0);
|
||||
u32 status = XEN_NETIF_CTRL_STATUS_NOT_SUPPORTED;
|
||||
u32 data = 0;
|
||||
|
||||
switch (req->type) {
|
||||
case XEN_NETIF_CTRL_TYPE_SET_HASH_ALGORITHM:
|
||||
status = xenvif_set_hash_alg(vif, req->data[0]);
|
||||
break;
|
||||
|
||||
case XEN_NETIF_CTRL_TYPE_GET_HASH_FLAGS:
|
||||
status = xenvif_get_hash_flags(vif, &data);
|
||||
break;
|
||||
|
||||
case XEN_NETIF_CTRL_TYPE_SET_HASH_FLAGS:
|
||||
status = xenvif_set_hash_flags(vif, req->data[0]);
|
||||
break;
|
||||
|
||||
case XEN_NETIF_CTRL_TYPE_SET_HASH_KEY:
|
||||
status = xenvif_set_hash_key(vif, req->data[0],
|
||||
req->data[1]);
|
||||
break;
|
||||
|
||||
case XEN_NETIF_CTRL_TYPE_GET_HASH_MAPPING_SIZE:
|
||||
status = XEN_NETIF_CTRL_STATUS_SUCCESS;
|
||||
data = XEN_NETBK_MAX_HASH_MAPPING_SIZE;
|
||||
break;
|
||||
|
||||
case XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING_SIZE:
|
||||
status = xenvif_set_hash_mapping_size(vif,
|
||||
req->data[0]);
|
||||
break;
|
||||
|
||||
case XEN_NETIF_CTRL_TYPE_SET_HASH_MAPPING:
|
||||
status = xenvif_set_hash_mapping(vif, req->data[0],
|
||||
req->data[1],
|
||||
req->data[2]);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
make_ctrl_response(vif, req, status, data);
|
||||
push_ctrl_response(vif);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue