1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include <linux/kernel.h>
#include <linux/tapi/tapi.h>
#include <linux/skbuff.h>
#include "vmmc.h"
#include "vmmc-coder.h"
struct vmmc_tapi_stream {
struct vmmc_coder *coder;
struct tapi_stream stream;
};
struct vmmc_tapi_stream *tapi_to_vmmc_stream(struct tapi_stream * stream)
{
return container_of(stream, struct vmmc_tapi_stream, stream);
}
struct tapi_stream *vmmc_stream_alloc(struct tapi_device *tdev)
{
struct vmmc *vmmc = tdev_to_vmmc(tdev);
struct vmmc_tapi_stream *stream;
struct vmmc_coder *coder;
coder = vmmc_coder_get(vmmc);
if (!coder)
return ERR_PTR(-ENODEV);
stream = kzalloc(sizeof(*stream), GFP_KERNEL);
if (!stream)
return ERR_PTR(-ENOMEM);
stream->coder = coder;
coder->stream = &stream->stream;
tapi_endpoint_set_data(&stream->stream.ep, &coder->module);
return &stream->stream;
}
void vmmc_stream_free(struct tapi_device *tdev, struct tapi_stream *tstream)
{
struct vmmc *vmmc = tdev_to_vmmc(tdev);
struct vmmc_tapi_stream *stream = tapi_to_vmmc_stream(tstream);
stream->coder->stream = NULL;
vmmc_coder_put(vmmc, stream->coder);
kfree(stream);
}
int vmmc_stream_start(struct tapi_device *tdev, struct tapi_stream *stream)
{
return 0;
}
int vmmc_stream_stop(struct tapi_device *tdev, struct tapi_stream *stream)
{
return 0;
}
int vmmc_stream_send(struct tapi_device *tdev, struct tapi_stream *stream,
struct sk_buff *skb)
{
struct vmmc *vmmc = tdev_to_vmmc(tdev);
struct vmmc_coder *coder = tapi_to_vmmc_stream(stream)->coder;
vmmc_send_paket(vmmc, coder->id, skb);
return 0;
}
/*
int vmmc_stream_recv(struct vmmc_stream *stream)
{
tapi_stream_recv(&stream->coder->vmmc->tdev stream->stream, skb);
}*/
|