diff options
Diffstat (limited to 'src/osmo-bts-oc2g/l1_transp_hw.c')
-rw-r--r-- | src/osmo-bts-oc2g/l1_transp_hw.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/osmo-bts-oc2g/l1_transp_hw.c b/src/osmo-bts-oc2g/l1_transp_hw.c index e1d46581..5ffd6568 100644 --- a/src/osmo-bts-oc2g/l1_transp_hw.c +++ b/src/osmo-bts-oc2g/l1_transp_hw.c @@ -15,7 +15,7 @@ * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. @@ -88,18 +88,18 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) queue = container_of(fd, struct osmo_wqueue, bfd); - if (what & BSC_FD_READ) + if (what & OSMO_FD_READ) queue->read_cb(fd); - if (what & BSC_FD_EXCEPT) + if (what & OSMO_FD_EXCEPT) queue->except_cb(fd); - if (what & BSC_FD_WRITE) { + if (what & OSMO_FD_WRITE) { struct iovec iov[5]; struct msgb *msg, *tmp; int written, count = 0; - fd->when &= ~BSC_FD_WRITE; + osmo_fd_write_disable(fd); llist_for_each_entry(msg, &queue->msg_queue, list) { /* more writes than we have */ @@ -117,7 +117,7 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) /* Nothing scheduled? This should not happen. */ if (count == 0) { if (!llist_empty(&queue->msg_queue)) - fd->when |= BSC_FD_WRITE; + osmo_fd_write_enable(fd); return 0; } @@ -125,7 +125,7 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) if (written < 0) { /* nothing written?! */ if (!llist_empty(&queue->msg_queue)) - fd->when |= BSC_FD_WRITE; + osmo_fd_write_enable(fd); return 0; } @@ -144,7 +144,7 @@ static int wqueue_vector_cb(struct osmo_fd *fd, unsigned int what) } if (!llist_empty(&queue->msg_queue)) - fd->when |= BSC_FD_WRITE; + osmo_fd_write_enable(fd); } return 0; @@ -265,11 +265,7 @@ int l1if_transport_open(int q, struct oc2gl1_hdl *hdl) buf, strerror(errno)); return rc; } - read_ofd->fd = rc; - read_ofd->priv_nr = q; - read_ofd->data = hdl; - read_ofd->cb = l1if_fd_cb; - read_ofd->when = BSC_FD_READ; + osmo_fd_setup(read_ofd, rc, OSMO_FD_READ, l1if_fd_cb, hdl, q); rc = osmo_fd_register(read_ofd); if (rc < 0) { close(read_ofd->fd); @@ -288,11 +284,7 @@ int l1if_transport_open(int q, struct oc2gl1_hdl *hdl) } osmo_wqueue_init(wq, 10); wq->write_cb = l1fd_write_cb; - write_ofd->cb = wqueue_vector_cb; - write_ofd->fd = rc; - write_ofd->priv_nr = q; - write_ofd->data = hdl; - write_ofd->when = BSC_FD_WRITE; + osmo_fd_setup(write_ofd, rc, OSMO_FD_WRITE, wqueue_vector_cb, hdl, q); rc = osmo_fd_register(write_ofd); if (rc < 0) { close(write_ofd->fd); |