-/* Get the sndbuf space available at the time on the association. */
-static inline int sctp_wspace(struct sctp_association *asoc)
-{
- struct sock *sk = asoc->base.sk;
- int amt = 0;
-
- amt = sk->sk_sndbuf - asoc->sndbuf_used;
- if (amt < 0)
- amt = 0;
- return amt;
-}
-
-/* Increment the used sndbuf space count of the corresponding association by
- * the size of the outgoing data chunk.
- * Also, set the skb destructor for sndbuf accounting later.
- *
- * Since it is always 1-1 between chunk and skb, and also a new skb is always
- * allocated for chunk bundling in sctp_packet_transmit(), we can use the
- * destructor in the data chunk skb for the purpose of the sndbuf space
- * tracking.
- */
-static inline void sctp_set_owner_w(struct sctp_chunk *chunk)
-{
- struct sctp_association *asoc = chunk->asoc;
- struct sock *sk = asoc->base.sk;
-
- /* The sndbuf space is tracked per association. */
- sctp_association_hold(asoc);
-
- chunk->skb->destructor = sctp_wfree;
- /* Save the chunk pointer in skb for sctp_wfree to use later. */
- *((struct sctp_chunk **)(chunk->skb->cb)) = chunk;
-
- asoc->sndbuf_used += SCTP_DATA_SNDSIZE(chunk);
- sk->sk_wmem_queued += SCTP_DATA_SNDSIZE(chunk);
-}
-
-/* Verify that this is a valid address. */
-static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr,
- int len)
-{
- struct sctp_af *af;
-
- /* Verify basic sockaddr. */
- af = sctp_sockaddr_af(sctp_sk(sk), addr, len);
- if (!af)
- return -EINVAL;
-
- /* Is this a valid SCTP address? */
- if (!af->addr_valid(addr, sctp_sk(sk)))
- return -EINVAL;
-
- if (!sctp_sk(sk)->pf->send_verify(sctp_sk(sk), (addr)))
- return -EINVAL;
-
- return 0;
-}
-