aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap/netmap_legacy.c
diff options
context:
space:
mode:
authorVincenzo Maffione <vmaffione@FreeBSD.org>2019-02-05 12:10:48 +0000
committerVincenzo Maffione <vmaffione@FreeBSD.org>2019-02-05 12:10:48 +0000
commit75f4f3ed51ea3eb78ed77e255845aa301b657bc4 (patch)
treec151c57cccbd72b2e392c0a13a713d95e22fee85 /sys/dev/netmap/netmap_legacy.c
parentbaed5270e1a6863444b97ccb107d08b317eb84a3 (diff)
netmap: refactor logging macros and pipes
Changelist: - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr and nm_prlim, to avoid possible naming conflicts. - Add netmap_krings_mode_commit() helper function and use that to reduce code duplication. - Refactor pipes control code to export some functions that can be reused by the veth driver (on Linux) and epair(4). - Add check to reject API requests with version less than 11. - Small code refactoring for the null adapter. MFC after: 1 week
Notes
svn path=/head/; revision=343772
Diffstat (limited to 'sys/dev/netmap/netmap_legacy.c')
-rw-r--r--sys/dev/netmap/netmap_legacy.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/netmap/netmap_legacy.c b/sys/dev/netmap/netmap_legacy.c
index 9159c1bce4c8..afbd5ced8510 100644
--- a/sys/dev/netmap/netmap_legacy.c
+++ b/sys/dev/netmap/netmap_legacy.c
@@ -365,7 +365,14 @@ netmap_ioctl_legacy(struct netmap_priv_d *priv, u_long cmd, caddr_t data,
/* Request for the legacy control API. Convert it to a
* NIOCCTRL request. */
struct nmreq *nmr = (struct nmreq *) data;
- struct nmreq_header *hdr = nmreq_from_legacy(nmr, cmd);
+ struct nmreq_header *hdr;
+
+ if (nmr->nr_version < 11) {
+ nm_prerr("Minimum supported API is 11 (requested %u)",
+ nmr->nr_version);
+ return EINVAL;
+ }
+ hdr = nmreq_from_legacy(nmr, cmd);
if (hdr == NULL) { /* out of memory */
return ENOMEM;
}
@@ -390,14 +397,14 @@ netmap_ioctl_legacy(struct netmap_priv_d *priv, u_long cmd, caddr_t data,
#ifdef __FreeBSD__
case FIONBIO:
case FIOASYNC:
- ND("FIONBIO/FIOASYNC are no-ops");
+ /* FIONBIO/FIOASYNC are no-ops. */
break;
case BIOCIMMEDIATE:
case BIOCGHDRCMPLT:
case BIOCSHDRCMPLT:
case BIOCSSEESENT:
- D("ignore BIOCIMMEDIATE/BIOCSHDRCMPLT/BIOCSHDRCMPLT/BIOCSSEESENT");
+ /* Ignore these commands. */
break;
default: /* allow device-specific ioctls */