Permalink
Browse files

returning device model on SO_SELECT_ZC_DEVICE

  • Loading branch information...
cardigliano committed Feb 11, 2019
1 parent c09b863 commit b0f1b665f374d5a9412a6b9a1d8875f31f52ec33
Showing with 6 additions and 0 deletions.
  1. +1 −0 kernel/linux/pf_ring.h
  2. +5 −0 kernel/pf_ring.c
@@ -883,6 +883,7 @@ typedef struct {
zc_dev_operation operation;
char device_name[IFNAMSIZ];
int32_t channel_id;
zc_dev_model device_model; /* out */
} __attribute__((packed))
zc_dev_mapping;

@@ -5889,6 +5889,7 @@ static int pfring_select_zc_dev(struct pf_ring_socket *pfr, zc_dev_mapping *mapp
entry = list_entry(ptr, zc_dev_list, list);
if(strcmp(entry->zc_dev.dev->name, mapping->device_name) == 0
&& entry->zc_dev.channel_id == mapping->channel_id) {
mapping->device_model = entry->zc_dev.mem_info.device_model;
dev_found = 1;
break;
}
@@ -6875,6 +6876,10 @@ static int ring_setsockopt(struct socket *sock,
ret = pfring_select_zc_dev(pfr, &mapping);
else
ret = pfring_release_zc_dev(pfr);

if(copy_to_user(optval, &mapping, optlen)) /* returning device_model*/
return(-EFAULT);

break;

case SO_SET_MASTER_RING:

0 comments on commit b0f1b66

Please sign in to comment.