. LLC: kill mac_send_pdu, use plain dev_queue_xmit

With this we avoid doing skb_clone on skbs that will not be kept on
unacked lists.
parent 344ff803
......@@ -11,8 +11,6 @@
*
* See the GNU General Public License for more details.
*/
/* Defines MAC-layer interface to LLC layer */
extern int mac_send_pdu(struct sk_buff *skb);
extern int llc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
extern struct net_device *mac_dev_peer(struct net_device *current_dev,
......
......@@ -44,5 +44,4 @@ extern void llc_sap_assign_sock(struct llc_sap *sap, struct sock *sk);
extern void llc_sap_unassign_sock(struct llc_sap *sap, struct sock *sk);
extern void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
extern void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb);
#endif /* LLC_SAP_H */
......@@ -340,12 +340,15 @@ static void llc_conn_send_pdus(struct sock *sk)
struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)skb->nh.raw;
if (!LLC_PDU_TYPE_IS_I(pdu) &&
!(skb->dev->flags & IFF_LOOPBACK))
!(skb->dev->flags & IFF_LOOPBACK)) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb);
mac_send_pdu(skb);
if (LLC_PDU_TYPE_IS_I(pdu) ||
(skb->dev && skb->dev->flags & IFF_LOOPBACK))
kfree_skb(skb);
if (!skb2)
break;
skb = skb2;
}
dev_queue_xmit(skb);
}
}
......
......@@ -39,36 +39,6 @@ static void fix_up_incoming_skb(struct sk_buff *skb);
static void llc_station_rcv(struct sk_buff *skb);
static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb);
/**
* mac_send_pdu - Sends PDU to specific device.
* @skb: pdu which must be sent
*
* If module is not initialized then returns failure, else figures out
* where to direct this PDU. Sends PDU to specific device, at this point a
* device must has been assigned to the PDU; If not, can't transmit the
* PDU. PDU sent to MAC layer, is free to re-send at a later time. Returns
* 0 on success, 1 for failure.
*/
int mac_send_pdu(struct sk_buff *skb)
{
struct sk_buff *skb2;
int pri = GFP_ATOMIC, rc = -1;
if (!skb->dev) {
dprintk("%s: skb->dev == NULL!", __FUNCTION__);
goto out;
}
if (skb->sk)
pri = (int)skb->sk->priority;
skb2 = skb_clone(skb, pri);
if (!skb2)
goto out;
rc = 0;
dev_queue_xmit(skb2);
out:
return rc;
}
/**
* llc_rcv - 802.2 entry point from net lower layers
* @skb: received pdu
......
......@@ -387,13 +387,9 @@ static void llc_station_send_pdus(struct llc_station *station)
{
struct sk_buff *skb;
while ((skb = skb_dequeue(&station->mac_pdu_q)) != NULL) {
int rc = mac_send_pdu(skb);
kfree_skb(skb);
if (rc)
while ((skb = skb_dequeue(&station->mac_pdu_q)) != NULL)
if (dev_queue_xmit(skb))
break;
}
}
/**
......
......@@ -58,7 +58,7 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb)
llc_pdu_init_as_ui_cmd(skb);
rc = lan_hdrs_init(skb, ev->saddr.mac, ev->daddr.mac);
if (!rc)
llc_sap_send_pdu(sap, skb);
rc = dev_queue_xmit(skb);
return rc;
}
......@@ -81,7 +81,7 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb)
llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0);
rc = lan_hdrs_init(skb, ev->saddr.mac, ev->daddr.mac);
if (!rc)
llc_sap_send_pdu(sap, skb);
rc = dev_queue_xmit(skb);
return rc;
}
......@@ -111,7 +111,7 @@ int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb)
llc_pdu_init_as_xid_rsp(nskb, LLC_XID_NULL_CLASS_2, 0);
rc = lan_hdrs_init(nskb, mac_sa, mac_da);
if (!rc)
llc_sap_send_pdu(sap, nskb);
rc = dev_queue_xmit(nskb);
out:
return rc;
}
......@@ -135,7 +135,7 @@ int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb)
llc_pdu_init_as_test_cmd(skb);
rc = lan_hdrs_init(skb, ev->saddr.mac, ev->daddr.mac);
if (!rc)
llc_sap_send_pdu(sap, skb);
rc = dev_queue_xmit(skb);
return rc;
}
......@@ -157,7 +157,7 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb)
llc_pdu_init_as_test_rsp(nskb, skb);
rc = lan_hdrs_init(nskb, mac_sa, mac_da);
if (!rc)
llc_sap_send_pdu(sap, nskb);
rc = dev_queue_xmit(nskb);
out:
return rc;
}
......
......@@ -132,17 +132,6 @@ void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb)
ev->ind_cfm_flag = LLC_IND;
}
/**
* llc_sap_send_pdu - Sends a frame to MAC layer for transmition
* @sap: pointer to SAP
* @skb: pdu that must be sent
*/
void llc_sap_send_pdu(struct llc_sap *sap, struct sk_buff *skb)
{
mac_send_pdu(skb);
kfree_skb(skb);
}
/**
* llc_sap_next_state - finds transition, execs actions & change SAP state
* @sap: pointer to SAP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment