+ /* test of handling request on NULL device pointer */
+ ret = rte_kni_handle_request(NULL);
+ if (ret == 0) {
+ ret = -1;
+ printf("Unexpectedly handle request on NULL device pointer\n");
+ goto fail;
+ }
+
+ /* test of getting KNI device with pointer to NULL */
+ kni = rte_kni_get(NULL);
+ if (kni) {
+ ret = -1;
+ printf("Unexpectedly get a KNI device with "
+ "NULL name pointer\n");
+ goto fail;
+ }
+
+ /* test of getting KNI device with an zero length name string */
+ memset(&conf, 0, sizeof(conf));
+ kni = rte_kni_get(conf.name);
+ if (kni) {
+ ret = -1;
+ printf("Unexpectedly get a KNI device with "
+ "zero length name string\n");
+ goto fail;
+ }
+
+ /* test of getting KNI device with an invalid string name */
+ memset(&conf, 0, sizeof(conf));
+ rte_snprintf(conf.name, sizeof(conf.name), "testing");
+ kni = rte_kni_get(conf.name);
+ if (kni) {
+ ret = -1;
+ printf("Unexpectedly get a KNI device with "
+ "a never used name string\n");
+ goto fail;
+ }
+
+ /* test the interface of creating a KNI, for backward compatibility */
+ memset(&ops, 0, sizeof(ops));
+ ops = kni_ops;
+ kni = rte_kni_create(port_id, MAX_PACKET_SZ, mp, &ops);
+ if (!kni) {
+ ret = -1;
+ printf("Fail to create a KNI device for port %d\n", port_id);
+ goto fail;
+ }
+
+ ret = rte_kni_release(kni);
+ if (ret < 0) {
+ printf("Fail to release a KNI device\n");
+ goto fail;
+ }
+