lce: add support for retransmissions
Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
949b2a8059
commit
6f8f9fe140
|
@ -51,6 +51,7 @@ enum dect_release_modes {
|
|||
*
|
||||
* @list: Datalink transaction list node
|
||||
* @link: Associated data link
|
||||
* @mb: Message buffer for retransmissions
|
||||
* @pd: Protocol discriminator
|
||||
* @role: Role (initiator/responder)
|
||||
* @tv: Transaction value
|
||||
|
@ -59,6 +60,7 @@ enum dect_s_pd_values;
|
|||
struct dect_transaction {
|
||||
struct list_head list;
|
||||
struct dect_data_link *link;
|
||||
struct dect_msg_buf *mb;
|
||||
enum dect_pds pd;
|
||||
enum dect_transaction_role role:8;
|
||||
enum dect_transaction_state state:8;
|
||||
|
@ -85,9 +87,11 @@ extern void dect_transaction_get_ulei(struct sockaddr_dect_lu *addr,
|
|||
const struct dect_transaction *ta);
|
||||
|
||||
extern int dect_lce_send(const struct dect_handle *dh,
|
||||
const struct dect_transaction *ta,
|
||||
struct dect_transaction *ta,
|
||||
const struct dect_sfmt_msg_desc *desc,
|
||||
const struct dect_msg_common *msg, uint8_t type);
|
||||
extern int dect_lce_retransmit(const struct dect_handle *dh,
|
||||
struct dect_transaction *ta);
|
||||
|
||||
/**
|
||||
* struct dect_nwk_protocol - NWK layer protocol
|
||||
|
@ -104,7 +108,7 @@ struct dect_nwk_protocol {
|
|||
enum dect_pds pd;
|
||||
uint16_t max_transactions;
|
||||
void (*open)(struct dect_handle *dh,
|
||||
const struct dect_transaction *req,
|
||||
struct dect_transaction *req,
|
||||
struct dect_msg_buf *mb);
|
||||
void (*shutdown)(struct dect_handle *dh,
|
||||
struct dect_transaction *req);
|
||||
|
|
2
src/cc.c
2
src/cc.c
|
@ -1556,7 +1556,7 @@ out:
|
|||
}
|
||||
|
||||
static void dect_cc_open(struct dect_handle *dh,
|
||||
const struct dect_transaction *req,
|
||||
struct dect_transaction *req,
|
||||
struct dect_msg_buf *mb)
|
||||
{
|
||||
dect_debug(DECT_DEBUG_CC, "CC: unknown transaction: msg type: %x\n", mb->type);
|
||||
|
|
28
src/lce.c
28
src/lce.c
|
@ -418,7 +418,7 @@ static int dect_send(const struct dect_handle *dh,
|
|||
*
|
||||
*/
|
||||
int dect_lce_send(const struct dect_handle *dh,
|
||||
const struct dect_transaction *ta,
|
||||
struct dect_transaction *ta,
|
||||
const struct dect_sfmt_msg_desc *desc,
|
||||
const struct dect_msg_common *msg, uint8_t type)
|
||||
{
|
||||
|
@ -445,6 +445,11 @@ int dect_lce_send(const struct dect_handle *dh,
|
|||
if (ta->role == DECT_TRANSACTION_RESPONDER)
|
||||
mb->data[0] |= DECT_S_TI_F_FLAG;
|
||||
|
||||
if (ta->mb != NULL)
|
||||
dect_mbuf_free(dh, ta->mb);
|
||||
ta->mb = mb;
|
||||
mb->refcnt++;
|
||||
|
||||
switch (ddl->state) {
|
||||
case DECT_DATA_LINK_ESTABLISHED:
|
||||
return dect_send(dh, ddl, mb);
|
||||
|
@ -456,6 +461,19 @@ int dect_lce_send(const struct dect_handle *dh,
|
|||
}
|
||||
}
|
||||
|
||||
int dect_lce_retransmit(const struct dect_handle *dh,
|
||||
struct dect_transaction *ta)
|
||||
{
|
||||
struct dect_data_link *ddl = ta->link;
|
||||
|
||||
if (ta->mb != NULL &&
|
||||
ddl->state == DECT_DATA_LINK_ESTABLISHED) {
|
||||
ta->mb->refcnt++;
|
||||
return dect_send(dh, ddl, ta->mb);
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dect_ddl_rcv_msg(struct dect_handle *dh, struct dect_data_link *ddl)
|
||||
{
|
||||
struct dect_msg_buf _mb, *mb = &_mb;
|
||||
|
@ -807,7 +825,7 @@ static void dect_ddl_page_timer(struct dect_handle *dh, struct dect_timer *timer
|
|||
}
|
||||
|
||||
static int dect_lce_send_page_reject(const struct dect_handle *dh,
|
||||
const struct dect_transaction *ta,
|
||||
struct dect_transaction *ta,
|
||||
enum dect_reject_reasons reason)
|
||||
{
|
||||
struct dect_ie_reject_reason reject_reason;
|
||||
|
@ -824,7 +842,7 @@ static int dect_lce_send_page_reject(const struct dect_handle *dh,
|
|||
}
|
||||
|
||||
static void dect_lce_rcv_page_response(struct dect_handle *dh,
|
||||
const struct dect_transaction *ta,
|
||||
struct dect_transaction *ta,
|
||||
struct dect_msg_buf *mb)
|
||||
{
|
||||
struct dect_lce_page_response_msg msg;
|
||||
|
@ -998,7 +1016,7 @@ static void dect_lce_rcv(struct dect_handle *dh, struct dect_transaction *ta,
|
|||
}
|
||||
|
||||
static void dect_lce_open(struct dect_handle *dh,
|
||||
const struct dect_transaction *ta,
|
||||
struct dect_transaction *ta,
|
||||
struct dect_msg_buf *mb)
|
||||
{
|
||||
switch (mb->type) {
|
||||
|
@ -1101,6 +1119,8 @@ void dect_close_transaction(struct dect_handle *dh, struct dect_transaction *ta,
|
|||
|
||||
list_del(&ta->list);
|
||||
ta->state = DECT_TRANSACTION_CLOSED;
|
||||
if (ta->mb != NULL)
|
||||
dect_mbuf_free(dh, ta->mb);
|
||||
|
||||
switch (ddl->state) {
|
||||
case DECT_DATA_LINK_RELEASED:
|
||||
|
|
30
src/mm.c
30
src/mm.c
|
@ -550,7 +550,7 @@ static struct dect_mm_endpoint *dect_mm_endpoint(struct dect_transaction *ta)
|
|||
}
|
||||
|
||||
static int dect_mm_send_msg(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_sfmt_msg_desc *desc,
|
||||
const struct dect_msg_common *msg,
|
||||
enum dect_mm_msg_types type)
|
||||
|
@ -809,7 +809,7 @@ err1:
|
|||
EXPORT_SYMBOL(dect_mm_authenticate_req);
|
||||
|
||||
static int dect_mm_send_authenticate_reply(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_authenticate_param *param)
|
||||
{
|
||||
struct dect_mm_authentication_reply_msg msg = {
|
||||
|
@ -827,7 +827,7 @@ static int dect_mm_send_authenticate_reply(const struct dect_handle *dh,
|
|||
}
|
||||
|
||||
static int dect_mm_send_authenticate_reject(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_authenticate_param *param)
|
||||
{
|
||||
struct dect_mm_authentication_reject_msg msg = {
|
||||
|
@ -1081,7 +1081,7 @@ err1:
|
|||
EXPORT_SYMBOL(dect_mm_cipher_req);
|
||||
|
||||
static int dect_mm_send_cipher_reject(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_cipher_param *param)
|
||||
{
|
||||
struct dect_mm_cipher_reject_msg msg = {
|
||||
|
@ -1329,7 +1329,7 @@ err1:
|
|||
EXPORT_SYMBOL(dect_mm_access_rights_req);
|
||||
|
||||
static int dect_mm_send_access_rights_accept(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_access_rights_param *param)
|
||||
{
|
||||
struct dect_ie_fixed_identity fixed_identity;
|
||||
|
@ -1358,7 +1358,7 @@ static int dect_mm_send_access_rights_accept(const struct dect_handle *dh,
|
|||
}
|
||||
|
||||
static int dect_mm_send_access_rights_reject(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_access_rights_param *param)
|
||||
{
|
||||
struct dect_mm_access_rights_reject_msg msg = {
|
||||
|
@ -1590,7 +1590,7 @@ err1:
|
|||
EXPORT_SYMBOL(dect_mm_access_rights_terminate_req);
|
||||
|
||||
static int dect_mm_send_access_rights_terminate_accept(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_access_rights_terminate_param *param)
|
||||
{
|
||||
struct dect_mm_access_rights_terminate_accept_msg msg = {
|
||||
|
@ -1602,7 +1602,7 @@ static int dect_mm_send_access_rights_terminate_accept(const struct dect_handle
|
|||
}
|
||||
|
||||
static int dect_mm_send_access_rights_terminate_reject(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_access_rights_terminate_param *param)
|
||||
{
|
||||
struct dect_mm_access_rights_terminate_reject_msg msg = {
|
||||
|
@ -1821,7 +1821,7 @@ err1:
|
|||
EXPORT_SYMBOL(dect_mm_locate_req);
|
||||
|
||||
static int dect_mm_send_locate_accept(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_locate_param *param)
|
||||
{
|
||||
struct dect_mm_locate_accept_msg msg = {
|
||||
|
@ -1840,7 +1840,7 @@ static int dect_mm_send_locate_accept(const struct dect_handle *dh,
|
|||
}
|
||||
|
||||
static int dect_mm_send_locate_reject(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_locate_param *param)
|
||||
{
|
||||
struct dect_mm_locate_reject_msg msg = {
|
||||
|
@ -2334,7 +2334,7 @@ err1:
|
|||
EXPORT_SYMBOL(dect_mm_identity_req);
|
||||
|
||||
static int dect_mm_send_temporary_identity_assign_ack(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_identity_assign_param *param)
|
||||
{
|
||||
struct dect_mm_temporary_identity_assign_ack_msg msg = {
|
||||
|
@ -2347,7 +2347,7 @@ static int dect_mm_send_temporary_identity_assign_ack(const struct dect_handle *
|
|||
}
|
||||
|
||||
static int dect_mm_send_temporary_identity_assign_rej(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_identity_assign_param *param)
|
||||
{
|
||||
struct dect_mm_temporary_identity_assign_rej_msg msg = {
|
||||
|
@ -2594,7 +2594,7 @@ err1:
|
|||
EXPORT_SYMBOL(dect_mm_info_req);
|
||||
|
||||
static int dect_mm_send_info_accept(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_info_param *param)
|
||||
{
|
||||
struct dect_mm_info_accept_msg msg = {
|
||||
|
@ -2613,7 +2613,7 @@ static int dect_mm_send_info_accept(const struct dect_handle *dh,
|
|||
}
|
||||
|
||||
static int dect_mm_send_info_reject(const struct dect_handle *dh,
|
||||
const struct dect_mm_procedure *mp,
|
||||
struct dect_mm_procedure *mp,
|
||||
const struct dect_mm_info_param *param)
|
||||
{
|
||||
struct dect_mm_info_reject_msg msg = {
|
||||
|
@ -3077,7 +3077,7 @@ static void dect_mm_rcv(struct dect_handle *dh, struct dect_transaction *ta,
|
|||
}
|
||||
|
||||
static void dect_mm_open(struct dect_handle *dh,
|
||||
const struct dect_transaction *req,
|
||||
struct dect_transaction *req,
|
||||
struct dect_msg_buf *mb)
|
||||
{
|
||||
struct dect_mm_endpoint *mme;
|
||||
|
|
Reference in New Issue