{"action":"created","comment":{"url":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/comments/27157741","id":27157741,"diff_hunk":"@@ -409,18 +409,25 @@ int gnix_ep_open(struct fid_domain *domain, struct fi_info *info,\n \tep_priv->rx_progress_fn = NULL;\n \n \t/*\n-\t * TODO: hookup a nic to this ep, may add more later if\n-\t *  fi_tx_context, etc. is invoked on this endpoing\n+\t * If we've maxed out the number of nics for this domain/ptag,\n+\t * search the list of existing nics\n \t */\n \n-        list_for_each(&gnix_nic_list,elem,list) {\n-\t\tif ((elem->ptag == domain_priv->ptag) &&\n-\t\t\t(elem->cookie == domain_priv->cookie)\n-\t\t\t&& (elem->cdm_id == domain_priv->cdm_id)) {\n-\t\t\tnic = elem;\n-\t\t\tatomic_inc(&nic->ref_cnt);\n-\t\t\tbreak;\n+\tpthread_mutex_lock(&gnix_nic_list_lock);\n+\n+\tif (gnix_nics_per_ptag[domain_priv->ptag] ==","path":"prov/gni/src/gnix_ep.c","position":35,"original_position":35,"commit_id":"c0b1812556b7cf4e162de16ca6b0af6b2ea648fe","original_commit_id":"c0b1812556b7cf4e162de16ca6b0af6b2ea648fe","user":{"login":"bturrubiates","id":2322856,"avatar_url":"https://avatars.githubusercontent.com/u/2322856?v=3","gravatar_id":"","url":"https://api.github.com/users/bturrubiates","html_url":"https://github.com/bturrubiates","followers_url":"https://api.github.com/users/bturrubiates/followers","following_url":"https://api.github.com/users/bturrubiates/following{/other_user}","gists_url":"https://api.github.com/users/bturrubiates/gists{/gist_id}","starred_url":"https://api.github.com/users/bturrubiates/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bturrubiates/subscriptions","organizations_url":"https://api.github.com/users/bturrubiates/orgs","repos_url":"https://api.github.com/users/bturrubiates/repos","events_url":"https://api.github.com/users/bturrubiates/events{/privacy}","received_events_url":"https://api.github.com/users/bturrubiates/received_events","type":"User","site_admin":false},"body":"Okay good. I saw your commit message about only 253 possible ptags but I wasn't sure if that meant the values started at 0 or not. ","created_at":"2015-03-25T19:39:48Z","updated_at":"2015-03-25T19:39:48Z","html_url":"https://github.com/ofi-cray/libfabric-cray/pull/48#discussion_r27157741","pull_request_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/comments/27157741"},"html":{"href":"https://github.com/ofi-cray/libfabric-cray/pull/48#discussion_r27157741"},"pull_request":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48","id":31286113,"html_url":"https://github.com/ofi-cray/libfabric-cray/pull/48","diff_url":"https://github.com/ofi-cray/libfabric-cray/pull/48.diff","patch_url":"https://github.com/ofi-cray/libfabric-cray/pull/48.patch","issue_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/issues/48","number":48,"state":"open","locked":false,"title":"Topic/nic counting","user":{"login":"hppritcha","id":7818666,"avatar_url":"https://avatars.githubusercontent.com/u/7818666?v=3","gravatar_id":"","url":"https://api.github.com/users/hppritcha","html_url":"https://github.com/hppritcha","followers_url":"https://api.github.com/users/hppritcha/followers","following_url":"https://api.github.com/users/hppritcha/following{/other_user}","gists_url":"https://api.github.com/users/hppritcha/gists{/gist_id}","starred_url":"https://api.github.com/users/hppritcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hppritcha/subscriptions","organizations_url":"https://api.github.com/users/hppritcha/orgs","repos_url":"https://api.github.com/users/hppritcha/repos","events_url":"https://api.github.com/users/hppritcha/events{/privacy}","received_events_url":"https://api.github.com/users/hppritcha/received_events","type":"User","site_admin":false},"body":"Use the ptag for tracking number of nics opened using a given ptag.\r\nThere are only up to GNI_PTAG_USER_END (253) possible ptags\r\nso we can use a simple global array to track number of nics opened\r\nfor a given ptag.\r\n\r\nThe max # of nics/ptag will need to be determined using the number\r\nof ranks in a job running on the node, as well as limits placed\r\nby the job launcher on total number of FMA descriptors available\r\nto the ranks in the job on the local node.\r\n\r\nKeep the allocated nics in a global list to allow for multiple domains\r\nwith same ptag/cookie to use previously allocated nics.  Each domain\r\nkeeps a linked list of the domains it is using.\r\n\r\nWhen the domain is closed, loop through the domain specific list of\r\ngni nics being used, decrementing reference count.  If reference count\r\nfor a nic drops to zero, destroy the cdm, remove from the global list.\r\n\r\nStart adding locks for thread safety support for managing global\r\nnic list and ptag array.\r\n\r\n@ztiffany \r\n@sungeunchoi \r\n@bturrubiates \r\n\r\nSigned-off-by: Howard Pritchard <howardp@lanl.gov>","created_at":"2015-03-16T21:24:11Z","updated_at":"2015-03-25T19:39:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e88367891535288ee295fba5cc86d99166f3c6e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48/commits","review_comments_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48/comments","review_comment_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/issues/48/comments","statuses_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/statuses/c0b1812556b7cf4e162de16ca6b0af6b2ea648fe","head":{"label":"hppritcha:topic/nic_counting","ref":"topic/nic_counting","sha":"c0b1812556b7cf4e162de16ca6b0af6b2ea648fe","user":{"login":"hppritcha","id":7818666,"avatar_url":"https://avatars.githubusercontent.com/u/7818666?v=3","gravatar_id":"","url":"https://api.github.com/users/hppritcha","html_url":"https://github.com/hppritcha","followers_url":"https://api.github.com/users/hppritcha/followers","following_url":"https://api.github.com/users/hppritcha/following{/other_user}","gists_url":"https://api.github.com/users/hppritcha/gists{/gist_id}","starred_url":"https://api.github.com/users/hppritcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hppritcha/subscriptions","organizations_url":"https://api.github.com/users/hppritcha/orgs","repos_url":"https://api.github.com/users/hppritcha/repos","events_url":"https://api.github.com/users/hppritcha/events{/privacy}","received_events_url":"https://api.github.com/users/hppritcha/received_events","type":"User","site_admin":false},"repo":{"id":29201359,"name":"libfabric","full_name":"hppritcha/libfabric","owner":{"login":"hppritcha","id":7818666,"avatar_url":"https://avatars.githubusercontent.com/u/7818666?v=3","gravatar_id":"","url":"https://api.github.com/users/hppritcha","html_url":"https://github.com/hppritcha","followers_url":"https://api.github.com/users/hppritcha/followers","following_url":"https://api.github.com/users/hppritcha/following{/other_user}","gists_url":"https://api.github.com/users/hppritcha/gists{/gist_id}","starred_url":"https://api.github.com/users/hppritcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hppritcha/subscriptions","organizations_url":"https://api.github.com/users/hppritcha/orgs","repos_url":"https://api.github.com/users/hppritcha/repos","events_url":"https://api.github.com/users/hppritcha/events{/privacy}","received_events_url":"https://api.github.com/users/hppritcha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hppritcha/libfabric","description":"Open Fabric Interfaces","fork":true,"url":"https://api.github.com/repos/hppritcha/libfabric","forks_url":"https://api.github.com/repos/hppritcha/libfabric/forks","keys_url":"https://api.github.com/repos/hppritcha/libfabric/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hppritcha/libfabric/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hppritcha/libfabric/teams","hooks_url":"https://api.github.com/repos/hppritcha/libfabric/hooks","issue_events_url":"https://api.github.com/repos/hppritcha/libfabric/issues/events{/number}","events_url":"https://api.github.com/repos/hppritcha/libfabric/events","assignees_url":"https://api.github.com/repos/hppritcha/libfabric/assignees{/user}","branches_url":"https://api.github.com/repos/hppritcha/libfabric/branches{/branch}","tags_url":"https://api.github.com/repos/hppritcha/libfabric/tags","blobs_url":"https://api.github.com/repos/hppritcha/libfabric/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hppritcha/libfabric/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hppritcha/libfabric/git/refs{/sha}","trees_url":"https://api.github.com/repos/hppritcha/libfabric/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hppritcha/libfabric/statuses/{sha}","languages_url":"https://api.github.com/repos/hppritcha/libfabric/languages","stargazers_url":"https://api.github.com/repos/hppritcha/libfabric/stargazers","contributors_url":"https://api.github.com/repos/hppritcha/libfabric/contributors","subscribers_url":"https://api.github.com/repos/hppritcha/libfabric/subscribers","subscription_url":"https://api.github.com/repos/hppritcha/libfabric/subscription","commits_url":"https://api.github.com/repos/hppritcha/libfabric/commits{/sha}","git_commits_url":"https://api.github.com/repos/hppritcha/libfabric/git/commits{/sha}","comments_url":"https://api.github.com/repos/hppritcha/libfabric/comments{/number}","issue_comment_url":"https://api.github.com/repos/hppritcha/libfabric/issues/comments{/number}","contents_url":"https://api.github.com/repos/hppritcha/libfabric/contents/{+path}","compare_url":"https://api.github.com/repos/hppritcha/libfabric/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hppritcha/libfabric/merges","archive_url":"https://api.github.com/repos/hppritcha/libfabric/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hppritcha/libfabric/downloads","issues_url":"https://api.github.com/repos/hppritcha/libfabric/issues{/number}","pulls_url":"https://api.github.com/repos/hppritcha/libfabric/pulls{/number}","milestones_url":"https://api.github.com/repos/hppritcha/libfabric/milestones{/number}","notifications_url":"https://api.github.com/repos/hppritcha/libfabric/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hppritcha/libfabric/labels{/name}","releases_url":"https://api.github.com/repos/hppritcha/libfabric/releases{/id}","created_at":"2015-01-13T17:14:54Z","updated_at":"2015-02-24T17:55:29Z","pushed_at":"2015-03-24T21:46:04Z","git_url":"git://github.com/hppritcha/libfabric.git","ssh_url":"git@github.com:hppritcha/libfabric.git","clone_url":"https://github.com/hppritcha/libfabric.git","svn_url":"https://github.com/hppritcha/libfabric","homepage":"http://ofiwg.github.io/libfabric/","size":5485,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ofi-cray:master","ref":"master","sha":"c19a73943fa5c90613e304150f3e71a53012d1f3","user":{"login":"ofi-cray","id":10637979,"avatar_url":"https://avatars.githubusercontent.com/u/10637979?v=3","gravatar_id":"","url":"https://api.github.com/users/ofi-cray","html_url":"https://github.com/ofi-cray","followers_url":"https://api.github.com/users/ofi-cray/followers","following_url":"https://api.github.com/users/ofi-cray/following{/other_user}","gists_url":"https://api.github.com/users/ofi-cray/gists{/gist_id}","starred_url":"https://api.github.com/users/ofi-cray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofi-cray/subscriptions","organizations_url":"https://api.github.com/users/ofi-cray/orgs","repos_url":"https://api.github.com/users/ofi-cray/repos","events_url":"https://api.github.com/users/ofi-cray/events{/privacy}","received_events_url":"https://api.github.com/users/ofi-cray/received_events","type":"Organization","site_admin":false},"repo":{"id":29607348,"name":"libfabric-cray","full_name":"ofi-cray/libfabric-cray","owner":{"login":"ofi-cray","id":10637979,"avatar_url":"https://avatars.githubusercontent.com/u/10637979?v=3","gravatar_id":"","url":"https://api.github.com/users/ofi-cray","html_url":"https://github.com/ofi-cray","followers_url":"https://api.github.com/users/ofi-cray/followers","following_url":"https://api.github.com/users/ofi-cray/following{/other_user}","gists_url":"https://api.github.com/users/ofi-cray/gists{/gist_id}","starred_url":"https://api.github.com/users/ofi-cray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ofi-cray/subscriptions","organizations_url":"https://api.github.com/users/ofi-cray/orgs","repos_url":"https://api.github.com/users/ofi-cray/repos","events_url":"https://api.github.com/users/ofi-cray/events{/privacy}","received_events_url":"https://api.github.com/users/ofi-cray/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ofi-cray/libfabric-cray","description":"Open Fabric Interfaces","fork":true,"url":"https://api.github.com/repos/ofi-cray/libfabric-cray","forks_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/forks","keys_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/teams","hooks_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/hooks","issue_events_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/issues/events{/number}","events_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/events","assignees_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/assignees{/user}","branches_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/branches{/branch}","tags_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/tags","blobs_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/git/refs{/sha}","trees_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/statuses/{sha}","languages_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/languages","stargazers_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/stargazers","contributors_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/contributors","subscribers_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/subscribers","subscription_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/subscription","commits_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/commits{/sha}","git_commits_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/git/commits{/sha}","comments_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/comments{/number}","issue_comment_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/issues/comments{/number}","contents_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/contents/{+path}","compare_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/merges","archive_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/downloads","issues_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/issues{/number}","pulls_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls{/number}","milestones_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/milestones{/number}","notifications_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/labels{/name}","releases_url":"https://api.github.com/repos/ofi-cray/libfabric-cray/releases{/id}","created_at":"2015-01-21T19:30:52Z","updated_at":"2015-03-25T07:27:10Z","pushed_at":"2015-03-25T07:27:08Z","git_url":"git://github.com/ofi-cray/libfabric-cray.git","ssh_url":"git@github.com:ofi-cray/libfabric-cray.git","clone_url":"https://github.com/ofi-cray/libfabric-cray.git","svn_url":"https://github.com/ofi-cray/libfabric-cray","homepage":"http://ofiwg.github.io/libfabric/","size":6859,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":6,"forks":1,"open_issues":6,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48"},"html":{"href":"https://github.com/ofi-cray/libfabric-cray/pull/48"},"issue":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/issues/48"},"comments":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/ofi-cray/libfabric-cray/statuses/c0b1812556b7cf4e162de16ca6b0af6b2ea648fe"}}}}